that was
│ │ │ │ - * supplied to the `round` method.
│ │ │ │ - *
│ │ │ │ - * @param {int} newOpacity The new opacity to use (0-1).
│ │ │ │ - */
│ │ │ │ - changeOpacity: function(theDiv, newOpacity) {
│ │ │ │ -
│ │ │ │ - var mozillaOpacity = newOpacity;
│ │ │ │ - var ieOpacity = 'alpha(opacity=' + newOpacity * 100 + ')';
│ │ │ │ -
│ │ │ │ - theDiv.style.opacity = mozillaOpacity;
│ │ │ │ - theDiv.style.filter = ieOpacity;
│ │ │ │ -
│ │ │ │ - var spanElements = theDiv.parentNode.getElementsByTagName("span");
│ │ │ │ -
│ │ │ │ - for (var currIdx = 0; currIdx < spanElements.length; currIdx++) {
│ │ │ │ - spanElements[currIdx].style.opacity = mozillaOpacity;
│ │ │ │ - spanElements[currIdx].style.filter = ieOpacity;
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /** this function takes care of redoing the rico cornering
│ │ │ │ - *
│ │ │ │ - * you can't just call updateRicoCorners() again and pass it a
│ │ │ │ - * new options string. you have to first remove the divs that
│ │ │ │ - * rico puts on top and below the content div.
│ │ │ │ - *
│ │ │ │ - * @param {DOM} theDiv - A child of the outer
that was
│ │ │ │ - * supplied to the `round` method.
│ │ │ │ - *
│ │ │ │ - * @param {Object} options - list of options
│ │ │ │ - */
│ │ │ │ - reRound: function(theDiv, options) {
│ │ │ │ -
│ │ │ │ - var topRico = theDiv.parentNode.childNodes[0];
│ │ │ │ - //theDiv would be theDiv.parentNode.childNodes[1]
│ │ │ │ - var bottomRico = theDiv.parentNode.childNodes[2];
│ │ │ │ -
│ │ │ │ - theDiv.parentNode.removeChild(topRico);
│ │ │ │ - theDiv.parentNode.removeChild(bottomRico);
│ │ │ │ -
│ │ │ │ - this.round(theDiv.parentNode, options);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _roundCornersImpl: function(e, color, bgColor) {
│ │ │ │ - if (this.options.border) {
│ │ │ │ - this._renderBorder(e, bgColor);
│ │ │ │ - }
│ │ │ │ - if (this._isTopRounded()) {
│ │ │ │ - this._roundTopCorners(e, color, bgColor);
│ │ │ │ - }
│ │ │ │ - if (this._isBottomRounded()) {
│ │ │ │ - this._roundBottomCorners(e, color, bgColor);
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _renderBorder: function(el, bgColor) {
│ │ │ │ - var borderValue = "1px solid " + this._borderColor(bgColor);
│ │ │ │ - var borderL = "border-left: " + borderValue;
│ │ │ │ - var borderR = "border-right: " + borderValue;
│ │ │ │ - var style = "style='" + borderL + ";" + borderR + "'";
│ │ │ │ - el.innerHTML = "
" + el.innerHTML + "
";
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _roundTopCorners: function(el, color, bgColor) {
│ │ │ │ - var corner = this._createCorner(bgColor);
│ │ │ │ - for (var i = 0; i < this.options.numSlices; i++) {
│ │ │ │ - corner.appendChild(this._createCornerSlice(color, bgColor, i, "top"));
│ │ │ │ - }
│ │ │ │ - el.style.paddingTop = 0;
│ │ │ │ - el.insertBefore(corner, el.firstChild);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _roundBottomCorners: function(el, color, bgColor) {
│ │ │ │ - var corner = this._createCorner(bgColor);
│ │ │ │ - for (var i = (this.options.numSlices - 1); i >= 0; i--) {
│ │ │ │ - corner.appendChild(this._createCornerSlice(color, bgColor, i, "bottom"));
│ │ │ │ - }
│ │ │ │ - el.style.paddingBottom = 0;
│ │ │ │ - el.appendChild(corner);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _createCorner: function(bgColor) {
│ │ │ │ - var corner = document.createElement("div");
│ │ │ │ - corner.style.backgroundColor = (this._isTransparent() ? "transparent" : bgColor);
│ │ │ │ - return corner;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _createCornerSlice: function(color, bgColor, n, position) {
│ │ │ │ - var slice = document.createElement("span");
│ │ │ │ -
│ │ │ │ - var inStyle = slice.style;
│ │ │ │ - inStyle.backgroundColor = color;
│ │ │ │ - inStyle.display = "block";
│ │ │ │ - inStyle.height = "1px";
│ │ │ │ - inStyle.overflow = "hidden";
│ │ │ │ - inStyle.fontSize = "1px";
│ │ │ │ -
│ │ │ │ - var borderColor = this._borderColor(color, bgColor);
│ │ │ │ - if (this.options.border && n == 0) {
│ │ │ │ - inStyle.borderTopStyle = "solid";
│ │ │ │ - inStyle.borderTopWidth = "1px";
│ │ │ │ - inStyle.borderLeftWidth = "0px";
│ │ │ │ - inStyle.borderRightWidth = "0px";
│ │ │ │ - inStyle.borderBottomWidth = "0px";
│ │ │ │ - inStyle.height = "0px"; // assumes css compliant box model
│ │ │ │ - inStyle.borderColor = borderColor;
│ │ │ │ - } else if (borderColor) {
│ │ │ │ - inStyle.borderColor = borderColor;
│ │ │ │ - inStyle.borderStyle = "solid";
│ │ │ │ - inStyle.borderWidth = "0px 1px";
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - if (!this.options.compact && (n == (this.options.numSlices - 1))) {
│ │ │ │ - inStyle.height = "2px";
│ │ │ │ - }
│ │ │ │ - this._setMargin(slice, n, position);
│ │ │ │ - this._setBorder(slice, n, position);
│ │ │ │ - return slice;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _setOptions: function(options) {
│ │ │ │ - this.options = {
│ │ │ │ - corners: "all",
│ │ │ │ - color: "fromElement",
│ │ │ │ - bgColor: "fromParent",
│ │ │ │ - blend: true,
│ │ │ │ - border: false,
│ │ │ │ - compact: false
│ │ │ │ - };
│ │ │ │ - OpenLayers.Util.extend(this.options, options || {});
│ │ │ │ -
│ │ │ │ - this.options.numSlices = this.options.compact ? 2 : 4;
│ │ │ │ - if (this._isTransparent()) {
│ │ │ │ - this.options.blend = false;
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _whichSideTop: function() {
│ │ │ │ - if (this._hasString(this.options.corners, "all", "top")) {
│ │ │ │ - return "";
│ │ │ │ - }
│ │ │ │ - if (this.options.corners.indexOf("tl") >= 0 && this.options.corners.indexOf("tr") >= 0) {
│ │ │ │ - return "";
│ │ │ │ - }
│ │ │ │ - if (this.options.corners.indexOf("tl") >= 0) {
│ │ │ │ - return "left";
│ │ │ │ - } else if (this.options.corners.indexOf("tr") >= 0) {
│ │ │ │ - return "right";
│ │ │ │ - }
│ │ │ │ - return "";
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _whichSideBottom: function() {
│ │ │ │ - if (this._hasString(this.options.corners, "all", "bottom")) {
│ │ │ │ - return "";
│ │ │ │ - }
│ │ │ │ - if (this.options.corners.indexOf("bl") >= 0 && this.options.corners.indexOf("br") >= 0) {
│ │ │ │ - return "";
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - if (this.options.corners.indexOf("bl") >= 0) {
│ │ │ │ - return "left";
│ │ │ │ - } else if (this.options.corners.indexOf("br") >= 0) {
│ │ │ │ - return "right";
│ │ │ │ - }
│ │ │ │ - return "";
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _borderColor: function(color, bgColor) {
│ │ │ │ - if (color == "transparent") {
│ │ │ │ - return bgColor;
│ │ │ │ - } else if (this.options.border) {
│ │ │ │ - return this.options.border;
│ │ │ │ - } else if (this.options.blend) {
│ │ │ │ - return this._blend(bgColor, color);
│ │ │ │ - } else {
│ │ │ │ - return "";
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - _setMargin: function(el, n, corners) {
│ │ │ │ - var marginSize = this._marginSize(n);
│ │ │ │ - var whichSide = corners == "top" ? this._whichSideTop() : this._whichSideBottom();
│ │ │ │ -
│ │ │ │ - if (whichSide == "left") {
│ │ │ │ - el.style.marginLeft = marginSize + "px";
│ │ │ │ - el.style.marginRight = "0px";
│ │ │ │ - } else if (whichSide == "right") {
│ │ │ │ - el.style.marginRight = marginSize + "px";
│ │ │ │ - el.style.marginLeft = "0px";
│ │ │ │ - } else {
│ │ │ │ - el.style.marginLeft = marginSize + "px";
│ │ │ │ - el.style.marginRight = marginSize + "px";
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _setBorder: function(el, n, corners) {
│ │ │ │ - var borderSize = this._borderSize(n);
│ │ │ │ - var whichSide = corners == "top" ? this._whichSideTop() : this._whichSideBottom();
│ │ │ │ - if (whichSide == "left") {
│ │ │ │ - el.style.borderLeftWidth = borderSize + "px";
│ │ │ │ - el.style.borderRightWidth = "0px";
│ │ │ │ - } else if (whichSide == "right") {
│ │ │ │ - el.style.borderRightWidth = borderSize + "px";
│ │ │ │ - el.style.borderLeftWidth = "0px";
│ │ │ │ - } else {
│ │ │ │ - el.style.borderLeftWidth = borderSize + "px";
│ │ │ │ - el.style.borderRightWidth = borderSize + "px";
│ │ │ │ - }
│ │ │ │ - if (this.options.border != false) {
│ │ │ │ - el.style.borderLeftWidth = borderSize + "px";
│ │ │ │ - el.style.borderRightWidth = borderSize + "px";
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _marginSize: function(n) {
│ │ │ │ - if (this._isTransparent()) {
│ │ │ │ - return 0;
│ │ │ │ - }
│ │ │ │ - var marginSizes = [5, 3, 2, 1];
│ │ │ │ - var blendedMarginSizes = [3, 2, 1, 0];
│ │ │ │ - var compactMarginSizes = [2, 1];
│ │ │ │ - var smBlendedMarginSizes = [1, 0];
│ │ │ │ -
│ │ │ │ - if (this.options.compact && this.options.blend) {
│ │ │ │ - return smBlendedMarginSizes[n];
│ │ │ │ - } else if (this.options.compact) {
│ │ │ │ - return compactMarginSizes[n];
│ │ │ │ - } else if (this.options.blend) {
│ │ │ │ - return blendedMarginSizes[n];
│ │ │ │ - } else {
│ │ │ │ - return marginSizes[n];
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _borderSize: function(n) {
│ │ │ │ - var transparentBorderSizes = [5, 3, 2, 1];
│ │ │ │ - var blendedBorderSizes = [2, 1, 1, 1];
│ │ │ │ - var compactBorderSizes = [1, 0];
│ │ │ │ - var actualBorderSizes = [0, 2, 0, 0];
│ │ │ │ -
│ │ │ │ - if (this.options.compact && (this.options.blend || this._isTransparent())) {
│ │ │ │ - return 1;
│ │ │ │ - } else if (this.options.compact) {
│ │ │ │ - return compactBorderSizes[n];
│ │ │ │ - } else if (this.options.blend) {
│ │ │ │ - return blendedBorderSizes[n];
│ │ │ │ - } else if (this.options.border) {
│ │ │ │ - return actualBorderSizes[n];
│ │ │ │ - } else if (this._isTransparent()) {
│ │ │ │ - return transparentBorderSizes[n];
│ │ │ │ - }
│ │ │ │ - return 0;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - _hasString: function(str) {
│ │ │ │ - for (var i = 1; i < arguments.length; i++)
│ │ │ │ - if (str.indexOf(arguments[i]) >= 0) {
│ │ │ │ - return true;
│ │ │ │ - } return false;
│ │ │ │ - },
│ │ │ │ - _blend: function(c1, c2) {
│ │ │ │ - var cc1 = OpenLayers.Rico.Color.createFromHex(c1);
│ │ │ │ - cc1.blend(OpenLayers.Rico.Color.createFromHex(c2));
│ │ │ │ - return cc1;
│ │ │ │ - },
│ │ │ │ - _background: function(el) {
│ │ │ │ - try {
│ │ │ │ - return OpenLayers.Rico.Color.createColorFromBackground(el).asHex();
│ │ │ │ - } catch (err) {
│ │ │ │ - return "#ffffff";
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ - _isTransparent: function() {
│ │ │ │ - return this.options.color == "transparent";
│ │ │ │ - },
│ │ │ │ - _isTopRounded: function() {
│ │ │ │ - return this._hasString(this.options.corners, "all", "top", "tl", "tr");
│ │ │ │ - },
│ │ │ │ - _isBottomRounded: function() {
│ │ │ │ - return this._hasString(this.options.corners, "all", "bottom", "bl", "br");
│ │ │ │ - },
│ │ │ │ - _hasSingleTextChild: function(el) {
│ │ │ │ - return el.childNodes.length == 1 && el.childNodes[0].nodeType == 3;
│ │ │ │ - }
│ │ │ │ -};
│ │ │ │ -/* ======================================================================
│ │ │ │ OpenLayers/Feature.js
│ │ │ │ ====================================================================== */
│ │ │ │
│ │ │ │ /* 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. */
│ │ │ │ @@ -6279,15 +6064,15 @@
│ │ │ │ * {Array} prefixes of the sld symbolizers. These are the
│ │ │ │ * same as the main geometry types
│ │ │ │ */
│ │ │ │ OpenLayers.Style.SYMBOLIZER_PREFIXES = ['Point', 'Line', 'Polygon', 'Text',
│ │ │ │ 'Raster'
│ │ │ │ ];
│ │ │ │ /* ======================================================================
│ │ │ │ - OpenLayers/Rule.js
│ │ │ │ + OpenLayers/Filter.js
│ │ │ │ ====================================================================== */
│ │ │ │
│ │ │ │ /* 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. */
│ │ │ │
│ │ │ │ @@ -6295,236 +6080,86 @@
│ │ │ │ /**
│ │ │ │ * @requires OpenLayers/BaseTypes/Class.js
│ │ │ │ * @requires OpenLayers/Util.js
│ │ │ │ * @requires OpenLayers/Style.js
│ │ │ │ */
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Class: OpenLayers.Rule
│ │ │ │ - * This class represents an SLD Rule, as being used for rule-based SLD styling.
│ │ │ │ + * Class: OpenLayers.Filter
│ │ │ │ + * This class represents an OGC Filter.
│ │ │ │ */
│ │ │ │ -OpenLayers.Rule = OpenLayers.Class({
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: id
│ │ │ │ - * {String} A unique id for this session.
│ │ │ │ - */
│ │ │ │ - id: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: name
│ │ │ │ - * {String} name of this rule
│ │ │ │ - */
│ │ │ │ - name: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: title
│ │ │ │ - * {String} Title of this rule (set if included in SLD)
│ │ │ │ - */
│ │ │ │ - title: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: description
│ │ │ │ - * {String} Description of this rule (set if abstract is included in SLD)
│ │ │ │ - */
│ │ │ │ - description: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: context
│ │ │ │ - * {Object} An optional object with properties that the rule should be
│ │ │ │ - * evaluated against. If no context is specified, feature.attributes will
│ │ │ │ - * be used.
│ │ │ │ - */
│ │ │ │ - context: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: filter
│ │ │ │ - * {
} Optional filter for the rule.
│ │ │ │ - */
│ │ │ │ - filter: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: elseFilter
│ │ │ │ - * {Boolean} Determines whether this rule is only to be applied only if
│ │ │ │ - * no other rules match (ElseFilter according to the SLD specification).
│ │ │ │ - * Default is false. For instances of OpenLayers.Rule, if elseFilter is
│ │ │ │ - * false, the rule will always apply. For subclasses, the else property is
│ │ │ │ - * ignored.
│ │ │ │ - */
│ │ │ │ - elseFilter: false,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: symbolizer
│ │ │ │ - * {Object} Symbolizer or hash of symbolizers for this rule. If hash of
│ │ │ │ - * symbolizers, keys are one or more of ["Point", "Line", "Polygon"]. The
│ │ │ │ - * latter if useful if it is required to style e.g. vertices of a line
│ │ │ │ - * with a point symbolizer. Note, however, that this is not implemented
│ │ │ │ - * yet in OpenLayers, but it is the way how symbolizers are defined in
│ │ │ │ - * SLD.
│ │ │ │ - */
│ │ │ │ - symbolizer: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: symbolizers
│ │ │ │ - * {Array} Collection of symbolizers associated with this rule. If
│ │ │ │ - * provided at construction, the symbolizers array has precedence
│ │ │ │ - * over the deprecated symbolizer property. Note that multiple
│ │ │ │ - * symbolizers are not currently supported by the vector renderers.
│ │ │ │ - * Rules with multiple symbolizers are currently only useful for
│ │ │ │ - * maintaining elements in an SLD document.
│ │ │ │ - */
│ │ │ │ - symbolizers: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: minScaleDenominator
│ │ │ │ - * {Number} or {String} minimum scale at which to draw the feature.
│ │ │ │ - * In the case of a String, this can be a combination of text and
│ │ │ │ - * propertyNames in the form "literal ${propertyName}"
│ │ │ │ - */
│ │ │ │ - minScaleDenominator: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: maxScaleDenominator
│ │ │ │ - * {Number} or {String} maximum scale at which to draw the feature.
│ │ │ │ - * In the case of a String, this can be a combination of text and
│ │ │ │ - * propertyNames in the form "literal ${propertyName}"
│ │ │ │ - */
│ │ │ │ - maxScaleDenominator: null,
│ │ │ │ +OpenLayers.Filter = OpenLayers.Class({
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Constructor: OpenLayers.Rule
│ │ │ │ - * Creates a Rule.
│ │ │ │ + * Constructor: OpenLayers.Filter
│ │ │ │ + * This class represents a generic filter.
│ │ │ │ *
│ │ │ │ * Parameters:
│ │ │ │ - * options - {Object} An optional object with properties to set on the
│ │ │ │ - * rule
│ │ │ │ + * options - {Object} Optional object whose properties will be set on the
│ │ │ │ + * instance.
│ │ │ │ *
│ │ │ │ * Returns:
│ │ │ │ - * {}
│ │ │ │ + * {}
│ │ │ │ */
│ │ │ │ initialize: function(options) {
│ │ │ │ - this.symbolizer = {};
│ │ │ │ OpenLayers.Util.extend(this, options);
│ │ │ │ - if (this.symbolizers) {
│ │ │ │ - delete this.symbolizer;
│ │ │ │ - }
│ │ │ │ - this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
│ │ │ │ },
│ │ │ │
│ │ │ │ /**
│ │ │ │ * APIMethod: destroy
│ │ │ │ - * nullify references to prevent circular references and memory leaks
│ │ │ │ + * Remove reference to anything added.
│ │ │ │ */
│ │ │ │ - destroy: function() {
│ │ │ │ - for (var i in this.symbolizer) {
│ │ │ │ - this.symbolizer[i] = null;
│ │ │ │ - }
│ │ │ │ - this.symbolizer = null;
│ │ │ │ - delete this.symbolizers;
│ │ │ │ - },
│ │ │ │ + destroy: function() {},
│ │ │ │
│ │ │ │ /**
│ │ │ │ * APIMethod: evaluate
│ │ │ │ - * evaluates this rule for a specific feature
│ │ │ │ + * Evaluates this filter in a specific context. Instances or subclasses
│ │ │ │ + * are supposed to override this method.
│ │ │ │ *
│ │ │ │ * Parameters:
│ │ │ │ - * feature - {} feature to apply the rule to.
│ │ │ │ + * context - {Object} Context to use in evaluating the filter. If a vector
│ │ │ │ + * feature is provided, the feature.attributes will be used as context.
│ │ │ │ *
│ │ │ │ * Returns:
│ │ │ │ - * {Boolean} true if the rule applies, false if it does not.
│ │ │ │ - * This rule is the default rule and always returns true.
│ │ │ │ + * {Boolean} The filter applies.
│ │ │ │ */
│ │ │ │ - evaluate: function(feature) {
│ │ │ │ - var context = this.getContext(feature);
│ │ │ │ - var applies = true;
│ │ │ │ -
│ │ │ │ - if (this.minScaleDenominator || this.maxScaleDenominator) {
│ │ │ │ - var scale = feature.layer.map.getScale();
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - // check if within minScale/maxScale bounds
│ │ │ │ - if (this.minScaleDenominator) {
│ │ │ │ - applies = scale >= OpenLayers.Style.createLiteral(
│ │ │ │ - this.minScaleDenominator, context);
│ │ │ │ - }
│ │ │ │ - if (applies && this.maxScaleDenominator) {
│ │ │ │ - applies = scale < OpenLayers.Style.createLiteral(
│ │ │ │ - this.maxScaleDenominator, context);
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - // check if optional filter applies
│ │ │ │ - if (applies && this.filter) {
│ │ │ │ - // feature id filters get the feature, others get the context
│ │ │ │ - if (this.filter.CLASS_NAME == "OpenLayers.Filter.FeatureId") {
│ │ │ │ - applies = this.filter.evaluate(feature);
│ │ │ │ - } else {
│ │ │ │ - applies = this.filter.evaluate(context);
│ │ │ │ - }
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - return applies;
│ │ │ │ + evaluate: function(context) {
│ │ │ │ + return true;
│ │ │ │ },
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Method: getContext
│ │ │ │ - * Gets the context for evaluating this rule
│ │ │ │ + * APIMethod: clone
│ │ │ │ + * Clones this filter. Should be implemented by subclasses.
│ │ │ │ *
│ │ │ │ - * Paramters:
│ │ │ │ - * feature - {} feature to take the context from if
│ │ │ │ - * none is specified.
│ │ │ │ + * Returns:
│ │ │ │ + * {} Clone of this filter.
│ │ │ │ */
│ │ │ │ - getContext: function(feature) {
│ │ │ │ - var context = this.context;
│ │ │ │ - if (!context) {
│ │ │ │ - context = feature.attributes || feature.data;
│ │ │ │ - }
│ │ │ │ - if (typeof this.context == "function") {
│ │ │ │ - context = this.context(feature);
│ │ │ │ - }
│ │ │ │ - return context;
│ │ │ │ + clone: function() {
│ │ │ │ + return null;
│ │ │ │ },
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * APIMethod: clone
│ │ │ │ - * Clones this rule.
│ │ │ │ - *
│ │ │ │ + * APIMethod: toString
│ │ │ │ + *
│ │ │ │ * Returns:
│ │ │ │ - * {} Clone of this rule.
│ │ │ │ + * {String} Include in your build to get a CQL
│ │ │ │ + * representation of the filter returned. Otherwise "[Object object]"
│ │ │ │ + * will be returned.
│ │ │ │ */
│ │ │ │ - clone: function() {
│ │ │ │ - var options = OpenLayers.Util.extend({}, this);
│ │ │ │ - if (this.symbolizers) {
│ │ │ │ - // clone symbolizers
│ │ │ │ - var len = this.symbolizers.length;
│ │ │ │ - options.symbolizers = new Array(len);
│ │ │ │ - for (var i = 0; i < len; ++i) {
│ │ │ │ - options.symbolizers[i] = this.symbolizers[i].clone();
│ │ │ │ - }
│ │ │ │ + toString: function() {
│ │ │ │ + var string;
│ │ │ │ + if (OpenLayers.Format && OpenLayers.Format.CQL) {
│ │ │ │ + string = OpenLayers.Format.CQL.prototype.write(this);
│ │ │ │ } else {
│ │ │ │ - // clone symbolizer
│ │ │ │ - options.symbolizer = {};
│ │ │ │ - var value, type;
│ │ │ │ - for (var key in this.symbolizer) {
│ │ │ │ - value = this.symbolizer[key];
│ │ │ │ - type = typeof value;
│ │ │ │ - if (type === "object") {
│ │ │ │ - options.symbolizer[key] = OpenLayers.Util.extend({}, value);
│ │ │ │ - } else if (type === "string") {
│ │ │ │ - options.symbolizer[key] = value;
│ │ │ │ - }
│ │ │ │ - }
│ │ │ │ + string = Object.prototype.toString.call(this);
│ │ │ │ }
│ │ │ │ - // clone filter
│ │ │ │ - options.filter = this.filter && this.filter.clone();
│ │ │ │ - // clone context
│ │ │ │ - options.context = this.context && OpenLayers.Util.extend({}, this.context);
│ │ │ │ - return new OpenLayers.Rule(options);
│ │ │ │ + return string;
│ │ │ │ },
│ │ │ │
│ │ │ │ - CLASS_NAME: "OpenLayers.Rule"
│ │ │ │ + CLASS_NAME: "OpenLayers.Filter"
│ │ │ │ });
│ │ │ │ /* ======================================================================
│ │ │ │ OpenLayers/Util/vendorPrefix.js
│ │ │ │ ====================================================================== */
│ │ │ │
│ │ │ │ /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ * full list of contributors). Published under the 2-clause BSD license.
│ │ │ │ @@ -6660,485 +6295,14 @@
│ │ │ │
│ │ │ │ // used for testing
│ │ │ │ cssCache: cssCache,
│ │ │ │ jsCache: jsCache
│ │ │ │ };
│ │ │ │ }());
│ │ │ │ /* ======================================================================
│ │ │ │ - OpenLayers/Animation.js
│ │ │ │ - ====================================================================== */
│ │ │ │ -
│ │ │ │ -/* 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/SingleFile.js
│ │ │ │ - * @requires OpenLayers/Util/vendorPrefix.js
│ │ │ │ - */
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Namespace: OpenLayers.Animation
│ │ │ │ - * A collection of utility functions for executing methods that repaint a
│ │ │ │ - * portion of the browser window. These methods take advantage of the
│ │ │ │ - * browser's scheduled repaints where requestAnimationFrame is available.
│ │ │ │ - */
│ │ │ │ -OpenLayers.Animation = (function(window) {
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: isNative
│ │ │ │ - * {Boolean} true if a native requestAnimationFrame function is available
│ │ │ │ - */
│ │ │ │ - var requestAnimationFrame = OpenLayers.Util.vendorPrefix.js(window, "requestAnimationFrame");
│ │ │ │ - var isNative = !!(requestAnimationFrame);
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: requestFrame
│ │ │ │ - * Schedule a function to be called at the next available animation frame.
│ │ │ │ - * Uses the native method where available. Where requestAnimationFrame is
│ │ │ │ - * not available, setTimeout will be called with a 16ms delay.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * callback - {Function} The function to be called at the next animation frame.
│ │ │ │ - * element - {DOMElement} Optional element that visually bounds the animation.
│ │ │ │ - */
│ │ │ │ - var requestFrame = (function() {
│ │ │ │ - var request = window[requestAnimationFrame] ||
│ │ │ │ - function(callback, element) {
│ │ │ │ - window.setTimeout(callback, 16);
│ │ │ │ - };
│ │ │ │ - // bind to window to avoid illegal invocation of native function
│ │ │ │ - return function(callback, element) {
│ │ │ │ - request.apply(window, [callback, element]);
│ │ │ │ - };
│ │ │ │ - })();
│ │ │ │ -
│ │ │ │ - // private variables for animation loops
│ │ │ │ - var counter = 0;
│ │ │ │ - var loops = {};
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: start
│ │ │ │ - * Executes a method with in series for some
│ │ │ │ - * duration.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * callback - {Function} The function to be called at the next animation frame.
│ │ │ │ - * duration - {Number} Optional duration for the loop. If not provided, the
│ │ │ │ - * animation loop will execute indefinitely.
│ │ │ │ - * element - {DOMElement} Optional element that visually bounds the animation.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Number} Identifier for the animation loop. Used to stop animations with
│ │ │ │ - * .
│ │ │ │ - */
│ │ │ │ - function start(callback, duration, element) {
│ │ │ │ - duration = duration > 0 ? duration : Number.POSITIVE_INFINITY;
│ │ │ │ - var id = ++counter;
│ │ │ │ - var start = +new Date;
│ │ │ │ - loops[id] = function() {
│ │ │ │ - if (loops[id] && +new Date - start <= duration) {
│ │ │ │ - callback();
│ │ │ │ - if (loops[id]) {
│ │ │ │ - requestFrame(loops[id], element);
│ │ │ │ - }
│ │ │ │ - } else {
│ │ │ │ - delete loops[id];
│ │ │ │ - }
│ │ │ │ - };
│ │ │ │ - requestFrame(loops[id], element);
│ │ │ │ - return id;
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: stop
│ │ │ │ - * Terminates an animation loop started with .
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * id - {Number} Identifier returned from .
│ │ │ │ - */
│ │ │ │ - function stop(id) {
│ │ │ │ - delete loops[id];
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - return {
│ │ │ │ - isNative: isNative,
│ │ │ │ - requestFrame: requestFrame,
│ │ │ │ - start: start,
│ │ │ │ - stop: stop
│ │ │ │ - };
│ │ │ │ -
│ │ │ │ -})(window);
│ │ │ │ -/* ======================================================================
│ │ │ │ - OpenLayers/Tween.js
│ │ │ │ - ====================================================================== */
│ │ │ │ -
│ │ │ │ -/* 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
│ │ │ │ - * @requires OpenLayers/Animation.js
│ │ │ │ - */
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Namespace: OpenLayers.Tween
│ │ │ │ - */
│ │ │ │ -OpenLayers.Tween = OpenLayers.Class({
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: easing
│ │ │ │ - * {(Function)} Easing equation used for the animation
│ │ │ │ - * Defaultly set to OpenLayers.Easing.Expo.easeOut
│ │ │ │ - */
│ │ │ │ - easing: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: begin
│ │ │ │ - * {Object} Values to start the animation with
│ │ │ │ - */
│ │ │ │ - begin: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: finish
│ │ │ │ - * {Object} Values to finish the animation with
│ │ │ │ - */
│ │ │ │ - finish: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: duration
│ │ │ │ - * {int} duration of the tween (number of steps)
│ │ │ │ - */
│ │ │ │ - duration: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: callbacks
│ │ │ │ - * {Object} An object with start, eachStep and done properties whose values
│ │ │ │ - * are functions to be call during the animation. They are passed the
│ │ │ │ - * current computed value as argument.
│ │ │ │ - */
│ │ │ │ - callbacks: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: time
│ │ │ │ - * {int} Step counter
│ │ │ │ - */
│ │ │ │ - time: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: minFrameRate
│ │ │ │ - * {Number} The minimum framerate for animations in frames per second. After
│ │ │ │ - * each step, the time spent in the animation is compared to the calculated
│ │ │ │ - * time at this frame rate. If the animation runs longer than the calculated
│ │ │ │ - * time, the next step is skipped. Default is 30.
│ │ │ │ - */
│ │ │ │ - minFrameRate: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: startTime
│ │ │ │ - * {Number} The timestamp of the first execution step. Used for skipping
│ │ │ │ - * frames
│ │ │ │ - */
│ │ │ │ - startTime: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: animationId
│ │ │ │ - * {int} Loop id returned by OpenLayers.Animation.start
│ │ │ │ - */
│ │ │ │ - animationId: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: playing
│ │ │ │ - * {Boolean} Tells if the easing is currently playing
│ │ │ │ - */
│ │ │ │ - playing: false,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Constructor: OpenLayers.Tween
│ │ │ │ - * Creates a Tween.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * easing - {(Function)} easing function method to use
│ │ │ │ - */
│ │ │ │ - initialize: function(easing) {
│ │ │ │ - this.easing = (easing) ? easing : OpenLayers.Easing.Expo.easeOut;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: start
│ │ │ │ - * Plays the Tween, and calls the callback method on each step
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * begin - {Object} values to start the animation with
│ │ │ │ - * finish - {Object} values to finish the animation with
│ │ │ │ - * duration - {int} duration of the tween (number of steps)
│ │ │ │ - * options - {Object} hash of options (callbacks (start, eachStep, done),
│ │ │ │ - * minFrameRate)
│ │ │ │ - */
│ │ │ │ - start: function(begin, finish, duration, options) {
│ │ │ │ - this.playing = true;
│ │ │ │ - this.begin = begin;
│ │ │ │ - this.finish = finish;
│ │ │ │ - this.duration = duration;
│ │ │ │ - this.callbacks = options.callbacks;
│ │ │ │ - this.minFrameRate = options.minFrameRate || 30;
│ │ │ │ - this.time = 0;
│ │ │ │ - this.startTime = new Date().getTime();
│ │ │ │ - OpenLayers.Animation.stop(this.animationId);
│ │ │ │ - this.animationId = null;
│ │ │ │ - if (this.callbacks && this.callbacks.start) {
│ │ │ │ - this.callbacks.start.call(this, this.begin);
│ │ │ │ - }
│ │ │ │ - this.animationId = OpenLayers.Animation.start(
│ │ │ │ - OpenLayers.Function.bind(this.play, this)
│ │ │ │ - );
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: stop
│ │ │ │ - * Stops the Tween, and calls the done callback
│ │ │ │ - * Doesn't do anything if animation is already finished
│ │ │ │ - */
│ │ │ │ - stop: function() {
│ │ │ │ - if (!this.playing) {
│ │ │ │ - return;
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - if (this.callbacks && this.callbacks.done) {
│ │ │ │ - this.callbacks.done.call(this, this.finish);
│ │ │ │ - }
│ │ │ │ - OpenLayers.Animation.stop(this.animationId);
│ │ │ │ - this.animationId = null;
│ │ │ │ - this.playing = false;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: play
│ │ │ │ - * Calls the appropriate easing method
│ │ │ │ - */
│ │ │ │ - play: function() {
│ │ │ │ - var value = {};
│ │ │ │ - for (var i in this.begin) {
│ │ │ │ - var b = this.begin[i];
│ │ │ │ - var f = this.finish[i];
│ │ │ │ - if (b == null || f == null || isNaN(b) || isNaN(f)) {
│ │ │ │ - throw new TypeError('invalid value for Tween');
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - var c = f - b;
│ │ │ │ - value[i] = this.easing.apply(this, [this.time, b, c, this.duration]);
│ │ │ │ - }
│ │ │ │ - this.time++;
│ │ │ │ -
│ │ │ │ - if (this.callbacks && this.callbacks.eachStep) {
│ │ │ │ - // skip frames if frame rate drops below threshold
│ │ │ │ - if ((new Date().getTime() - this.startTime) / this.time <= 1000 / this.minFrameRate) {
│ │ │ │ - this.callbacks.eachStep.call(this, value);
│ │ │ │ - }
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - if (this.time > this.duration) {
│ │ │ │ - this.stop();
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Create empty functions for all easing methods.
│ │ │ │ - */
│ │ │ │ - CLASS_NAME: "OpenLayers.Tween"
│ │ │ │ -});
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Namespace: OpenLayers.Easing
│ │ │ │ - *
│ │ │ │ - * Credits:
│ │ │ │ - * Easing Equations by Robert Penner,
│ │ │ │ - */
│ │ │ │ -OpenLayers.Easing = {
│ │ │ │ - /**
│ │ │ │ - * Create empty functions for all easing methods.
│ │ │ │ - */
│ │ │ │ - CLASS_NAME: "OpenLayers.Easing"
│ │ │ │ -};
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Namespace: OpenLayers.Easing.Linear
│ │ │ │ - */
│ │ │ │ -OpenLayers.Easing.Linear = {
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: easeIn
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * t - {Float} time
│ │ │ │ - * b - {Float} beginning position
│ │ │ │ - * c - {Float} total change
│ │ │ │ - * d - {Float} duration of the transition
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float}
│ │ │ │ - */
│ │ │ │ - easeIn: function(t, b, c, d) {
│ │ │ │ - return c * t / d + b;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: easeOut
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * t - {Float} time
│ │ │ │ - * b - {Float} beginning position
│ │ │ │ - * c - {Float} total change
│ │ │ │ - * d - {Float} duration of the transition
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float}
│ │ │ │ - */
│ │ │ │ - easeOut: function(t, b, c, d) {
│ │ │ │ - return c * t / d + b;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: easeInOut
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * t - {Float} time
│ │ │ │ - * b - {Float} beginning position
│ │ │ │ - * c - {Float} total change
│ │ │ │ - * d - {Float} duration of the transition
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float}
│ │ │ │ - */
│ │ │ │ - easeInOut: function(t, b, c, d) {
│ │ │ │ - return c * t / d + b;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - CLASS_NAME: "OpenLayers.Easing.Linear"
│ │ │ │ -};
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Namespace: OpenLayers.Easing.Expo
│ │ │ │ - */
│ │ │ │ -OpenLayers.Easing.Expo = {
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: easeIn
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * t - {Float} time
│ │ │ │ - * b - {Float} beginning position
│ │ │ │ - * c - {Float} total change
│ │ │ │ - * d - {Float} duration of the transition
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float}
│ │ │ │ - */
│ │ │ │ - easeIn: function(t, b, c, d) {
│ │ │ │ - return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: easeOut
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * t - {Float} time
│ │ │ │ - * b - {Float} beginning position
│ │ │ │ - * c - {Float} total change
│ │ │ │ - * d - {Float} duration of the transition
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float}
│ │ │ │ - */
│ │ │ │ - easeOut: function(t, b, c, d) {
│ │ │ │ - return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: easeInOut
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * t - {Float} time
│ │ │ │ - * b - {Float} beginning position
│ │ │ │ - * c - {Float} total change
│ │ │ │ - * d - {Float} duration of the transition
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float}
│ │ │ │ - */
│ │ │ │ - easeInOut: function(t, b, c, d) {
│ │ │ │ - if (t == 0) return b;
│ │ │ │ - if (t == d) return b + c;
│ │ │ │ - if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
│ │ │ │ - return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - CLASS_NAME: "OpenLayers.Easing.Expo"
│ │ │ │ -};
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Namespace: OpenLayers.Easing.Quad
│ │ │ │ - */
│ │ │ │ -OpenLayers.Easing.Quad = {
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: easeIn
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * t - {Float} time
│ │ │ │ - * b - {Float} beginning position
│ │ │ │ - * c - {Float} total change
│ │ │ │ - * d - {Float} duration of the transition
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float}
│ │ │ │ - */
│ │ │ │ - easeIn: function(t, b, c, d) {
│ │ │ │ - return c * (t /= d) * t + b;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: easeOut
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * t - {Float} time
│ │ │ │ - * b - {Float} beginning position
│ │ │ │ - * c - {Float} total change
│ │ │ │ - * d - {Float} duration of the transition
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float}
│ │ │ │ - */
│ │ │ │ - easeOut: function(t, b, c, d) {
│ │ │ │ - return -c * (t /= d) * (t - 2) + b;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Function: easeInOut
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * t - {Float} time
│ │ │ │ - * b - {Float} beginning position
│ │ │ │ - * c - {Float} total change
│ │ │ │ - * d - {Float} duration of the transition
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float}
│ │ │ │ - */
│ │ │ │ - easeInOut: function(t, b, c, d) {
│ │ │ │ - if ((t /= d / 2) < 1) return c / 2 * t * t + b;
│ │ │ │ - return -c / 2 * ((--t) * (t - 2) - 1) + b;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - CLASS_NAME: "OpenLayers.Easing.Quad"
│ │ │ │ -};
│ │ │ │ -/* ======================================================================
│ │ │ │ OpenLayers/Events.js
│ │ │ │ ====================================================================== */
│ │ │ │
│ │ │ │ /* 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. */
│ │ │ │ @@ -8307,14 +7471,485 @@
│ │ │ │
│ │ │ │ OpenLayers.Event.observe(element, 'MSPointerUp', cb);
│ │ │ │ },
│ │ │ │
│ │ │ │ CLASS_NAME: "OpenLayers.Events"
│ │ │ │ });
│ │ │ │ /* ======================================================================
│ │ │ │ + OpenLayers/Animation.js
│ │ │ │ + ====================================================================== */
│ │ │ │ +
│ │ │ │ +/* 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/SingleFile.js
│ │ │ │ + * @requires OpenLayers/Util/vendorPrefix.js
│ │ │ │ + */
│ │ │ │ +
│ │ │ │ +/**
│ │ │ │ + * Namespace: OpenLayers.Animation
│ │ │ │ + * A collection of utility functions for executing methods that repaint a
│ │ │ │ + * portion of the browser window. These methods take advantage of the
│ │ │ │ + * browser's scheduled repaints where requestAnimationFrame is available.
│ │ │ │ + */
│ │ │ │ +OpenLayers.Animation = (function(window) {
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Property: isNative
│ │ │ │ + * {Boolean} true if a native requestAnimationFrame function is available
│ │ │ │ + */
│ │ │ │ + var requestAnimationFrame = OpenLayers.Util.vendorPrefix.js(window, "requestAnimationFrame");
│ │ │ │ + var isNative = !!(requestAnimationFrame);
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: requestFrame
│ │ │ │ + * Schedule a function to be called at the next available animation frame.
│ │ │ │ + * Uses the native method where available. Where requestAnimationFrame is
│ │ │ │ + * not available, setTimeout will be called with a 16ms delay.
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * callback - {Function} The function to be called at the next animation frame.
│ │ │ │ + * element - {DOMElement} Optional element that visually bounds the animation.
│ │ │ │ + */
│ │ │ │ + var requestFrame = (function() {
│ │ │ │ + var request = window[requestAnimationFrame] ||
│ │ │ │ + function(callback, element) {
│ │ │ │ + window.setTimeout(callback, 16);
│ │ │ │ + };
│ │ │ │ + // bind to window to avoid illegal invocation of native function
│ │ │ │ + return function(callback, element) {
│ │ │ │ + request.apply(window, [callback, element]);
│ │ │ │ + };
│ │ │ │ + })();
│ │ │ │ +
│ │ │ │ + // private variables for animation loops
│ │ │ │ + var counter = 0;
│ │ │ │ + var loops = {};
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: start
│ │ │ │ + * Executes a method with in series for some
│ │ │ │ + * duration.
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * callback - {Function} The function to be called at the next animation frame.
│ │ │ │ + * duration - {Number} Optional duration for the loop. If not provided, the
│ │ │ │ + * animation loop will execute indefinitely.
│ │ │ │ + * element - {DOMElement} Optional element that visually bounds the animation.
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Number} Identifier for the animation loop. Used to stop animations with
│ │ │ │ + * .
│ │ │ │ + */
│ │ │ │ + function start(callback, duration, element) {
│ │ │ │ + duration = duration > 0 ? duration : Number.POSITIVE_INFINITY;
│ │ │ │ + var id = ++counter;
│ │ │ │ + var start = +new Date;
│ │ │ │ + loops[id] = function() {
│ │ │ │ + if (loops[id] && +new Date - start <= duration) {
│ │ │ │ + callback();
│ │ │ │ + if (loops[id]) {
│ │ │ │ + requestFrame(loops[id], element);
│ │ │ │ + }
│ │ │ │ + } else {
│ │ │ │ + delete loops[id];
│ │ │ │ + }
│ │ │ │ + };
│ │ │ │ + requestFrame(loops[id], element);
│ │ │ │ + return id;
│ │ │ │ + }
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: stop
│ │ │ │ + * Terminates an animation loop started with .
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * id - {Number} Identifier returned from .
│ │ │ │ + */
│ │ │ │ + function stop(id) {
│ │ │ │ + delete loops[id];
│ │ │ │ + }
│ │ │ │ +
│ │ │ │ + return {
│ │ │ │ + isNative: isNative,
│ │ │ │ + requestFrame: requestFrame,
│ │ │ │ + start: start,
│ │ │ │ + stop: stop
│ │ │ │ + };
│ │ │ │ +
│ │ │ │ +})(window);
│ │ │ │ +/* ======================================================================
│ │ │ │ + OpenLayers/Tween.js
│ │ │ │ + ====================================================================== */
│ │ │ │ +
│ │ │ │ +/* 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
│ │ │ │ + * @requires OpenLayers/Animation.js
│ │ │ │ + */
│ │ │ │ +
│ │ │ │ +/**
│ │ │ │ + * Namespace: OpenLayers.Tween
│ │ │ │ + */
│ │ │ │ +OpenLayers.Tween = OpenLayers.Class({
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * APIProperty: easing
│ │ │ │ + * {(Function)} Easing equation used for the animation
│ │ │ │ + * Defaultly set to OpenLayers.Easing.Expo.easeOut
│ │ │ │ + */
│ │ │ │ + easing: null,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * APIProperty: begin
│ │ │ │ + * {Object} Values to start the animation with
│ │ │ │ + */
│ │ │ │ + begin: null,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * APIProperty: finish
│ │ │ │ + * {Object} Values to finish the animation with
│ │ │ │ + */
│ │ │ │ + finish: null,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * APIProperty: duration
│ │ │ │ + * {int} duration of the tween (number of steps)
│ │ │ │ + */
│ │ │ │ + duration: null,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * APIProperty: callbacks
│ │ │ │ + * {Object} An object with start, eachStep and done properties whose values
│ │ │ │ + * are functions to be call during the animation. They are passed the
│ │ │ │ + * current computed value as argument.
│ │ │ │ + */
│ │ │ │ + callbacks: null,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Property: time
│ │ │ │ + * {int} Step counter
│ │ │ │ + */
│ │ │ │ + time: null,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * APIProperty: minFrameRate
│ │ │ │ + * {Number} The minimum framerate for animations in frames per second. After
│ │ │ │ + * each step, the time spent in the animation is compared to the calculated
│ │ │ │ + * time at this frame rate. If the animation runs longer than the calculated
│ │ │ │ + * time, the next step is skipped. Default is 30.
│ │ │ │ + */
│ │ │ │ + minFrameRate: null,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Property: startTime
│ │ │ │ + * {Number} The timestamp of the first execution step. Used for skipping
│ │ │ │ + * frames
│ │ │ │ + */
│ │ │ │ + startTime: null,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Property: animationId
│ │ │ │ + * {int} Loop id returned by OpenLayers.Animation.start
│ │ │ │ + */
│ │ │ │ + animationId: null,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Property: playing
│ │ │ │ + * {Boolean} Tells if the easing is currently playing
│ │ │ │ + */
│ │ │ │ + playing: false,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Constructor: OpenLayers.Tween
│ │ │ │ + * Creates a Tween.
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * easing - {(Function)} easing function method to use
│ │ │ │ + */
│ │ │ │ + initialize: function(easing) {
│ │ │ │ + this.easing = (easing) ? easing : OpenLayers.Easing.Expo.easeOut;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * APIMethod: start
│ │ │ │ + * Plays the Tween, and calls the callback method on each step
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * begin - {Object} values to start the animation with
│ │ │ │ + * finish - {Object} values to finish the animation with
│ │ │ │ + * duration - {int} duration of the tween (number of steps)
│ │ │ │ + * options - {Object} hash of options (callbacks (start, eachStep, done),
│ │ │ │ + * minFrameRate)
│ │ │ │ + */
│ │ │ │ + start: function(begin, finish, duration, options) {
│ │ │ │ + this.playing = true;
│ │ │ │ + this.begin = begin;
│ │ │ │ + this.finish = finish;
│ │ │ │ + this.duration = duration;
│ │ │ │ + this.callbacks = options.callbacks;
│ │ │ │ + this.minFrameRate = options.minFrameRate || 30;
│ │ │ │ + this.time = 0;
│ │ │ │ + this.startTime = new Date().getTime();
│ │ │ │ + OpenLayers.Animation.stop(this.animationId);
│ │ │ │ + this.animationId = null;
│ │ │ │ + if (this.callbacks && this.callbacks.start) {
│ │ │ │ + this.callbacks.start.call(this, this.begin);
│ │ │ │ + }
│ │ │ │ + this.animationId = OpenLayers.Animation.start(
│ │ │ │ + OpenLayers.Function.bind(this.play, this)
│ │ │ │ + );
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * APIMethod: stop
│ │ │ │ + * Stops the Tween, and calls the done callback
│ │ │ │ + * Doesn't do anything if animation is already finished
│ │ │ │ + */
│ │ │ │ + stop: function() {
│ │ │ │ + if (!this.playing) {
│ │ │ │ + return;
│ │ │ │ + }
│ │ │ │ +
│ │ │ │ + if (this.callbacks && this.callbacks.done) {
│ │ │ │ + this.callbacks.done.call(this, this.finish);
│ │ │ │ + }
│ │ │ │ + OpenLayers.Animation.stop(this.animationId);
│ │ │ │ + this.animationId = null;
│ │ │ │ + this.playing = false;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Method: play
│ │ │ │ + * Calls the appropriate easing method
│ │ │ │ + */
│ │ │ │ + play: function() {
│ │ │ │ + var value = {};
│ │ │ │ + for (var i in this.begin) {
│ │ │ │ + var b = this.begin[i];
│ │ │ │ + var f = this.finish[i];
│ │ │ │ + if (b == null || f == null || isNaN(b) || isNaN(f)) {
│ │ │ │ + throw new TypeError('invalid value for Tween');
│ │ │ │ + }
│ │ │ │ +
│ │ │ │ + var c = f - b;
│ │ │ │ + value[i] = this.easing.apply(this, [this.time, b, c, this.duration]);
│ │ │ │ + }
│ │ │ │ + this.time++;
│ │ │ │ +
│ │ │ │ + if (this.callbacks && this.callbacks.eachStep) {
│ │ │ │ + // skip frames if frame rate drops below threshold
│ │ │ │ + if ((new Date().getTime() - this.startTime) / this.time <= 1000 / this.minFrameRate) {
│ │ │ │ + this.callbacks.eachStep.call(this, value);
│ │ │ │ + }
│ │ │ │ + }
│ │ │ │ +
│ │ │ │ + if (this.time > this.duration) {
│ │ │ │ + this.stop();
│ │ │ │ + }
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Create empty functions for all easing methods.
│ │ │ │ + */
│ │ │ │ + CLASS_NAME: "OpenLayers.Tween"
│ │ │ │ +});
│ │ │ │ +
│ │ │ │ +/**
│ │ │ │ + * Namespace: OpenLayers.Easing
│ │ │ │ + *
│ │ │ │ + * Credits:
│ │ │ │ + * Easing Equations by Robert Penner,
│ │ │ │ + */
│ │ │ │ +OpenLayers.Easing = {
│ │ │ │ + /**
│ │ │ │ + * Create empty functions for all easing methods.
│ │ │ │ + */
│ │ │ │ + CLASS_NAME: "OpenLayers.Easing"
│ │ │ │ +};
│ │ │ │ +
│ │ │ │ +/**
│ │ │ │ + * Namespace: OpenLayers.Easing.Linear
│ │ │ │ + */
│ │ │ │ +OpenLayers.Easing.Linear = {
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: easeIn
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * t - {Float} time
│ │ │ │ + * b - {Float} beginning position
│ │ │ │ + * c - {Float} total change
│ │ │ │ + * d - {Float} duration of the transition
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Float}
│ │ │ │ + */
│ │ │ │ + easeIn: function(t, b, c, d) {
│ │ │ │ + return c * t / d + b;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: easeOut
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * t - {Float} time
│ │ │ │ + * b - {Float} beginning position
│ │ │ │ + * c - {Float} total change
│ │ │ │ + * d - {Float} duration of the transition
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Float}
│ │ │ │ + */
│ │ │ │ + easeOut: function(t, b, c, d) {
│ │ │ │ + return c * t / d + b;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: easeInOut
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * t - {Float} time
│ │ │ │ + * b - {Float} beginning position
│ │ │ │ + * c - {Float} total change
│ │ │ │ + * d - {Float} duration of the transition
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Float}
│ │ │ │ + */
│ │ │ │ + easeInOut: function(t, b, c, d) {
│ │ │ │ + return c * t / d + b;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + CLASS_NAME: "OpenLayers.Easing.Linear"
│ │ │ │ +};
│ │ │ │ +
│ │ │ │ +/**
│ │ │ │ + * Namespace: OpenLayers.Easing.Expo
│ │ │ │ + */
│ │ │ │ +OpenLayers.Easing.Expo = {
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: easeIn
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * t - {Float} time
│ │ │ │ + * b - {Float} beginning position
│ │ │ │ + * c - {Float} total change
│ │ │ │ + * d - {Float} duration of the transition
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Float}
│ │ │ │ + */
│ │ │ │ + easeIn: function(t, b, c, d) {
│ │ │ │ + return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: easeOut
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * t - {Float} time
│ │ │ │ + * b - {Float} beginning position
│ │ │ │ + * c - {Float} total change
│ │ │ │ + * d - {Float} duration of the transition
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Float}
│ │ │ │ + */
│ │ │ │ + easeOut: function(t, b, c, d) {
│ │ │ │ + return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: easeInOut
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * t - {Float} time
│ │ │ │ + * b - {Float} beginning position
│ │ │ │ + * c - {Float} total change
│ │ │ │ + * d - {Float} duration of the transition
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Float}
│ │ │ │ + */
│ │ │ │ + easeInOut: function(t, b, c, d) {
│ │ │ │ + if (t == 0) return b;
│ │ │ │ + if (t == d) return b + c;
│ │ │ │ + if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
│ │ │ │ + return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + CLASS_NAME: "OpenLayers.Easing.Expo"
│ │ │ │ +};
│ │ │ │ +
│ │ │ │ +/**
│ │ │ │ + * Namespace: OpenLayers.Easing.Quad
│ │ │ │ + */
│ │ │ │ +OpenLayers.Easing.Quad = {
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: easeIn
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * t - {Float} time
│ │ │ │ + * b - {Float} beginning position
│ │ │ │ + * c - {Float} total change
│ │ │ │ + * d - {Float} duration of the transition
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Float}
│ │ │ │ + */
│ │ │ │ + easeIn: function(t, b, c, d) {
│ │ │ │ + return c * (t /= d) * t + b;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: easeOut
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * t - {Float} time
│ │ │ │ + * b - {Float} beginning position
│ │ │ │ + * c - {Float} total change
│ │ │ │ + * d - {Float} duration of the transition
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Float}
│ │ │ │ + */
│ │ │ │ + easeOut: function(t, b, c, d) {
│ │ │ │ + return -c * (t /= d) * (t - 2) + b;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Function: easeInOut
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * t - {Float} time
│ │ │ │ + * b - {Float} beginning position
│ │ │ │ + * c - {Float} total change
│ │ │ │ + * d - {Float} duration of the transition
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Float}
│ │ │ │ + */
│ │ │ │ + easeInOut: function(t, b, c, d) {
│ │ │ │ + if ((t /= d / 2) < 1) return c / 2 * t * t + b;
│ │ │ │ + return -c / 2 * ((--t) * (t - 2) - 1) + b;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + CLASS_NAME: "OpenLayers.Easing.Quad"
│ │ │ │ +};
│ │ │ │ +/* ======================================================================
│ │ │ │ OpenLayers/Projection.js
│ │ │ │ ====================================================================== */
│ │ │ │
│ │ │ │ /* 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. */
│ │ │ │ @@ -15820,465 +15455,514 @@
│ │ │ │ this.tileCache = null;
│ │ │ │ this.tileCacheIndex = null;
│ │ │ │ this._destroyed = true;
│ │ │ │ }
│ │ │ │
│ │ │ │ });
│ │ │ │ /* ======================================================================
│ │ │ │ - OpenLayers/Strategy.js
│ │ │ │ + OpenLayers/Icon.js
│ │ │ │ ====================================================================== */
│ │ │ │
│ │ │ │ /* 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.
│ │ │ │ + * Class: OpenLayers.Icon
│ │ │ │ + *
│ │ │ │ + * The icon represents a graphical icon on the screen. Typically used in
│ │ │ │ + * conjunction with a to represent markers on a screen.
│ │ │ │ + *
│ │ │ │ + * An icon has a url, size and position. It also contains an offset which
│ │ │ │ + * allows the center point to be represented correctly. This can be
│ │ │ │ + * provided either as a fixed offset or a function provided to calculate
│ │ │ │ + * the desired offset.
│ │ │ │ + *
│ │ │ │ */
│ │ │ │ -OpenLayers.Strategy = OpenLayers.Class({
│ │ │ │ +OpenLayers.Icon = OpenLayers.Class({
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Property: layer
│ │ │ │ - * {} The layer this strategy belongs to.
│ │ │ │ + /**
│ │ │ │ + * Property: url
│ │ │ │ + * {String} image url
│ │ │ │ */
│ │ │ │ - layer: null,
│ │ │ │ + url: null,
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Property: options
│ │ │ │ - * {Object} Any options sent to the constructor.
│ │ │ │ + /**
│ │ │ │ + * Property: size
│ │ │ │ + * {|Object} An OpenLayers.Size or
│ │ │ │ + * an object with a 'w' and 'h' properties.
│ │ │ │ */
│ │ │ │ - options: null,
│ │ │ │ + size: null,
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Property: active
│ │ │ │ - * {Boolean} The control is active.
│ │ │ │ + * Property: offset
│ │ │ │ + * {|Object} distance in pixels to offset the
│ │ │ │ + * image when being rendered. An OpenLayers.Pixel or an object
│ │ │ │ + * with a 'x' and 'y' properties.
│ │ │ │ */
│ │ │ │ - active: null,
│ │ │ │ + offset: 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.
│ │ │ │ + /**
│ │ │ │ + * Property: calculateOffset
│ │ │ │ + * {Function} Function to calculate the offset (based on the size)
│ │ │ │ */
│ │ │ │ - autoActivate: true,
│ │ │ │ + calculateOffset: null,
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Property: autoDestroy
│ │ │ │ - * {Boolean} The creator of the strategy can set autoDestroy to false
│ │ │ │ - * to fully control when the strategy is destroyed. Defaults to
│ │ │ │ - * true.
│ │ │ │ + /**
│ │ │ │ + * Property: imageDiv
│ │ │ │ + * {DOMElement}
│ │ │ │ */
│ │ │ │ - autoDestroy: true,
│ │ │ │ + imageDiv: null,
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Constructor: OpenLayers.Strategy
│ │ │ │ - * Abstract class for vector strategies. Create instances of a subclass.
│ │ │ │ + /**
│ │ │ │ + * Property: px
│ │ │ │ + * {|Object} An OpenLayers.Pixel or an object
│ │ │ │ + * with a 'x' and 'y' properties.
│ │ │ │ + */
│ │ │ │ + px: null,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Constructor: OpenLayers.Icon
│ │ │ │ + * Creates an icon, which is an image tag in a div.
│ │ │ │ *
│ │ │ │ - * Parameters:
│ │ │ │ - * options - {Object} Optional object whose properties will be set on the
│ │ │ │ - * instance.
│ │ │ │ + * url - {String}
│ │ │ │ + * size - {|Object} An OpenLayers.Size or an
│ │ │ │ + * object with a 'w' and 'h'
│ │ │ │ + * properties.
│ │ │ │ + * offset - {|Object} An OpenLayers.Pixel or an
│ │ │ │ + * object with a 'x' and 'y'
│ │ │ │ + * properties.
│ │ │ │ + * calculateOffset - {Function}
│ │ │ │ */
│ │ │ │ - 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;
│ │ │ │ + initialize: function(url, size, offset, calculateOffset) {
│ │ │ │ + this.url = url;
│ │ │ │ + this.size = size || {
│ │ │ │ + w: 20,
│ │ │ │ + h: 20
│ │ │ │ + };
│ │ │ │ + this.offset = offset || {
│ │ │ │ + x: -(this.size.w / 2),
│ │ │ │ + y: -(this.size.h / 2)
│ │ │ │ + };
│ │ │ │ + this.calculateOffset = calculateOffset;
│ │ │ │ +
│ │ │ │ + var id = OpenLayers.Util.createUniqueID("OL_Icon_");
│ │ │ │ + this.imageDiv = OpenLayers.Util.createAlphaImageDiv(id);
│ │ │ │ },
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * APIMethod: destroy
│ │ │ │ - * Clean up the strategy.
│ │ │ │ + /**
│ │ │ │ + * Method: destroy
│ │ │ │ + * Nullify references and remove event listeners to prevent circular
│ │ │ │ + * references and memory leaks
│ │ │ │ */
│ │ │ │ destroy: function() {
│ │ │ │ - this.deactivate();
│ │ │ │ - this.layer = null;
│ │ │ │ - this.options = null;
│ │ │ │ + // erase any drawn elements
│ │ │ │ + this.erase();
│ │ │ │ +
│ │ │ │ + OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);
│ │ │ │ + this.imageDiv.innerHTML = "";
│ │ │ │ + this.imageDiv = null;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Method: clone
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {} A fresh copy of the icon.
│ │ │ │ + */
│ │ │ │ + clone: function() {
│ │ │ │ + return new OpenLayers.Icon(this.url,
│ │ │ │ + this.size,
│ │ │ │ + this.offset,
│ │ │ │ + this.calculateOffset);
│ │ │ │ },
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Method: setLayer
│ │ │ │ - * Called to set the property.
│ │ │ │ - *
│ │ │ │ + * Method: setSize
│ │ │ │ + *
│ │ │ │ * Parameters:
│ │ │ │ - * layer - {}
│ │ │ │ + * size - {|Object} An OpenLayers.Size or
│ │ │ │ + * an object with a 'w' and 'h' properties.
│ │ │ │ */
│ │ │ │ - setLayer: function(layer) {
│ │ │ │ - this.layer = layer;
│ │ │ │ + setSize: function(size) {
│ │ │ │ + if (size != null) {
│ │ │ │ + this.size = size;
│ │ │ │ + }
│ │ │ │ + this.draw();
│ │ │ │ },
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Method: activate
│ │ │ │ - * Activate the strategy. Register any listeners, do appropriate setup.
│ │ │ │ - *
│ │ │ │ + * Method: setUrl
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * url - {String}
│ │ │ │ + */
│ │ │ │ + setUrl: function(url) {
│ │ │ │ + if (url != null) {
│ │ │ │ + this.url = url;
│ │ │ │ + }
│ │ │ │ + this.draw();
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Method: draw
│ │ │ │ + * Move the div to the given pixel.
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * px - {|Object} An OpenLayers.Pixel or an
│ │ │ │ + * object with a 'x' and 'y' properties.
│ │ │ │ + *
│ │ │ │ * Returns:
│ │ │ │ - * {Boolean} True if the strategy was successfully activated or false if
│ │ │ │ - * the strategy was already active.
│ │ │ │ + * {DOMElement} A new DOM Image of this icon set at the location passed-in
│ │ │ │ */
│ │ │ │ - activate: function() {
│ │ │ │ - if (!this.active) {
│ │ │ │ - this.active = true;
│ │ │ │ - return true;
│ │ │ │ + draw: function(px) {
│ │ │ │ + OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,
│ │ │ │ + null,
│ │ │ │ + null,
│ │ │ │ + this.size,
│ │ │ │ + this.url,
│ │ │ │ + "absolute");
│ │ │ │ + this.moveTo(px);
│ │ │ │ + return this.imageDiv;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Method: erase
│ │ │ │ + * Erase the underlying image element.
│ │ │ │ + */
│ │ │ │ + erase: function() {
│ │ │ │ + if (this.imageDiv != null && this.imageDiv.parentNode != null) {
│ │ │ │ + OpenLayers.Element.remove(this.imageDiv);
│ │ │ │ }
│ │ │ │ - return false;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Method: setOpacity
│ │ │ │ + * Change the icon's opacity
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * opacity - {float}
│ │ │ │ + */
│ │ │ │ + setOpacity: function(opacity) {
│ │ │ │ + OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, null, null,
│ │ │ │ + null, null, null, null, opacity);
│ │ │ │ +
│ │ │ │ },
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Method: deactivate
│ │ │ │ - * Deactivate the strategy. Unregister any listeners, do appropriate
│ │ │ │ - * tear-down.
│ │ │ │ + * Method: moveTo
│ │ │ │ + * move icon to passed in px.
│ │ │ │ *
│ │ │ │ - * Returns:
│ │ │ │ - * {Boolean} True if the strategy was successfully deactivated or false if
│ │ │ │ - * the strategy was already inactive.
│ │ │ │ + * Parameters:
│ │ │ │ + * px - {|Object} the pixel position to move to.
│ │ │ │ + * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.
│ │ │ │ */
│ │ │ │ - deactivate: function() {
│ │ │ │ - if (this.active) {
│ │ │ │ - this.active = false;
│ │ │ │ - return true;
│ │ │ │ + moveTo: function(px) {
│ │ │ │ + //if no px passed in, use stored location
│ │ │ │ + if (px != null) {
│ │ │ │ + this.px = px;
│ │ │ │ + }
│ │ │ │ +
│ │ │ │ + if (this.imageDiv != null) {
│ │ │ │ + if (this.px == null) {
│ │ │ │ + this.display(false);
│ │ │ │ + } else {
│ │ │ │ + if (this.calculateOffset) {
│ │ │ │ + this.offset = this.calculateOffset(this.size);
│ │ │ │ + }
│ │ │ │ + OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, {
│ │ │ │ + x: this.px.x + this.offset.x,
│ │ │ │ + y: this.px.y + this.offset.y
│ │ │ │ + });
│ │ │ │ + }
│ │ │ │ }
│ │ │ │ - return false;
│ │ │ │ },
│ │ │ │
│ │ │ │ - CLASS_NAME: "OpenLayers.Strategy"
│ │ │ │ + /**
│ │ │ │ + * Method: display
│ │ │ │ + * Hide or show the icon
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * display - {Boolean}
│ │ │ │ + */
│ │ │ │ + display: function(display) {
│ │ │ │ + this.imageDiv.style.display = (display) ? "" : "none";
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * APIMethod: isDrawn
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Boolean} Whether or not the icon is drawn.
│ │ │ │ + */
│ │ │ │ + isDrawn: function() {
│ │ │ │ + // nodeType 11 for ie, whose nodes *always* have a parentNode
│ │ │ │ + // (of type document fragment)
│ │ │ │ + var isDrawn = (this.imageDiv && this.imageDiv.parentNode &&
│ │ │ │ + (this.imageDiv.parentNode.nodeType != 11));
│ │ │ │ +
│ │ │ │ + return isDrawn;
│ │ │ │ + },
│ │ │ │ +
│ │ │ │ + CLASS_NAME: "OpenLayers.Icon"
│ │ │ │ });
│ │ │ │ /* ======================================================================
│ │ │ │ - OpenLayers/Handler.js
│ │ │ │ + OpenLayers/Marker.js
│ │ │ │ ====================================================================== */
│ │ │ │
│ │ │ │ /* 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
│ │ │ │ * @requires OpenLayers/Events.js
│ │ │ │ + * @requires OpenLayers/Icon.js
│ │ │ │ */
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Class: OpenLayers.Handler
│ │ │ │ - * Base class to construct a higher-level handler for event sequences. All
│ │ │ │ - * handlers have activate and deactivate methods. In addition, they have
│ │ │ │ - * methods named like browser events. When a handler is activated, any
│ │ │ │ - * additional methods named like a browser event is registered as a
│ │ │ │ - * listener for the corresponding event. When a handler is deactivated,
│ │ │ │ - * those same methods are unregistered as event listeners.
│ │ │ │ + * Class: OpenLayers.Marker
│ │ │ │ + * Instances of OpenLayers.Marker are a combination of a
│ │ │ │ + * and an .
│ │ │ │ *
│ │ │ │ - * Handlers also typically have a callbacks object with keys named like
│ │ │ │ - * the abstracted events or event sequences that they are in charge of
│ │ │ │ - * handling. The controls that wrap handlers define the methods that
│ │ │ │ - * correspond to these abstract events - so instead of listening for
│ │ │ │ - * individual browser events, they only listen for the abstract events
│ │ │ │ - * defined by the handler.
│ │ │ │ - *
│ │ │ │ - * Handlers are created by controls, which ultimately have the responsibility
│ │ │ │ - * of making changes to the the state of the application. Handlers
│ │ │ │ - * themselves may make temporary changes, but in general are expected to
│ │ │ │ - * return the application in the same state that they found it.
│ │ │ │ + * Markers are generally added to a special layer called
│ │ │ │ + * .
│ │ │ │ + *
│ │ │ │ + * Example:
│ │ │ │ + * (code)
│ │ │ │ + * var markers = new OpenLayers.Layer.Markers( "Markers" );
│ │ │ │ + * map.addLayer(markers);
│ │ │ │ + *
│ │ │ │ + * var size = new OpenLayers.Size(21,25);
│ │ │ │ + * var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
│ │ │ │ + * var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png', size, offset);
│ │ │ │ + * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));
│ │ │ │ + * markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon.clone()));
│ │ │ │ + *
│ │ │ │ + * (end)
│ │ │ │ + *
│ │ │ │ + * Note that if you pass an icon into the Marker constructor, it will take
│ │ │ │ + * that icon and use it. This means that you should not share icons between
│ │ │ │ + * markers -- you use them once, but you should clone() for any additional
│ │ │ │ + * markers using that same icon.
│ │ │ │ */
│ │ │ │ -OpenLayers.Handler = OpenLayers.Class({
│ │ │ │ +OpenLayers.Marker = OpenLayers.Class({
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Property: id
│ │ │ │ - * {String}
│ │ │ │ + /**
│ │ │ │ + * Property: icon
│ │ │ │ + * {} The icon used by this marker.
│ │ │ │ */
│ │ │ │ - id: null,
│ │ │ │ + icon: null,
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * APIProperty: control
│ │ │ │ - * {}. The control that initialized this handler. The
│ │ │ │ - * control is assumed to have a valid map property - that map is used
│ │ │ │ - * in the handler's own setMap method.
│ │ │ │ + /**
│ │ │ │ + * Property: lonlat
│ │ │ │ + * {} location of object
│ │ │ │ */
│ │ │ │ - control: null,
│ │ │ │ + lonlat: null,
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Property: map
│ │ │ │ - * {}
│ │ │ │ + /**
│ │ │ │ + * Property: events
│ │ │ │ + * {} the event handler.
│ │ │ │ + */
│ │ │ │ + events: null,
│ │ │ │ +
│ │ │ │ + /**
│ │ │ │ + * Property: map
│ │ │ │ + * {} the map this marker is attached to
│ │ │ │ */
│ │ │ │ map: null,
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * APIProperty: keyMask
│ │ │ │ - * {Integer} Use bitwise operators and one or more of the OpenLayers.Handler
│ │ │ │ - * constants to construct a keyMask. The keyMask is used by
│ │ │ │ - * . If the keyMask matches the combination of keys
│ │ │ │ - * down on an event, checkModifiers returns true.
│ │ │ │ - *
│ │ │ │ - * Example:
│ │ │ │ - * (code)
│ │ │ │ - * // handler only responds if the Shift key is down
│ │ │ │ - * handler.keyMask = OpenLayers.Handler.MOD_SHIFT;
│ │ │ │ + /**
│ │ │ │ + * Constructor: OpenLayers.Marker
│ │ │ │ *
│ │ │ │ - * // handler only responds if Ctrl-Shift is down
│ │ │ │ - * handler.keyMask = OpenLayers.Handler.MOD_SHIFT |
│ │ │ │ - * OpenLayers.Handler.MOD_CTRL;
│ │ │ │ - * (end)
│ │ │ │ + * Parameters:
│ │ │ │ + * lonlat - {} the position of this marker
│ │ │ │ + * icon - {} the icon for this marker
│ │ │ │ */
│ │ │ │ - keyMask: null,
│ │ │ │ + initialize: function(lonlat, icon) {
│ │ │ │ + this.lonlat = lonlat;
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Property: active
│ │ │ │ - * {Boolean}
│ │ │ │ - */
│ │ │ │ - active: false,
│ │ │ │ + var newIcon = (icon) ? icon : OpenLayers.Marker.defaultIcon();
│ │ │ │ + if (this.icon == null) {
│ │ │ │ + this.icon = newIcon;
│ │ │ │ + } else {
│ │ │ │ + this.icon.url = newIcon.url;
│ │ │ │ + this.icon.size = newIcon.size;
│ │ │ │ + this.icon.offset = newIcon.offset;
│ │ │ │ + this.icon.calculateOffset = newIcon.calculateOffset;
│ │ │ │ + }
│ │ │ │ + this.events = new OpenLayers.Events(this, this.icon.imageDiv);
│ │ │ │ + },
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Property: evt
│ │ │ │ - * {Event} This property references the last event handled by the handler.
│ │ │ │ - * Note that this property is not part of the stable API. Use of the
│ │ │ │ - * evt property should be restricted to controls in the library
│ │ │ │ - * or other applications that are willing to update with changes to
│ │ │ │ - * the OpenLayers code.
│ │ │ │ + * APIMethod: destroy
│ │ │ │ + * Destroy the marker. You must first remove the marker from any
│ │ │ │ + * layer which it has been added to, or you will get buggy behavior.
│ │ │ │ + * (This can not be done within the marker since the marker does not
│ │ │ │ + * know which layer it is attached to.)
│ │ │ │ */
│ │ │ │ - evt: null,
│ │ │ │ + destroy: function() {
│ │ │ │ + // erase any drawn features
│ │ │ │ + this.erase();
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Property: touch
│ │ │ │ - * {Boolean} Indicates the support of touch events. When touch events are
│ │ │ │ - * started touch will be true and all mouse related listeners will do
│ │ │ │ - * nothing.
│ │ │ │ - */
│ │ │ │ - touch: false,
│ │ │ │ + this.map = null;
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Constructor: OpenLayers.Handler
│ │ │ │ - * Construct a handler.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * control - {} The control that initialized this
│ │ │ │ - * handler. The control is assumed to have a valid map property; that
│ │ │ │ - * map is used in the handler's own setMap method. If a map property
│ │ │ │ - * is present in the options argument it will be used instead.
│ │ │ │ - * callbacks - {Object} An object whose properties correspond to abstracted
│ │ │ │ - * events or sequences of browser events. The values for these
│ │ │ │ - * properties are functions defined by the control that get called by
│ │ │ │ - * the handler.
│ │ │ │ - * options - {Object} An optional object whose properties will be set on
│ │ │ │ - * the handler.
│ │ │ │ - */
│ │ │ │ - initialize: function(control, callbacks, options) {
│ │ │ │ - OpenLayers.Util.extend(this, options);
│ │ │ │ - this.control = control;
│ │ │ │ - this.callbacks = callbacks;
│ │ │ │ + this.events.destroy();
│ │ │ │ + this.events = null;
│ │ │ │
│ │ │ │ - var map = this.map || control.map;
│ │ │ │ - if (map) {
│ │ │ │ - this.setMap(map);
│ │ │ │ + if (this.icon != null) {
│ │ │ │ + this.icon.destroy();
│ │ │ │ + this.icon = null;
│ │ │ │ }
│ │ │ │ + },
│ │ │ │
│ │ │ │ - this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
│ │ │ │ + /**
│ │ │ │ + * Method: draw
│ │ │ │ + * Calls draw on the icon, and returns that output.
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * px - {}
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {DOMElement} A new DOM Image with this marker's icon set at the
│ │ │ │ + * location passed-in
│ │ │ │ + */
│ │ │ │ + draw: function(px) {
│ │ │ │ + return this.icon.draw(px);
│ │ │ │ },
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Method: setMap
│ │ │ │ + /**
│ │ │ │ + * Method: erase
│ │ │ │ + * Erases any drawn elements for this marker.
│ │ │ │ */
│ │ │ │ - setMap: function(map) {
│ │ │ │ - this.map = map;
│ │ │ │ + erase: function() {
│ │ │ │ + if (this.icon != null) {
│ │ │ │ + this.icon.erase();
│ │ │ │ + }
│ │ │ │ },
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Method: checkModifiers
│ │ │ │ - * Check the keyMask on the handler. If no is set, this always
│ │ │ │ - * returns true. If a is set and it matches the combination
│ │ │ │ - * of keys down on an event, this returns true.
│ │ │ │ + * Method: moveTo
│ │ │ │ + * Move the marker to the new location.
│ │ │ │ *
│ │ │ │ - * Returns:
│ │ │ │ - * {Boolean} The keyMask matches the keys down on an event.
│ │ │ │ - */
│ │ │ │ - checkModifiers: function(evt) {
│ │ │ │ - if (this.keyMask == null) {
│ │ │ │ - return true;
│ │ │ │ - }
│ │ │ │ - /* calculate the keyboard modifier mask for this event */
│ │ │ │ - var keyModifiers =
│ │ │ │ - (evt.shiftKey ? OpenLayers.Handler.MOD_SHIFT : 0) |
│ │ │ │ - (evt.ctrlKey ? OpenLayers.Handler.MOD_CTRL : 0) |
│ │ │ │ - (evt.altKey ? OpenLayers.Handler.MOD_ALT : 0) |
│ │ │ │ - (evt.metaKey ? OpenLayers.Handler.MOD_META : 0);
│ │ │ │ -
│ │ │ │ - /* if it differs from the handler object's key mask,
│ │ │ │ - bail out of the event handler */
│ │ │ │ - return (keyModifiers == this.keyMask);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: activate
│ │ │ │ - * Turn on the handler. Returns false if the handler was already active.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Boolean} The handler was activated.
│ │ │ │ + * Parameters:
│ │ │ │ + * px - {|Object} the pixel position to move to.
│ │ │ │ + * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.
│ │ │ │ */
│ │ │ │ - activate: function() {
│ │ │ │ - if (this.active) {
│ │ │ │ - return false;
│ │ │ │ - }
│ │ │ │ - // register for event handlers defined on this class.
│ │ │ │ - var events = OpenLayers.Events.prototype.BROWSER_EVENTS;
│ │ │ │ - for (var i = 0, len = events.length; i < len; i++) {
│ │ │ │ - if (this[events[i]]) {
│ │ │ │ - this.register(events[i], this[events[i]]);
│ │ │ │ - }
│ │ │ │ + moveTo: function(px) {
│ │ │ │ + if ((px != null) && (this.icon != null)) {
│ │ │ │ + this.icon.moveTo(px);
│ │ │ │ }
│ │ │ │ - this.active = true;
│ │ │ │ - return true;
│ │ │ │ + this.lonlat = this.map.getLonLatFromLayerPx(px);
│ │ │ │ },
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * APIMethod: deactivate
│ │ │ │ - * Turn off the handler. Returns false if the handler was already inactive.
│ │ │ │ + * APIMethod: isDrawn
│ │ │ │ *
│ │ │ │ * Returns:
│ │ │ │ - * {Boolean} The handler was deactivated.
│ │ │ │ + * {Boolean} Whether or not the marker is drawn.
│ │ │ │ */
│ │ │ │ - deactivate: function() {
│ │ │ │ - if (!this.active) {
│ │ │ │ - return false;
│ │ │ │ - }
│ │ │ │ - // unregister event handlers defined on this class.
│ │ │ │ - var events = OpenLayers.Events.prototype.BROWSER_EVENTS;
│ │ │ │ - for (var i = 0, len = events.length; i < len; i++) {
│ │ │ │ - if (this[events[i]]) {
│ │ │ │ - this.unregister(events[i], this[events[i]]);
│ │ │ │ - }
│ │ │ │ - }
│ │ │ │ - this.touch = false;
│ │ │ │ - this.active = false;
│ │ │ │ - return true;
│ │ │ │ + isDrawn: function() {
│ │ │ │ + var isDrawn = (this.icon && this.icon.isDrawn());
│ │ │ │ + return isDrawn;
│ │ │ │ },
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Method: startTouch
│ │ │ │ - * Start touch events, this method must be called by subclasses in
│ │ │ │ - * "touchstart" method. When touch events are started will be
│ │ │ │ - * true and all mouse related listeners will do nothing.
│ │ │ │ + * Method: onScreen
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {Boolean} Whether or not the marker is currently visible on screen.
│ │ │ │ */
│ │ │ │ - startTouch: function() {
│ │ │ │ - if (!this.touch) {
│ │ │ │ - this.touch = true;
│ │ │ │ - var events = [
│ │ │ │ - "mousedown", "mouseup", "mousemove", "click", "dblclick",
│ │ │ │ - "mouseout"
│ │ │ │ - ];
│ │ │ │ - for (var i = 0, len = events.length; i < len; i++) {
│ │ │ │ - if (this[events[i]]) {
│ │ │ │ - this.unregister(events[i], this[events[i]]);
│ │ │ │ - }
│ │ │ │ - }
│ │ │ │ + onScreen: function() {
│ │ │ │ +
│ │ │ │ + var onScreen = false;
│ │ │ │ + if (this.map) {
│ │ │ │ + var screenBounds = this.map.getExtent();
│ │ │ │ + onScreen = screenBounds.containsLonLat(this.lonlat);
│ │ │ │ }
│ │ │ │ + return onScreen;
│ │ │ │ },
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Method: callback
│ │ │ │ - * Trigger the control's named callback with the given arguments
│ │ │ │ + * Method: inflate
│ │ │ │ + * Englarges the markers icon by the specified ratio.
│ │ │ │ *
│ │ │ │ * Parameters:
│ │ │ │ - * name - {String} The key for the callback that is one of the properties
│ │ │ │ - * of the handler's callbacks object.
│ │ │ │ - * args - {Array(*)} An array of arguments (any type) with which to call
│ │ │ │ - * the callback (defined by the control).
│ │ │ │ + * inflate - {float} the ratio to enlarge the marker by (passing 2
│ │ │ │ + * will double the size).
│ │ │ │ */
│ │ │ │ - callback: function(name, args) {
│ │ │ │ - if (name && this.callbacks[name]) {
│ │ │ │ - this.callbacks[name].apply(this.control, args);
│ │ │ │ + inflate: function(inflate) {
│ │ │ │ + if (this.icon) {
│ │ │ │ + this.icon.setSize({
│ │ │ │ + w: this.icon.size.w * inflate,
│ │ │ │ + h: this.icon.size.h * inflate
│ │ │ │ + });
│ │ │ │ }
│ │ │ │ },
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Method: register
│ │ │ │ - * register an event on the map
│ │ │ │ - */
│ │ │ │ - register: function(name, method) {
│ │ │ │ - // TODO: deal with registerPriority in 3.0
│ │ │ │ - this.map.events.registerPriority(name, this, method);
│ │ │ │ - this.map.events.registerPriority(name, this, this.setEvent);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: unregister
│ │ │ │ - * unregister an event from the map
│ │ │ │ + /**
│ │ │ │ + * Method: setOpacity
│ │ │ │ + * Change the opacity of the marker by changin the opacity of
│ │ │ │ + * its icon
│ │ │ │ + *
│ │ │ │ + * Parameters:
│ │ │ │ + * opacity - {float} Specified as fraction (0.4, etc)
│ │ │ │ */
│ │ │ │ - unregister: function(name, method) {
│ │ │ │ - this.map.events.unregister(name, this, method);
│ │ │ │ - this.map.events.unregister(name, this, this.setEvent);
│ │ │ │ + setOpacity: function(opacity) {
│ │ │ │ + this.icon.setOpacity(opacity);
│ │ │ │ },
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Method: setEvent
│ │ │ │ - * With each registered browser event, the handler sets its own evt
│ │ │ │ - * property. This property can be accessed by controls if needed
│ │ │ │ - * to get more information about the event that the handler is
│ │ │ │ - * processing.
│ │ │ │ - *
│ │ │ │ - * This allows modifier keys on the event to be checked (alt, shift, ctrl,
│ │ │ │ - * and meta cannot be checked with the keyboard handler). For a
│ │ │ │ - * control to determine which modifier keys are associated with the
│ │ │ │ - * event that a handler is currently processing, it should access
│ │ │ │ - * (code)handler.evt.altKey || handler.evt.shiftKey ||
│ │ │ │ - * handler.evt.ctrlKey || handler.evt.metaKey(end).
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * evt - {Event} The browser event.
│ │ │ │ + * Method: setUrl
│ │ │ │ + * Change URL of the Icon Image.
│ │ │ │ + *
│ │ │ │ + * url - {String}
│ │ │ │ */
│ │ │ │ - setEvent: function(evt) {
│ │ │ │ - this.evt = evt;
│ │ │ │ - return true;
│ │ │ │ + setUrl: function(url) {
│ │ │ │ + this.icon.setUrl(url);
│ │ │ │ },
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Method: destroy
│ │ │ │ - * Deconstruct the handler.
│ │ │ │ + /**
│ │ │ │ + * Method: display
│ │ │ │ + * Hide or show the icon
│ │ │ │ + *
│ │ │ │ + * display - {Boolean}
│ │ │ │ */
│ │ │ │ - destroy: function() {
│ │ │ │ - // unregister event listeners
│ │ │ │ - this.deactivate();
│ │ │ │ - // eliminate circular references
│ │ │ │ - this.control = this.map = null;
│ │ │ │ + display: function(display) {
│ │ │ │ + this.icon.display(display);
│ │ │ │ },
│ │ │ │
│ │ │ │ - CLASS_NAME: "OpenLayers.Handler"
│ │ │ │ + CLASS_NAME: "OpenLayers.Marker"
│ │ │ │ });
│ │ │ │
│ │ │ │ -/**
│ │ │ │ - * Constant: OpenLayers.Handler.MOD_NONE
│ │ │ │ - * If set as the , returns false if any key is down.
│ │ │ │ - */
│ │ │ │ -OpenLayers.Handler.MOD_NONE = 0;
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Constant: OpenLayers.Handler.MOD_SHIFT
│ │ │ │ - * If set as the , returns false if Shift is down.
│ │ │ │ - */
│ │ │ │ -OpenLayers.Handler.MOD_SHIFT = 1;
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Constant: OpenLayers.Handler.MOD_CTRL
│ │ │ │ - * If set as the , returns false if Ctrl is down.
│ │ │ │ - */
│ │ │ │ -OpenLayers.Handler.MOD_CTRL = 2;
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Constant: OpenLayers.Handler.MOD_ALT
│ │ │ │ - * If set as the , returns false if Alt is down.
│ │ │ │ - */
│ │ │ │ -OpenLayers.Handler.MOD_ALT = 4;
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Constant: OpenLayers.Handler.MOD_META
│ │ │ │ - * If set as the , returns false if Cmd is down.
│ │ │ │ + * Function: defaultIcon
│ │ │ │ + * Creates a default .
│ │ │ │ + *
│ │ │ │ + * Returns:
│ │ │ │ + * {} A default OpenLayers.Icon to use for a marker
│ │ │ │ */
│ │ │ │ -OpenLayers.Handler.MOD_META = 8;
│ │ │ │ +OpenLayers.Marker.defaultIcon = function() {
│ │ │ │ + return new OpenLayers.Icon(OpenLayers.Util.getImageLocation("marker.png"), {
│ │ │ │ + w: 21,
│ │ │ │ + h: 25
│ │ │ │ + }, {
│ │ │ │ + x: -10.5,
│ │ │ │ + y: -25
│ │ │ │ + });
│ │ │ │ +};
│ │ │ │
│ │ │ │
│ │ │ │ /* ======================================================================
│ │ │ │ OpenLayers/Geometry.js
│ │ │ │ ====================================================================== */
│ │ │ │
│ │ │ │ /* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
│ │ │ │ @@ -16780,642 +16464,14 @@
│ │ │ │ distance: Math.pow(x - x0, 2) + Math.pow(y - y0, 2),
│ │ │ │ x: x,
│ │ │ │ y: y,
│ │ │ │ along: along
│ │ │ │ };
│ │ │ │ };
│ │ │ │ /* ======================================================================
│ │ │ │ - OpenLayers/Icon.js
│ │ │ │ - ====================================================================== */
│ │ │ │ -
│ │ │ │ -/* 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.Icon
│ │ │ │ - *
│ │ │ │ - * The icon represents a graphical icon on the screen. Typically used in
│ │ │ │ - * conjunction with a to represent markers on a screen.
│ │ │ │ - *
│ │ │ │ - * An icon has a url, size and position. It also contains an offset which
│ │ │ │ - * allows the center point to be represented correctly. This can be
│ │ │ │ - * provided either as a fixed offset or a function provided to calculate
│ │ │ │ - * the desired offset.
│ │ │ │ - *
│ │ │ │ - */
│ │ │ │ -OpenLayers.Icon = OpenLayers.Class({
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: url
│ │ │ │ - * {String} image url
│ │ │ │ - */
│ │ │ │ - url: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: size
│ │ │ │ - * {|Object} An OpenLayers.Size or
│ │ │ │ - * an object with a 'w' and 'h' properties.
│ │ │ │ - */
│ │ │ │ - size: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: offset
│ │ │ │ - * {|Object} distance in pixels to offset the
│ │ │ │ - * image when being rendered. An OpenLayers.Pixel or an object
│ │ │ │ - * with a 'x' and 'y' properties.
│ │ │ │ - */
│ │ │ │ - offset: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: calculateOffset
│ │ │ │ - * {Function} Function to calculate the offset (based on the size)
│ │ │ │ - */
│ │ │ │ - calculateOffset: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: imageDiv
│ │ │ │ - * {DOMElement}
│ │ │ │ - */
│ │ │ │ - imageDiv: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: px
│ │ │ │ - * {|Object} An OpenLayers.Pixel or an object
│ │ │ │ - * with a 'x' and 'y' properties.
│ │ │ │ - */
│ │ │ │ - px: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Constructor: OpenLayers.Icon
│ │ │ │ - * Creates an icon, which is an image tag in a div.
│ │ │ │ - *
│ │ │ │ - * url - {String}
│ │ │ │ - * size - {|Object} An OpenLayers.Size or an
│ │ │ │ - * object with a 'w' and 'h'
│ │ │ │ - * properties.
│ │ │ │ - * offset - {|Object} An OpenLayers.Pixel or an
│ │ │ │ - * object with a 'x' and 'y'
│ │ │ │ - * properties.
│ │ │ │ - * calculateOffset - {Function}
│ │ │ │ - */
│ │ │ │ - initialize: function(url, size, offset, calculateOffset) {
│ │ │ │ - this.url = url;
│ │ │ │ - this.size = size || {
│ │ │ │ - w: 20,
│ │ │ │ - h: 20
│ │ │ │ - };
│ │ │ │ - this.offset = offset || {
│ │ │ │ - x: -(this.size.w / 2),
│ │ │ │ - y: -(this.size.h / 2)
│ │ │ │ - };
│ │ │ │ - this.calculateOffset = calculateOffset;
│ │ │ │ -
│ │ │ │ - var id = OpenLayers.Util.createUniqueID("OL_Icon_");
│ │ │ │ - this.imageDiv = OpenLayers.Util.createAlphaImageDiv(id);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: destroy
│ │ │ │ - * Nullify references and remove event listeners to prevent circular
│ │ │ │ - * references and memory leaks
│ │ │ │ - */
│ │ │ │ - destroy: function() {
│ │ │ │ - // erase any drawn elements
│ │ │ │ - this.erase();
│ │ │ │ -
│ │ │ │ - OpenLayers.Event.stopObservingElement(this.imageDiv.firstChild);
│ │ │ │ - this.imageDiv.innerHTML = "";
│ │ │ │ - this.imageDiv = null;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: clone
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {} A fresh copy of the icon.
│ │ │ │ - */
│ │ │ │ - clone: function() {
│ │ │ │ - return new OpenLayers.Icon(this.url,
│ │ │ │ - this.size,
│ │ │ │ - this.offset,
│ │ │ │ - this.calculateOffset);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: setSize
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * size - {|Object} An OpenLayers.Size or
│ │ │ │ - * an object with a 'w' and 'h' properties.
│ │ │ │ - */
│ │ │ │ - setSize: function(size) {
│ │ │ │ - if (size != null) {
│ │ │ │ - this.size = size;
│ │ │ │ - }
│ │ │ │ - this.draw();
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: setUrl
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * url - {String}
│ │ │ │ - */
│ │ │ │ - setUrl: function(url) {
│ │ │ │ - if (url != null) {
│ │ │ │ - this.url = url;
│ │ │ │ - }
│ │ │ │ - this.draw();
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: draw
│ │ │ │ - * Move the div to the given pixel.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * px - {|Object} An OpenLayers.Pixel or an
│ │ │ │ - * object with a 'x' and 'y' properties.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {DOMElement} A new DOM Image of this icon set at the location passed-in
│ │ │ │ - */
│ │ │ │ - draw: function(px) {
│ │ │ │ - OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv,
│ │ │ │ - null,
│ │ │ │ - null,
│ │ │ │ - this.size,
│ │ │ │ - this.url,
│ │ │ │ - "absolute");
│ │ │ │ - this.moveTo(px);
│ │ │ │ - return this.imageDiv;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: erase
│ │ │ │ - * Erase the underlying image element.
│ │ │ │ - */
│ │ │ │ - erase: function() {
│ │ │ │ - if (this.imageDiv != null && this.imageDiv.parentNode != null) {
│ │ │ │ - OpenLayers.Element.remove(this.imageDiv);
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: setOpacity
│ │ │ │ - * Change the icon's opacity
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * opacity - {float}
│ │ │ │ - */
│ │ │ │ - setOpacity: function(opacity) {
│ │ │ │ - OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, null, null,
│ │ │ │ - null, null, null, null, opacity);
│ │ │ │ -
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: moveTo
│ │ │ │ - * move icon to passed in px.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * px - {|Object} the pixel position to move to.
│ │ │ │ - * An OpenLayers.Pixel or an object with a 'x' and 'y' properties.
│ │ │ │ - */
│ │ │ │ - moveTo: function(px) {
│ │ │ │ - //if no px passed in, use stored location
│ │ │ │ - if (px != null) {
│ │ │ │ - this.px = px;
│ │ │ │ - }
│ │ │ │ -
│ │ │ │ - if (this.imageDiv != null) {
│ │ │ │ - if (this.px == null) {
│ │ │ │ - this.display(false);
│ │ │ │ - } else {
│ │ │ │ - if (this.calculateOffset) {
│ │ │ │ - this.offset = this.calculateOffset(this.size);
│ │ │ │ - }
│ │ │ │ - OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, {
│ │ │ │ - x: this.px.x + this.offset.x,
│ │ │ │ - y: this.px.y + this.offset.y
│ │ │ │ - });
│ │ │ │ - }
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: display
│ │ │ │ - * Hide or show the icon
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * display - {Boolean}
│ │ │ │ - */
│ │ │ │ - display: function(display) {
│ │ │ │ - this.imageDiv.style.display = (display) ? "" : "none";
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: isDrawn
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Boolean} Whether or not the icon is drawn.
│ │ │ │ - */
│ │ │ │ - isDrawn: function() {
│ │ │ │ - // nodeType 11 for ie, whose nodes *always* have a parentNode
│ │ │ │ - // (of type document fragment)
│ │ │ │ - var isDrawn = (this.imageDiv && this.imageDiv.parentNode &&
│ │ │ │ - (this.imageDiv.parentNode.nodeType != 11));
│ │ │ │ -
│ │ │ │ - return isDrawn;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - CLASS_NAME: "OpenLayers.Icon"
│ │ │ │ -});
│ │ │ │ -/* ======================================================================
│ │ │ │ - OpenLayers/Control.js
│ │ │ │ - ====================================================================== */
│ │ │ │ -
│ │ │ │ -/* 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.Control
│ │ │ │ - * Controls affect the display or behavior of the map. They allow everything
│ │ │ │ - * from panning and zooming to displaying a scale indicator. Controls by
│ │ │ │ - * default are added to the map they are contained within however it is
│ │ │ │ - * possible to add a control to an external div by passing the div in the
│ │ │ │ - * options parameter.
│ │ │ │ - *
│ │ │ │ - * Example:
│ │ │ │ - * The following example shows how to add many of the common controls
│ │ │ │ - * to a map.
│ │ │ │ - *
│ │ │ │ - * > var map = new OpenLayers.Map('map', { controls: [] });
│ │ │ │ - * >
│ │ │ │ - * > map.addControl(new OpenLayers.Control.PanZoomBar());
│ │ │ │ - * > map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
│ │ │ │ - * > map.addControl(new OpenLayers.Control.Permalink());
│ │ │ │ - * > map.addControl(new OpenLayers.Control.Permalink('permalink'));
│ │ │ │ - * > map.addControl(new OpenLayers.Control.MousePosition());
│ │ │ │ - * > map.addControl(new OpenLayers.Control.OverviewMap());
│ │ │ │ - * > map.addControl(new OpenLayers.Control.KeyboardDefaults());
│ │ │ │ - *
│ │ │ │ - * The next code fragment is a quick example of how to intercept
│ │ │ │ - * shift-mouse click to display the extent of the bounding box
│ │ │ │ - * dragged out by the user. Usually controls are not created
│ │ │ │ - * in exactly this manner. See the source for a more complete
│ │ │ │ - * example:
│ │ │ │ - *
│ │ │ │ - * > var control = new OpenLayers.Control();
│ │ │ │ - * > OpenLayers.Util.extend(control, {
│ │ │ │ - * > draw: function () {
│ │ │ │ - * > // this Handler.Box will intercept the shift-mousedown
│ │ │ │ - * > // before Control.MouseDefault gets to see it
│ │ │ │ - * > this.box = new OpenLayers.Handler.Box( control,
│ │ │ │ - * > {"done": this.notice},
│ │ │ │ - * > {keyMask: OpenLayers.Handler.MOD_SHIFT});
│ │ │ │ - * > this.box.activate();
│ │ │ │ - * > },
│ │ │ │ - * >
│ │ │ │ - * > notice: function (bounds) {
│ │ │ │ - * > OpenLayers.Console.userError(bounds);
│ │ │ │ - * > }
│ │ │ │ - * > });
│ │ │ │ - * > map.addControl(control);
│ │ │ │ - *
│ │ │ │ - */
│ │ │ │ -OpenLayers.Control = OpenLayers.Class({
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: id
│ │ │ │ - * {String}
│ │ │ │ - */
│ │ │ │ - id: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: map
│ │ │ │ - * {} this gets set in the addControl() function in
│ │ │ │ - * OpenLayers.Map
│ │ │ │ - */
│ │ │ │ - map: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: div
│ │ │ │ - * {DOMElement} The element that contains the control, if not present the
│ │ │ │ - * control is placed inside the map.
│ │ │ │ - */
│ │ │ │ - div: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: type
│ │ │ │ - * {Number} Controls can have a 'type'. The type determines the type of
│ │ │ │ - * interactions which are possible with them when they are placed in an
│ │ │ │ - * .
│ │ │ │ - */
│ │ │ │ - type: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: allowSelection
│ │ │ │ - * {Boolean} By default, controls do not allow selection, because
│ │ │ │ - * it may interfere with map dragging. If this is true, OpenLayers
│ │ │ │ - * will not prevent selection of the control.
│ │ │ │ - * Default is false.
│ │ │ │ - */
│ │ │ │ - allowSelection: false,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: displayClass
│ │ │ │ - * {string} This property is used for CSS related to the drawing of the
│ │ │ │ - * Control.
│ │ │ │ - */
│ │ │ │ - displayClass: "",
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: title
│ │ │ │ - * {string} This property is used for showing a tooltip over the
│ │ │ │ - * Control.
│ │ │ │ - */
│ │ │ │ - title: "",
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: autoActivate
│ │ │ │ - * {Boolean} Activate the control when it is added to a map. Default is
│ │ │ │ - * false.
│ │ │ │ - */
│ │ │ │ - autoActivate: false,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: active
│ │ │ │ - * {Boolean} The control is active (read-only). Use and
│ │ │ │ - * to change control state.
│ │ │ │ - */
│ │ │ │ - active: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: handlerOptions
│ │ │ │ - * {Object} Used to set non-default properties on the control's handler
│ │ │ │ - */
│ │ │ │ - handlerOptions: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: handler
│ │ │ │ - * {} null
│ │ │ │ - */
│ │ │ │ - handler: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: eventListeners
│ │ │ │ - * {Object} If set as an option at construction, the eventListeners
│ │ │ │ - * object will be registered with . Object
│ │ │ │ - * structure must be a listeners object as shown in the example for
│ │ │ │ - * the events.on method.
│ │ │ │ - */
│ │ │ │ - eventListeners: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIProperty: events
│ │ │ │ - * {} Events instance for listeners and triggering
│ │ │ │ - * control specific events.
│ │ │ │ - *
│ │ │ │ - * Register a listener for a particular event with the following syntax:
│ │ │ │ - * (code)
│ │ │ │ - * control.events.register(type, obj, listener);
│ │ │ │ - * (end)
│ │ │ │ - *
│ │ │ │ - * Listeners will be called with a reference to an event object. The
│ │ │ │ - * properties of this event depends on exactly what happened.
│ │ │ │ - *
│ │ │ │ - * All event objects have at least the following properties:
│ │ │ │ - * object - {Object} A reference to control.events.object (a reference
│ │ │ │ - * to the control).
│ │ │ │ - * element - {DOMElement} A reference to control.events.element (which
│ │ │ │ - * will be null unless documented otherwise).
│ │ │ │ - *
│ │ │ │ - * Supported map event types:
│ │ │ │ - * activate - Triggered when activated.
│ │ │ │ - * deactivate - Triggered when deactivated.
│ │ │ │ - */
│ │ │ │ - events: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Constructor: OpenLayers.Control
│ │ │ │ - * Create an OpenLayers Control. The options passed as a parameter
│ │ │ │ - * directly extend the control. For example passing the following:
│ │ │ │ - *
│ │ │ │ - * > var control = new OpenLayers.Control({div: myDiv});
│ │ │ │ - *
│ │ │ │ - * Overrides the default div attribute value of null.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * options - {Object}
│ │ │ │ - */
│ │ │ │ - initialize: function(options) {
│ │ │ │ - // We do this before the extend so that instances can override
│ │ │ │ - // className in options.
│ │ │ │ - this.displayClass =
│ │ │ │ - this.CLASS_NAME.replace("OpenLayers.", "ol").replace(/\./g, "");
│ │ │ │ -
│ │ │ │ - OpenLayers.Util.extend(this, options);
│ │ │ │ -
│ │ │ │ - this.events = new OpenLayers.Events(this);
│ │ │ │ - if (this.eventListeners instanceof Object) {
│ │ │ │ - this.events.on(this.eventListeners);
│ │ │ │ - }
│ │ │ │ - if (this.id == null) {
│ │ │ │ - this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: destroy
│ │ │ │ - * The destroy method is used to perform any clean up before the control
│ │ │ │ - * is dereferenced. Typically this is where event listeners are removed
│ │ │ │ - * to prevent memory leaks.
│ │ │ │ - */
│ │ │ │ - destroy: function() {
│ │ │ │ - if (this.events) {
│ │ │ │ - if (this.eventListeners) {
│ │ │ │ - this.events.un(this.eventListeners);
│ │ │ │ - }
│ │ │ │ - this.events.destroy();
│ │ │ │ - this.events = null;
│ │ │ │ - }
│ │ │ │ - this.eventListeners = null;
│ │ │ │ -
│ │ │ │ - // eliminate circular references
│ │ │ │ - if (this.handler) {
│ │ │ │ - this.handler.destroy();
│ │ │ │ - this.handler = null;
│ │ │ │ - }
│ │ │ │ - if (this.handlers) {
│ │ │ │ - for (var key in this.handlers) {
│ │ │ │ - if (this.handlers.hasOwnProperty(key) &&
│ │ │ │ - typeof this.handlers[key].destroy == "function") {
│ │ │ │ - this.handlers[key].destroy();
│ │ │ │ - }
│ │ │ │ - }
│ │ │ │ - this.handlers = null;
│ │ │ │ - }
│ │ │ │ - if (this.map) {
│ │ │ │ - this.map.removeControl(this);
│ │ │ │ - this.map = null;
│ │ │ │ - }
│ │ │ │ - this.div = null;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: setMap
│ │ │ │ - * Set the map property for the control. This is done through an accessor
│ │ │ │ - * so that subclasses can override this and take special action once
│ │ │ │ - * they have their map variable set.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * map - {}
│ │ │ │ - */
│ │ │ │ - setMap: function(map) {
│ │ │ │ - this.map = map;
│ │ │ │ - if (this.handler) {
│ │ │ │ - this.handler.setMap(map);
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: draw
│ │ │ │ - * The draw method is called when the control is ready to be displayed
│ │ │ │ - * on the page. If a div has not been created one is created. Controls
│ │ │ │ - * with a visual component will almost always want to override this method
│ │ │ │ - * to customize the look of control.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * px - {} The top-left pixel position of the control
│ │ │ │ - * or null.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {DOMElement} A reference to the DIV DOMElement containing the control
│ │ │ │ - */
│ │ │ │ - draw: function(px) {
│ │ │ │ - if (this.div == null) {
│ │ │ │ - this.div = OpenLayers.Util.createDiv(this.id);
│ │ │ │ - this.div.className = this.displayClass;
│ │ │ │ - if (!this.allowSelection) {
│ │ │ │ - this.div.className += " olControlNoSelect";
│ │ │ │ - this.div.setAttribute("unselectable", "on", 0);
│ │ │ │ - this.div.onselectstart = OpenLayers.Function.False;
│ │ │ │ - }
│ │ │ │ - if (this.title != "") {
│ │ │ │ - this.div.title = this.title;
│ │ │ │ - }
│ │ │ │ - }
│ │ │ │ - if (px != null) {
│ │ │ │ - this.position = px.clone();
│ │ │ │ - }
│ │ │ │ - this.moveTo(this.position);
│ │ │ │ - return this.div;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: moveTo
│ │ │ │ - * Sets the left and top style attributes to the passed in pixel
│ │ │ │ - * coordinates.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * px - {}
│ │ │ │ - */
│ │ │ │ - moveTo: function(px) {
│ │ │ │ - if ((px != null) && (this.div != null)) {
│ │ │ │ - this.div.style.left = px.x + "px";
│ │ │ │ - this.div.style.top = px.y + "px";
│ │ │ │ - }
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: activate
│ │ │ │ - * Explicitly activates a control and it's associated
│ │ │ │ - * handler if one has been set. Controls can be
│ │ │ │ - * deactivated by calling the deactivate() method.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Boolean} True if the control was successfully activated or
│ │ │ │ - * false if the control was already active.
│ │ │ │ - */
│ │ │ │ - activate: function() {
│ │ │ │ - if (this.active) {
│ │ │ │ - return false;
│ │ │ │ - }
│ │ │ │ - if (this.handler) {
│ │ │ │ - this.handler.activate();
│ │ │ │ - }
│ │ │ │ - this.active = true;
│ │ │ │ - if (this.map) {
│ │ │ │ - OpenLayers.Element.addClass(
│ │ │ │ - this.map.viewPortDiv,
│ │ │ │ - this.displayClass.replace(/ /g, "") + "Active"
│ │ │ │ - );
│ │ │ │ - }
│ │ │ │ - this.events.triggerEvent("activate");
│ │ │ │ - return true;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: deactivate
│ │ │ │ - * Deactivates a control and it's associated handler if any. The exact
│ │ │ │ - * effect of this depends on the control itself.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Boolean} True if the control was effectively deactivated or false
│ │ │ │ - * if the control was already inactive.
│ │ │ │ - */
│ │ │ │ - deactivate: function() {
│ │ │ │ - if (this.active) {
│ │ │ │ - if (this.handler) {
│ │ │ │ - this.handler.deactivate();
│ │ │ │ - }
│ │ │ │ - this.active = false;
│ │ │ │ - if (this.map) {
│ │ │ │ - OpenLayers.Element.removeClass(
│ │ │ │ - this.map.viewPortDiv,
│ │ │ │ - this.displayClass.replace(/ /g, "") + "Active"
│ │ │ │ - );
│ │ │ │ - }
│ │ │ │ - this.events.triggerEvent("deactivate");
│ │ │ │ - return true;
│ │ │ │ - }
│ │ │ │ - return false;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - CLASS_NAME: "OpenLayers.Control"
│ │ │ │ -});
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Constant: OpenLayers.Control.TYPE_BUTTON
│ │ │ │ - */
│ │ │ │ -OpenLayers.Control.TYPE_BUTTON = 1;
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Constant: OpenLayers.Control.TYPE_TOGGLE
│ │ │ │ - */
│ │ │ │ -OpenLayers.Control.TYPE_TOGGLE = 2;
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Constant: OpenLayers.Control.TYPE_TOOL
│ │ │ │ - */
│ │ │ │ -OpenLayers.Control.TYPE_TOOL = 3;
│ │ │ │ -/* ======================================================================
│ │ │ │ OpenLayers/Format.js
│ │ │ │ ====================================================================== */
│ │ │ │
│ │ │ │ /* 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. */
│ │ │ │ @@ -23776,104 +22832,14 @@
│ │ │ │ * Constant: OpenLayers.Format.WFST.DEFAULTS
│ │ │ │ * {Object} Default properties for the WFST format.
│ │ │ │ */
│ │ │ │ OpenLayers.Format.WFST.DEFAULTS = {
│ │ │ │ "version": "1.0.0"
│ │ │ │ };
│ │ │ │ /* ======================================================================
│ │ │ │ - OpenLayers/Filter.js
│ │ │ │ - ====================================================================== */
│ │ │ │ -
│ │ │ │ -/* 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
│ │ │ │ - * @requires OpenLayers/Util.js
│ │ │ │ - * @requires OpenLayers/Style.js
│ │ │ │ - */
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Class: OpenLayers.Filter
│ │ │ │ - * This class represents an OGC Filter.
│ │ │ │ - */
│ │ │ │ -OpenLayers.Filter = OpenLayers.Class({
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Constructor: OpenLayers.Filter
│ │ │ │ - * This class represents a generic filter.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * options - {Object} Optional object whose properties will be set on the
│ │ │ │ - * instance.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {}
│ │ │ │ - */
│ │ │ │ - initialize: function(options) {
│ │ │ │ - OpenLayers.Util.extend(this, options);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: destroy
│ │ │ │ - * Remove reference to anything added.
│ │ │ │ - */
│ │ │ │ - destroy: function() {},
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: evaluate
│ │ │ │ - * Evaluates this filter in a specific context. Instances or subclasses
│ │ │ │ - * are supposed to override this method.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * context - {Object} Context to use in evaluating the filter. If a vector
│ │ │ │ - * feature is provided, the feature.attributes will be used as context.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Boolean} The filter applies.
│ │ │ │ - */
│ │ │ │ - evaluate: function(context) {
│ │ │ │ - return true;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: clone
│ │ │ │ - * Clones this filter. Should be implemented by subclasses.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {} Clone of this filter.
│ │ │ │ - */
│ │ │ │ - clone: function() {
│ │ │ │ - return null;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: toString
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {String} Include in your build to get a CQL
│ │ │ │ - * representation of the filter returned. Otherwise "[Object object]"
│ │ │ │ - * will be returned.
│ │ │ │ - */
│ │ │ │ - toString: function() {
│ │ │ │ - var string;
│ │ │ │ - if (OpenLayers.Format && OpenLayers.Format.CQL) {
│ │ │ │ - string = OpenLayers.Format.CQL.prototype.write(this);
│ │ │ │ - } else {
│ │ │ │ - string = Object.prototype.toString.call(this);
│ │ │ │ - }
│ │ │ │ - return string;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - CLASS_NAME: "OpenLayers.Filter"
│ │ │ │ -});
│ │ │ │ -/* ======================================================================
│ │ │ │ OpenLayers/Filter/Spatial.js
│ │ │ │ ====================================================================== */
│ │ │ │
│ │ │ │ /* 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. */
│ │ │ │ @@ -30102,2264 +29068,137 @@
│ │ │ │ OpenLayers.Util.extend(this, options);
│ │ │ │ },
│ │ │ │
│ │ │ │ CLASS_NAME: "OpenLayers.WPSProcess.ChainLink"
│ │ │ │
│ │ │ │ });
│ │ │ │ /* ======================================================================
│ │ │ │ - OpenLayers/Spherical.js
│ │ │ │ - ====================================================================== */
│ │ │ │ -
│ │ │ │ -/* 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/SingleFile.js
│ │ │ │ - */
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Namespace: Spherical
│ │ │ │ - * The OpenLayers.Spherical namespace includes utility functions for
│ │ │ │ - * calculations on the basis of a spherical earth (ignoring ellipsoidal
│ │ │ │ - * effects), which is accurate enough for most purposes.
│ │ │ │ - *
│ │ │ │ - * Relevant links:
│ │ │ │ - * * http://www.movable-type.co.uk/scripts/latlong.html
│ │ │ │ - * * http://code.google.com/apis/maps/documentation/javascript/reference.html#spherical
│ │ │ │ - */
│ │ │ │ -
│ │ │ │ -OpenLayers.Spherical = OpenLayers.Spherical || {};
│ │ │ │ -
│ │ │ │ -OpenLayers.Spherical.DEFAULT_RADIUS = 6378137;
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * APIFunction: computeDistanceBetween
│ │ │ │ - * Computes the distance between two LonLats.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * from - {} or {Object} Starting point. A LonLat or
│ │ │ │ - * a JavaScript literal with lon lat properties.
│ │ │ │ - * to - {} or {Object} Ending point. A LonLat or a
│ │ │ │ - * JavaScript literal with lon lat properties.
│ │ │ │ - * radius - {Float} The radius. Optional. Defaults to 6378137 meters.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float} The distance in meters.
│ │ │ │ - */
│ │ │ │ -OpenLayers.Spherical.computeDistanceBetween = function(from, to, radius) {
│ │ │ │ - var R = radius || OpenLayers.Spherical.DEFAULT_RADIUS;
│ │ │ │ - var sinHalfDeltaLon = Math.sin(Math.PI * (to.lon - from.lon) / 360);
│ │ │ │ - var sinHalfDeltaLat = Math.sin(Math.PI * (to.lat - from.lat) / 360);
│ │ │ │ - var a = sinHalfDeltaLat * sinHalfDeltaLat +
│ │ │ │ - sinHalfDeltaLon * sinHalfDeltaLon * Math.cos(Math.PI * from.lat / 180) * Math.cos(Math.PI * to.lat / 180);
│ │ │ │ - return 2 * R * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
│ │ │ │ -};
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * APIFunction: computeHeading
│ │ │ │ - * Computes the heading from one LonLat to another LonLat.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * from - {} or {Object} Starting point. A LonLat or
│ │ │ │ - * a JavaScript literal with lon lat properties.
│ │ │ │ - * to - {} or {Object} Ending point. A LonLat or a
│ │ │ │ - * JavaScript literal with lon lat properties.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float} The heading in degrees.
│ │ │ │ - */
│ │ │ │ -OpenLayers.Spherical.computeHeading = function(from, to) {
│ │ │ │ - var y = Math.sin(Math.PI * (from.lon - to.lon) / 180) * Math.cos(Math.PI * to.lat / 180);
│ │ │ │ - var x = Math.cos(Math.PI * from.lat / 180) * Math.sin(Math.PI * to.lat / 180) -
│ │ │ │ - Math.sin(Math.PI * from.lat / 180) * Math.cos(Math.PI * to.lat / 180) * Math.cos(Math.PI * (from.lon - to.lon) / 180);
│ │ │ │ - return 180 * Math.atan2(y, x) / Math.PI;
│ │ │ │ -};
│ │ │ │ -/* ======================================================================
│ │ │ │ - OpenLayers/Protocol.js
│ │ │ │ + OpenLayers/Strategy.js
│ │ │ │ ====================================================================== */
│ │ │ │
│ │ │ │ /* 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.Protocol
│ │ │ │ - * Abstract vector layer protocol class. Not to be instantiated directly. Use
│ │ │ │ - * one of the protocol subclasses instead.
│ │ │ │ + * Class: OpenLayers.Strategy
│ │ │ │ + * Abstract vector layer strategy class. Not to be instantiated directly. Use
│ │ │ │ + * one of the strategy subclasses instead.
│ │ │ │ */
│ │ │ │ -OpenLayers.Protocol = OpenLayers.Class({
│ │ │ │ +OpenLayers.Strategy = OpenLayers.Class({
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Property: format
│ │ │ │ - * {} The format used by this protocol.
│ │ │ │ + * Property: layer
│ │ │ │ + * {} The layer this strategy belongs to.
│ │ │ │ */
│ │ │ │ - format: null,
│ │ │ │ + layer: null,
│ │ │ │
│ │ │ │ /**
│ │ │ │ * Property: options
│ │ │ │ * {Object} Any options sent to the constructor.
│ │ │ │ */
│ │ │ │ options: null,
│ │ │ │
│ │ │ │ - /**
│ │ │ │ - * Property: autoDestroy
│ │ │ │ - * {Boolean} The creator of the protocol can set autoDestroy to false
│ │ │ │ - * to fully control when the protocol is destroyed. Defaults to
│ │ │ │ - * true.
│ │ │ │ - */
│ │ │ │ - autoDestroy: true,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: defaultFilter
│ │ │ │ - * {} Optional default filter to read requests
│ │ │ │ - */
│ │ │ │ - defaultFilter: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Constructor: OpenLayers.Protocol
│ │ │ │ - * Abstract class for vector protocols. Create instances of a subclass.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * options - {Object} Optional object whose properties will be set on the
│ │ │ │ - * instance.
│ │ │ │ - */
│ │ │ │ - initialize: function(options) {
│ │ │ │ - options = options || {};
│ │ │ │ - OpenLayers.Util.extend(this, options);
│ │ │ │ - this.options = options;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: mergeWithDefaultFilter
│ │ │ │ - * Merge filter passed to the read method with the default one
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * filter - {}
│ │ │ │ - */
│ │ │ │ - mergeWithDefaultFilter: function(filter) {
│ │ │ │ - var merged;
│ │ │ │ - if (filter && this.defaultFilter) {
│ │ │ │ - merged = new OpenLayers.Filter.Logical({
│ │ │ │ - type: OpenLayers.Filter.Logical.AND,
│ │ │ │ - filters: [this.defaultFilter, filter]
│ │ │ │ - });
│ │ │ │ - } else {
│ │ │ │ - merged = filter || this.defaultFilter || undefined;
│ │ │ │ - }
│ │ │ │ - return merged;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: destroy
│ │ │ │ - * Clean up the protocol.
│ │ │ │ - */
│ │ │ │ - destroy: function() {
│ │ │ │ - this.options = null;
│ │ │ │ - this.format = null;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: read
│ │ │ │ - * Construct a request for reading new features.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * options - {Object} Optional object for configuring the request.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {} An
│ │ │ │ - * object, the same object will be passed to the callback function passed
│ │ │ │ - * if one exists in the options object.
│ │ │ │ - */
│ │ │ │ - read: function(options) {
│ │ │ │ - options = options || {};
│ │ │ │ - options.filter = this.mergeWithDefaultFilter(options.filter);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: create
│ │ │ │ - * Construct a request for writing newly created features.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * features - {Array({})} or
│ │ │ │ - * {}
│ │ │ │ - * options - {Object} Optional object for configuring the request.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {} An
│ │ │ │ - * object, the same object will be passed to the callback function passed
│ │ │ │ - * if one exists in the options object.
│ │ │ │ - */
│ │ │ │ - create: function() {},
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: update
│ │ │ │ - * Construct a request updating modified features.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * features - {Array({})} or
│ │ │ │ - * {}
│ │ │ │ - * options - {Object} Optional object for configuring the request.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {} An
│ │ │ │ - * object, the same object will be passed to the callback function passed
│ │ │ │ - * if one exists in the options object.
│ │ │ │ - */
│ │ │ │ - update: function() {},
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: delete
│ │ │ │ - * Construct a request deleting a removed feature.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * feature - {}
│ │ │ │ - * options - {Object} Optional object for configuring the request.
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {} An
│ │ │ │ - * object, the same object will be passed to the callback function passed
│ │ │ │ - * if one exists in the options object.
│ │ │ │ - */
│ │ │ │ - "delete": function() {},
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: commit
│ │ │ │ - * Go over the features and for each take action
│ │ │ │ - * based on the feature state. Possible actions are create,
│ │ │ │ - * update and delete.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * features - {Array({})}
│ │ │ │ - * 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({})} An array of
│ │ │ │ - * objects.
│ │ │ │ - */
│ │ │ │ - commit: function() {},
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: abort
│ │ │ │ - * Abort an ongoing request.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * response - {}
│ │ │ │ - */
│ │ │ │ - abort: function(response) {},
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: createCallback
│ │ │ │ - * Returns a function that applies the given public method with resp and
│ │ │ │ - * options arguments.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * method - {Function} The method to be applied by the callback.
│ │ │ │ - * response - {} The protocol response object.
│ │ │ │ - * options - {Object} Options sent to the protocol method
│ │ │ │ - */
│ │ │ │ - createCallback: function(method, response, options) {
│ │ │ │ - return OpenLayers.Function.bind(function() {
│ │ │ │ - method.apply(this, [response, options]);
│ │ │ │ - }, this);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - CLASS_NAME: "OpenLayers.Protocol"
│ │ │ │ -});
│ │ │ │ -
│ │ │ │ -/**
│ │ │ │ - * Class: OpenLayers.Protocol.Response
│ │ │ │ - * Protocols return Response objects to their users.
│ │ │ │ - */
│ │ │ │ -OpenLayers.Protocol.Response = OpenLayers.Class({
│ │ │ │ - /**
│ │ │ │ - * Property: code
│ │ │ │ - * {Number} - OpenLayers.Protocol.Response.SUCCESS or
│ │ │ │ - * OpenLayers.Protocol.Response.FAILURE
│ │ │ │ - */
│ │ │ │ - code: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: requestType
│ │ │ │ - * {String} The type of request this response corresponds to. Either
│ │ │ │ - * "create", "read", "update" or "delete".
│ │ │ │ - */
│ │ │ │ - requestType: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: last
│ │ │ │ - * {Boolean} - true if this is the last response expected in a commit,
│ │ │ │ - * false otherwise, defaults to true.
│ │ │ │ - */
│ │ │ │ - last: true,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: features
│ │ │ │ - * {Array({})} or {}
│ │ │ │ - * The features returned in the response by the server. Depending on the
│ │ │ │ - * protocol's read payload, either features or data will be populated.
│ │ │ │ - */
│ │ │ │ - features: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: data
│ │ │ │ - * {Object}
│ │ │ │ - * The data returned in the response by the server. Depending on the
│ │ │ │ - * protocol's read payload, either features or data will be populated.
│ │ │ │ - */
│ │ │ │ - data: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: reqFeatures
│ │ │ │ - * {Array({})} or {}
│ │ │ │ - * The features provided by the user and placed in the request by the
│ │ │ │ - * protocol.
│ │ │ │ + /**
│ │ │ │ + * Property: active
│ │ │ │ + * {Boolean} The control is active.
│ │ │ │ */
│ │ │ │ - reqFeatures: null,
│ │ │ │ + active: null,
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Property: priv
│ │ │ │ + * 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.
│ │ │ │ */
│ │ │ │ - priv: null,
│ │ │ │ + autoActivate: true,
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Property: error
│ │ │ │ - * {Object} The error object in case a service exception was encountered.
│ │ │ │ + * Property: autoDestroy
│ │ │ │ + * {Boolean} The creator of the strategy can set autoDestroy to false
│ │ │ │ + * to fully control when the strategy is destroyed. Defaults to
│ │ │ │ + * true.
│ │ │ │ */
│ │ │ │ - error: null,
│ │ │ │ + autoDestroy: true,
│ │ │ │
│ │ │ │ /**
│ │ │ │ - * Constructor: OpenLayers.Protocol.Response
│ │ │ │ + * 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);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: success
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Boolean} - true on success, false otherwise
│ │ │ │ - */
│ │ │ │ - success: function() {
│ │ │ │ - return this.code > 0;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - CLASS_NAME: "OpenLayers.Protocol.Response"
│ │ │ │ -});
│ │ │ │ -
│ │ │ │ -OpenLayers.Protocol.Response.SUCCESS = 1;
│ │ │ │ -OpenLayers.Protocol.Response.FAILURE = 0;
│ │ │ │ -/* ======================================================================
│ │ │ │ - OpenLayers/Renderer.js
│ │ │ │ - ====================================================================== */
│ │ │ │ -
│ │ │ │ -/* 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.Renderer
│ │ │ │ - * This is the base class for all renderers.
│ │ │ │ - *
│ │ │ │ - * This is based on a merger code written by Paul Spencer and Bertil Chapuis.
│ │ │ │ - * It is largely composed of virtual functions that are to be implemented
│ │ │ │ - * in technology-specific subclasses, but there is some generic code too.
│ │ │ │ - *
│ │ │ │ - * The functions that *are* implemented here merely deal with the maintenance
│ │ │ │ - * of the size and extent variables, as well as the cached 'resolution'
│ │ │ │ - * value.
│ │ │ │ - *
│ │ │ │ - * A note to the user that all subclasses should use getResolution() instead
│ │ │ │ - * of directly accessing this.resolution in order to correctly use the
│ │ │ │ - * cacheing system.
│ │ │ │ - *
│ │ │ │ - */
│ │ │ │ -OpenLayers.Renderer = OpenLayers.Class({
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: container
│ │ │ │ - * {DOMElement}
│ │ │ │ - */
│ │ │ │ - container: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: root
│ │ │ │ - * {DOMElement}
│ │ │ │ - */
│ │ │ │ - root: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: extent
│ │ │ │ - * {}
│ │ │ │ - */
│ │ │ │ - extent: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: locked
│ │ │ │ - * {Boolean} If the renderer is currently in a state where many things
│ │ │ │ - * are changing, the 'locked' property is set to true. This means
│ │ │ │ - * that renderers can expect at least one more drawFeature event to be
│ │ │ │ - * called with the 'locked' property set to 'true': In some renderers,
│ │ │ │ - * this might make sense to use as a 'only update local information'
│ │ │ │ - * flag.
│ │ │ │ - */
│ │ │ │ - locked: false,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: size
│ │ │ │ - * {}
│ │ │ │ - */
│ │ │ │ - size: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: resolution
│ │ │ │ - * {Float} cache of current map resolution
│ │ │ │ - */
│ │ │ │ - resolution: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: map
│ │ │ │ - * {} Reference to the map -- this is set in Vector's setMap()
│ │ │ │ - */
│ │ │ │ - map: null,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Property: featureDx
│ │ │ │ - * {Number} Feature offset in x direction. Will be calculated for and
│ │ │ │ - * applied to the current feature while rendering (see
│ │ │ │ - * ).
│ │ │ │ - */
│ │ │ │ - featureDx: 0,
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Constructor: OpenLayers.Renderer
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * containerID - {}
│ │ │ │ - * options - {Object} options for this renderer. See sublcasses for
│ │ │ │ - * supported options.
│ │ │ │ - */
│ │ │ │ - initialize: function(containerID, options) {
│ │ │ │ - this.container = OpenLayers.Util.getElement(containerID);
│ │ │ │ - OpenLayers.Util.extend(this, options);
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: destroy
│ │ │ │ - */
│ │ │ │ - destroy: function() {
│ │ │ │ - this.container = null;
│ │ │ │ - this.extent = null;
│ │ │ │ - this.size = null;
│ │ │ │ - this.resolution = null;
│ │ │ │ - this.map = null;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * APIMethod: supported
│ │ │ │ - * This should be overridden by specific subclasses
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Boolean} Whether or not the browser supports the renderer class
│ │ │ │ - */
│ │ │ │ - supported: function() {
│ │ │ │ - return false;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: setExtent
│ │ │ │ - * Set the visible part of the layer.
│ │ │ │ - *
│ │ │ │ - * Resolution has probably changed, so we nullify the resolution
│ │ │ │ - * cache (this.resolution) -- this way it will be re-computed when
│ │ │ │ - * next it is needed.
│ │ │ │ - * We nullify the resolution cache (this.resolution) if resolutionChanged
│ │ │ │ - * is set to true - this way it will be re-computed on the next
│ │ │ │ - * getResolution() request.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * extent - {}
│ │ │ │ - * resolutionChanged - {Boolean}
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Boolean} true to notify the layer that the new extent does not exceed
│ │ │ │ - * the coordinate range, and the features will not need to be redrawn.
│ │ │ │ - * False otherwise.
│ │ │ │ - */
│ │ │ │ - setExtent: function(extent, resolutionChanged) {
│ │ │ │ - this.extent = extent.clone();
│ │ │ │ - if (this.map.baseLayer && this.map.baseLayer.wrapDateLine) {
│ │ │ │ - var ratio = extent.getWidth() / this.map.getExtent().getWidth(),
│ │ │ │ - extent = extent.scale(1 / ratio);
│ │ │ │ - this.extent = extent.wrapDateLine(this.map.getMaxExtent()).scale(ratio);
│ │ │ │ - }
│ │ │ │ - if (resolutionChanged) {
│ │ │ │ - this.resolution = null;
│ │ │ │ - }
│ │ │ │ - return true;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: setSize
│ │ │ │ - * Sets the size of the drawing surface.
│ │ │ │ - *
│ │ │ │ - * Resolution has probably changed, so we nullify the resolution
│ │ │ │ - * cache (this.resolution) -- this way it will be re-computed when
│ │ │ │ - * next it is needed.
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * size - {}
│ │ │ │ - */
│ │ │ │ - setSize: function(size) {
│ │ │ │ - this.size = size.clone();
│ │ │ │ - this.resolution = null;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: getResolution
│ │ │ │ - * Uses cached copy of resolution if available to minimize computing
│ │ │ │ - *
│ │ │ │ - * Returns:
│ │ │ │ - * {Float} The current map's resolution
│ │ │ │ - */
│ │ │ │ - getResolution: function() {
│ │ │ │ - this.resolution = this.resolution || this.map.getResolution();
│ │ │ │ - return this.resolution;
│ │ │ │ - },
│ │ │ │ -
│ │ │ │ - /**
│ │ │ │ - * Method: drawFeature
│ │ │ │ - * Draw the feature. The optional style argument can be used
│ │ │ │ - * to override the feature's own style. This method should only
│ │ │ │ - * be called from layer.drawFeature().
│ │ │ │ - *
│ │ │ │ - * Parameters:
│ │ │ │ - * feature - {}
│ │ │ │ - * style - {