Merge pull request #23 from albig/master
Add Typeswitch for DFG-Viewer, Update OpenLayers
This commit is contained in:
commit
0e3c0f18fd
|
@ -56,7 +56,8 @@ return array (
|
||||||
'tx_dlf_toc' => $extensionPath.'plugins/toc/class.tx_dlf_toc.php',
|
'tx_dlf_toc' => $extensionPath.'plugins/toc/class.tx_dlf_toc.php',
|
||||||
'tx_dlf_toolbox' => $extensionPath.'plugins/toolbox/class.tx_dlf_toolbox.php',
|
'tx_dlf_toolbox' => $extensionPath.'plugins/toolbox/class.tx_dlf_toolbox.php',
|
||||||
'tx_dlf_toolsPdf' => $extensionPath.'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php',
|
'tx_dlf_toolsPdf' => $extensionPath.'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php',
|
||||||
'tx_dlf_validator' => $extensionPath.'plugins/validator/class.tx_dlf_validator.php'
|
'tx_dlf_validator' => $extensionPath.'plugins/validator/class.tx_dlf_validator.php',
|
||||||
|
'tx_dlf_doctype' => $extensionPath.'plugins/doctype/class.tx_dlf_doctype.php'
|
||||||
);
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -39,7 +39,7 @@ $EM_CONF[$_EXTKEY] = array(
|
||||||
'modify_tables' => '',
|
'modify_tables' => '',
|
||||||
'clearCacheOnLoad' => FALSE,
|
'clearCacheOnLoad' => FALSE,
|
||||||
'lockType' => '',
|
'lockType' => '',
|
||||||
'version' => '1.2.2-dev',
|
'version' => '1.3.0',
|
||||||
'constraints' => array(
|
'constraints' => array(
|
||||||
'depends' => array(
|
'depends' => array(
|
||||||
'php' => '5.3.0-',
|
'php' => '5.3.0-',
|
||||||
|
|
|
@ -68,4 +68,55 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['cliKeys'][$_EXTKEY] = array
|
||||||
|
|
||||||
// Register AJAX eID handlers.
|
// Register AJAX eID handlers.
|
||||||
$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_suggest'] = 'EXT:'.$_EXTKEY.'/plugins/search/class.tx_dlf_search_suggest.php';
|
$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tx_dlf_search_suggest'] = 'EXT:'.$_EXTKEY.'/plugins/search/class.tx_dlf_search_suggest.php';
|
||||||
|
|
||||||
|
|
||||||
|
if (TYPO3_MODE === 'FE') {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* docType user function to use in typoscript:
|
||||||
|
*
|
||||||
|
* STORAGEID: uid of dlf storage folder
|
||||||
|
* DOCTYPE: document type string to test
|
||||||
|
*
|
||||||
|
* [userFunc = user_dlf_docTypeCheck(STORAGEID:DOCTYPE)]
|
||||||
|
*
|
||||||
|
* do something different
|
||||||
|
*
|
||||||
|
* [global]
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
function user_dlf_docTypeCheck($cmd) {
|
||||||
|
|
||||||
|
// we have to split the cmd as we cannot have two parameters.
|
||||||
|
// this changed in TYPO3 6.2
|
||||||
|
$pidCondition = explode(':', $cmd);
|
||||||
|
|
||||||
|
$conf['pages'] = $pidCondition[0];
|
||||||
|
|
||||||
|
$docType = t3lib_div::makeInstance('tx_dlf_doctype');
|
||||||
|
|
||||||
|
switch($pidCondition[1]){
|
||||||
|
case "periodical":
|
||||||
|
if ($docType->main($cObj, $conf) === "periodical")
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
|
case "newspaper_global_anchor":
|
||||||
|
if ($docType->main($cObj, $conf) === "newspaper_global_anchor")
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
|
case "newspaper_year_anchor":
|
||||||
|
if ($docType->main($cObj, $conf) === "newspaper_year_anchor")
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
|
case "newspaper_issue":
|
||||||
|
if ($docType->main($cObj, $conf) === "newspaper_issue")
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
|
default : return FALSE;
|
||||||
|
}
|
||||||
|
// this function has to return FALSE or TRUE nothing else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -7,7 +7,7 @@ Seb Benthall
|
||||||
Bruno Binet
|
Bruno Binet
|
||||||
Stéphane Brunner
|
Stéphane Brunner
|
||||||
Howard Butler
|
Howard Butler
|
||||||
Bertil Chaupis
|
Bertil Chaupis
|
||||||
John Cole
|
John Cole
|
||||||
Tim Coulter
|
Tim Coulter
|
||||||
Robert Coup
|
Robert Coup
|
||||||
|
@ -32,10 +32,10 @@ Peter William Robins
|
||||||
Gregers Rygg
|
Gregers Rygg
|
||||||
Tim Schaub
|
Tim Schaub
|
||||||
Christopher Schmidt
|
Christopher Schmidt
|
||||||
Cameron Shorter
|
Cameron Shorter
|
||||||
Pedro Simonetti
|
Pedro Simonetti
|
||||||
Paul Spencer
|
Paul Spencer
|
||||||
Paul Smith
|
Paul Smith
|
||||||
Glen Stampoultzis
|
Glen Stampoultzis
|
||||||
James Stembridge
|
James Stembridge
|
||||||
Erik Uzureau
|
Erik Uzureau
|
||||||
|
@ -47,10 +47,10 @@ Steve Woodbridge
|
||||||
David Zwarg
|
David Zwarg
|
||||||
|
|
||||||
Some portions of OpenLayers are used under the Apache 2.0 license, available
|
Some portions of OpenLayers are used under the Apache 2.0 license, available
|
||||||
in licenses/APACHE-2.0.txt.
|
in doc/licenses/APACHE-2.0.txt.
|
||||||
|
|
||||||
Some portions of OpenLayers are used under the MIT license, available in
|
Some portions of OpenLayers are used under the MIT license, availabie in
|
||||||
licenses/MIT-LICENSE.txt.
|
doc/licenses/MIT-LICENSE.txt.
|
||||||
|
|
||||||
Some portions of OpenLayers are Copyright 2001 Robert Penner, and are used
|
Some portions of OpenLayers are Copyright 2001 Robert Penner, and are used
|
||||||
under the BSD license, available in licenses/BSD-LICENSE.txt
|
under the BSD license, available in doc/licenses/BSD-LICENSE.txt
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -132,6 +132,7 @@
|
||||||
jsFiles = [
|
jsFiles = [
|
||||||
"OpenLayers/BaseTypes/Class.js",
|
"OpenLayers/BaseTypes/Class.js",
|
||||||
"OpenLayers/Util.js",
|
"OpenLayers/Util.js",
|
||||||
|
"OpenLayers/Util/vendorPrefix.js",
|
||||||
"OpenLayers/Animation.js",
|
"OpenLayers/Animation.js",
|
||||||
"OpenLayers/BaseTypes.js",
|
"OpenLayers/BaseTypes.js",
|
||||||
"OpenLayers/BaseTypes/Bounds.js",
|
"OpenLayers/BaseTypes/Bounds.js",
|
||||||
|
@ -143,10 +144,9 @@
|
||||||
"OpenLayers/Console.js",
|
"OpenLayers/Console.js",
|
||||||
"OpenLayers/Tween.js",
|
"OpenLayers/Tween.js",
|
||||||
"OpenLayers/Kinetic.js",
|
"OpenLayers/Kinetic.js",
|
||||||
"Rico/Corner.js",
|
|
||||||
"Rico/Color.js",
|
|
||||||
"OpenLayers/Events.js",
|
"OpenLayers/Events.js",
|
||||||
"OpenLayers/Events/buttonclick.js",
|
"OpenLayers/Events/buttonclick.js",
|
||||||
|
"OpenLayers/Events/featureclick.js",
|
||||||
"OpenLayers/Request.js",
|
"OpenLayers/Request.js",
|
||||||
"OpenLayers/Request/XMLHttpRequest.js",
|
"OpenLayers/Request/XMLHttpRequest.js",
|
||||||
"OpenLayers/Projection.js",
|
"OpenLayers/Projection.js",
|
||||||
|
@ -190,7 +190,6 @@
|
||||||
"OpenLayers/Layer/Zoomify.js",
|
"OpenLayers/Layer/Zoomify.js",
|
||||||
"OpenLayers/Layer/ArcGISCache.js",
|
"OpenLayers/Layer/ArcGISCache.js",
|
||||||
"OpenLayers/Popup/Anchored.js",
|
"OpenLayers/Popup/Anchored.js",
|
||||||
"OpenLayers/Popup/AnchoredBubble.js",
|
|
||||||
"OpenLayers/Popup/Framed.js",
|
"OpenLayers/Popup/Framed.js",
|
||||||
"OpenLayers/Popup/FramedCloud.js",
|
"OpenLayers/Popup/FramedCloud.js",
|
||||||
"OpenLayers/Feature.js",
|
"OpenLayers/Feature.js",
|
||||||
|
@ -305,6 +304,7 @@
|
||||||
"OpenLayers/Format/GML/v2.js",
|
"OpenLayers/Format/GML/v2.js",
|
||||||
"OpenLayers/Format/GML/v3.js",
|
"OpenLayers/Format/GML/v3.js",
|
||||||
"OpenLayers/Format/Atom.js",
|
"OpenLayers/Format/Atom.js",
|
||||||
|
"OpenLayers/Format/EncodedPolyline.js",
|
||||||
"OpenLayers/Format/KML.js",
|
"OpenLayers/Format/KML.js",
|
||||||
"OpenLayers/Format/GeoRSS.js",
|
"OpenLayers/Format/GeoRSS.js",
|
||||||
"OpenLayers/Format/WFS.js",
|
"OpenLayers/Format/WFS.js",
|
||||||
|
@ -312,6 +312,10 @@
|
||||||
"OpenLayers/Format/OWSCommon/v1.js",
|
"OpenLayers/Format/OWSCommon/v1.js",
|
||||||
"OpenLayers/Format/OWSCommon/v1_0_0.js",
|
"OpenLayers/Format/OWSCommon/v1_0_0.js",
|
||||||
"OpenLayers/Format/OWSCommon/v1_1_0.js",
|
"OpenLayers/Format/OWSCommon/v1_1_0.js",
|
||||||
|
"OpenLayers/Format/WCSCapabilities.js",
|
||||||
|
"OpenLayers/Format/WCSCapabilities/v1.js",
|
||||||
|
"OpenLayers/Format/WCSCapabilities/v1_0_0.js",
|
||||||
|
"OpenLayers/Format/WCSCapabilities/v1_1_0.js",
|
||||||
"OpenLayers/Format/WFSCapabilities.js",
|
"OpenLayers/Format/WFSCapabilities.js",
|
||||||
"OpenLayers/Format/WFSCapabilities/v1.js",
|
"OpenLayers/Format/WFSCapabilities/v1.js",
|
||||||
"OpenLayers/Format/WFSCapabilities/v1_0_0.js",
|
"OpenLayers/Format/WFSCapabilities/v1_0_0.js",
|
||||||
|
@ -393,7 +397,10 @@
|
||||||
"OpenLayers/Symbolizer/Raster.js",
|
"OpenLayers/Symbolizer/Raster.js",
|
||||||
"OpenLayers/Lang.js",
|
"OpenLayers/Lang.js",
|
||||||
"OpenLayers/Lang/en.js",
|
"OpenLayers/Lang/en.js",
|
||||||
"OpenLayers/Spherical.js"
|
"OpenLayers/Spherical.js",
|
||||||
|
"OpenLayers/TileManager.js",
|
||||||
|
"OpenLayers/WPSClient.js",
|
||||||
|
"OpenLayers/WPSProcess.js"
|
||||||
]; // etc.
|
]; // etc.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,5 +420,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant: VERSION_NUMBER
|
* Constant: VERSION_NUMBER
|
||||||
|
*
|
||||||
|
* This constant identifies the version of OpenLayers.
|
||||||
|
*
|
||||||
|
* When asking questions or reporting issues, make sure to include the output of
|
||||||
|
* OpenLayers.VERSION_NUMBER in the question or issue-description.
|
||||||
*/
|
*/
|
||||||
OpenLayers.VERSION_NUMBER="Release 2.12";
|
OpenLayers.VERSION_NUMBER="Release 2.13.1";
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
/**
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license.
|
* full text of the license. */
|
||||||
*
|
|
||||||
|
/**
|
||||||
* @requires OpenLayers/SingleFile.js
|
* @requires OpenLayers/SingleFile.js
|
||||||
|
* @requires OpenLayers/Util/vendorPrefix.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,11 +20,8 @@ OpenLayers.Animation = (function(window) {
|
||||||
* Property: isNative
|
* Property: isNative
|
||||||
* {Boolean} true if a native requestAnimationFrame function is available
|
* {Boolean} true if a native requestAnimationFrame function is available
|
||||||
*/
|
*/
|
||||||
var isNative = !!(window.requestAnimationFrame ||
|
var requestAnimationFrame = OpenLayers.Util.vendorPrefix.js(window, "requestAnimationFrame");
|
||||||
window.webkitRequestAnimationFrame ||
|
var isNative = !!(requestAnimationFrame);
|
||||||
window.mozRequestAnimationFrame ||
|
|
||||||
window.oRequestAnimationFrame ||
|
|
||||||
window.msRequestAnimationFrame);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function: requestFrame
|
* Function: requestFrame
|
||||||
|
@ -36,11 +34,7 @@ OpenLayers.Animation = (function(window) {
|
||||||
* element - {DOMElement} Optional element that visually bounds the animation.
|
* element - {DOMElement} Optional element that visually bounds the animation.
|
||||||
*/
|
*/
|
||||||
var requestFrame = (function() {
|
var requestFrame = (function() {
|
||||||
var request = window.requestAnimationFrame ||
|
var request = window[requestAnimationFrame] ||
|
||||||
window.webkitRequestAnimationFrame ||
|
|
||||||
window.mozRequestAnimationFrame ||
|
|
||||||
window.oRequestAnimationFrame ||
|
|
||||||
window.msRequestAnimationFrame ||
|
|
||||||
function(callback, element) {
|
function(callback, element) {
|
||||||
window.setTimeout(callback, 16);
|
window.setTimeout(callback, 16);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -127,7 +127,9 @@ OpenLayers.String = {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
replacement = context;
|
replacement = context;
|
||||||
}
|
}
|
||||||
|
if (replacement === undefined) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
replacement = replacement[subs[i]];
|
replacement = replacement[subs[i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,13 +191,18 @@ OpenLayers.String = {
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* value - {String}
|
* value - {String}
|
||||||
|
* trimWhitespace - {Boolean}
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {Number|String} a Number if the passed value is a number, a String
|
* {Number|String} a Number if the passed value is a number, a String
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
numericIf: function(value) {
|
numericIf: function(value, trimWhitespace) {
|
||||||
return OpenLayers.String.isNumeric(value) ? parseFloat(value) : value;
|
var originalValue = value;
|
||||||
|
if (trimWhitespace === true && value != null && value.replace) {
|
||||||
|
value = value.replace(/^\s*|\s*$/g, "");
|
||||||
|
}
|
||||||
|
return OpenLayers.String.isNumeric(value) ? parseFloat(value) : originalValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -290,7 +297,25 @@ OpenLayers.Number = {
|
||||||
str = integer + dsep + rem;
|
str = integer + dsep + rem;
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: zeroPad
|
||||||
|
* Create a zero padded string optionally with a radix for casting numbers.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* num - {Number} The number to be zero padded.
|
||||||
|
* len - {Number} The length of the string to be returned.
|
||||||
|
* radix - {Number} An integer between 2 and 36 specifying the base to use
|
||||||
|
* for representing numeric values.
|
||||||
|
*/
|
||||||
|
zeroPad: function(num, len, radix) {
|
||||||
|
var str = num.toString(radix || 10);
|
||||||
|
while (str.length < len) {
|
||||||
|
str = "0" + str;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -63,7 +63,7 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
* left - {Number} The left bounds of the box. Note that for width
|
* left - {Number} The left bounds of the box. Note that for width
|
||||||
* calculations, this is assumed to be less than the right value.
|
* calculations, this is assumed to be less than the right value.
|
||||||
* bottom - {Number} The bottom bounds of the box. Note that for height
|
* bottom - {Number} The bottom bounds of the box. Note that for height
|
||||||
* calculations, this is assumed to be more than the top value.
|
* calculations, this is assumed to be less than the top value.
|
||||||
* right - {Number} The right bounds.
|
* right - {Number} The right bounds.
|
||||||
* top - {Number} The top bounds.
|
* top - {Number} The top bounds.
|
||||||
*
|
*
|
||||||
|
@ -128,6 +128,7 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: toString
|
* APIMethod: toString
|
||||||
|
* Returns a string representation of the bounds object.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {String} String representation of bounds object.
|
* {String} String representation of bounds object.
|
||||||
|
@ -138,6 +139,11 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: toArray
|
* APIMethod: toArray
|
||||||
|
* Returns an array representation of the bounds object.
|
||||||
|
*
|
||||||
|
* Returns an array of left, bottom, right, top properties, or -- when the
|
||||||
|
* optional parameter is true -- an array of the bottom, left, top,
|
||||||
|
* right properties.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* reverseAxisOrder - {Boolean} Should we reverse the axis order?
|
* reverseAxisOrder - {Boolean} Should we reverse the axis order?
|
||||||
|
@ -155,6 +161,7 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: toBBOX
|
* APIMethod: toBBOX
|
||||||
|
* Returns a boundingbox-string representation of the bounds object.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* decimal - {Integer} How many significant digits in the bbox coords?
|
* decimal - {Integer} How many significant digits in the bbox coords?
|
||||||
|
@ -163,7 +170,7 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {String} Simple String representation of bounds object.
|
* {String} Simple String representation of bounds object.
|
||||||
* (e.g. <i>"5,42,10,45"</i>)
|
* (e.g. "5,42,10,45")
|
||||||
*/
|
*/
|
||||||
toBBOX:function(decimal, reverseAxisOrder) {
|
toBBOX:function(decimal, reverseAxisOrder) {
|
||||||
if (decimal== null) {
|
if (decimal== null) {
|
||||||
|
@ -202,9 +209,10 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: getWidth
|
* APIMethod: getWidth
|
||||||
|
* Returns the width of the bounds.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {Float} The width of the bounds
|
* {Float} The width of the bounds (right minus left).
|
||||||
*/
|
*/
|
||||||
getWidth:function() {
|
getWidth:function() {
|
||||||
return (this.right - this.left);
|
return (this.right - this.left);
|
||||||
|
@ -212,6 +220,7 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: getHeight
|
* APIMethod: getHeight
|
||||||
|
* Returns the height of the bounds.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {Float} The height of the bounds (top minus bottom).
|
* {Float} The height of the bounds (top minus bottom).
|
||||||
|
@ -222,9 +231,10 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: getSize
|
* APIMethod: getSize
|
||||||
|
* Returns an <OpenLayers.Size> object of the bounds.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {<OpenLayers.Size>} The size of the box.
|
* {<OpenLayers.Size>} The size of the bounds.
|
||||||
*/
|
*/
|
||||||
getSize:function() {
|
getSize:function() {
|
||||||
return new OpenLayers.Size(this.getWidth(), this.getHeight());
|
return new OpenLayers.Size(this.getWidth(), this.getHeight());
|
||||||
|
@ -232,6 +242,8 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: getCenterPixel
|
* APIMethod: getCenterPixel
|
||||||
|
* Returns the <OpenLayers.Pixel> object which represents the center of the
|
||||||
|
* bounds.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {<OpenLayers.Pixel>} The center of the bounds in pixel space.
|
* {<OpenLayers.Pixel>} The center of the bounds in pixel space.
|
||||||
|
@ -243,7 +255,9 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: getCenterLonLat
|
* APIMethod: getCenterLonLat
|
||||||
*
|
* Returns the <OpenLayers.LonLat> object which represents the center of the
|
||||||
|
* bounds.
|
||||||
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {<OpenLayers.LonLat>} The center of the bounds in map space.
|
* {<OpenLayers.LonLat>} The center of the bounds in map space.
|
||||||
*/
|
*/
|
||||||
|
@ -297,11 +311,24 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: add
|
* APIMethod: add
|
||||||
*
|
* Shifts the coordinates of the bound by the given horizontal and vertical
|
||||||
|
* deltas.
|
||||||
|
*
|
||||||
|
* (start code)
|
||||||
|
* var bounds = new OpenLayers.Bounds(0, 0, 10, 10);
|
||||||
|
* bounds.toString();
|
||||||
|
* // => "0,0,10,10"
|
||||||
|
*
|
||||||
|
* bounds.add(-1.5, 4).toString();
|
||||||
|
* // => "-1.5,4,8.5,14"
|
||||||
|
* (end)
|
||||||
|
*
|
||||||
|
* This method will throw a TypeError if it is passed null as an argument.
|
||||||
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* x - {Float}
|
* x - {Float} horizontal delta
|
||||||
* y - {Float}
|
* y - {Float} vertical delta
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {<OpenLayers.Bounds>} A new bounds whose coordinates are the same as
|
* {<OpenLayers.Bounds>} A new bounds whose coordinates are the same as
|
||||||
* this, but shifted by the passed-in x and y values.
|
* this, but shifted by the passed-in x and y values.
|
||||||
|
@ -316,51 +343,77 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: extend
|
* APIMethod: extend
|
||||||
* Extend the bounds to include the point, lonlat, or bounds specified.
|
* Extend the bounds to include the <OpenLayers.LonLat>,
|
||||||
* Note, this function assumes that left < right and bottom < top.
|
* <OpenLayers.Geometry.Point> or <OpenLayers.Bounds> specified.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Please note that this function assumes that left < right and
|
||||||
* object - {Object} Can be LonLat, Point, or Bounds
|
* bottom < top.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* object - {<OpenLayers.LonLat>, <OpenLayers.Geometry.Point> or
|
||||||
|
* <OpenLayers.Bounds>} The object to be included in the new bounds
|
||||||
|
* object.
|
||||||
*/
|
*/
|
||||||
extend:function(object) {
|
extend:function(object) {
|
||||||
var bounds = null;
|
|
||||||
if (object) {
|
if (object) {
|
||||||
// clear cached center location
|
|
||||||
switch(object.CLASS_NAME) {
|
switch(object.CLASS_NAME) {
|
||||||
case "OpenLayers.LonLat":
|
case "OpenLayers.LonLat":
|
||||||
bounds = new OpenLayers.Bounds(object.lon, object.lat,
|
this.extendXY(object.lon, object.lat);
|
||||||
object.lon, object.lat);
|
|
||||||
break;
|
break;
|
||||||
case "OpenLayers.Geometry.Point":
|
case "OpenLayers.Geometry.Point":
|
||||||
bounds = new OpenLayers.Bounds(object.x, object.y,
|
this.extendXY(object.x, object.y);
|
||||||
object.x, object.y);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "OpenLayers.Bounds":
|
case "OpenLayers.Bounds":
|
||||||
bounds = object;
|
// clear cached center location
|
||||||
|
this.centerLonLat = null;
|
||||||
|
|
||||||
|
if ( (this.left == null) || (object.left < this.left)) {
|
||||||
|
this.left = object.left;
|
||||||
|
}
|
||||||
|
if ( (this.bottom == null) || (object.bottom < this.bottom) ) {
|
||||||
|
this.bottom = object.bottom;
|
||||||
|
}
|
||||||
|
if ( (this.right == null) || (object.right > this.right) ) {
|
||||||
|
this.right = object.right;
|
||||||
|
}
|
||||||
|
if ( (this.top == null) || (object.top > this.top) ) {
|
||||||
|
this.top = object.top;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (bounds) {
|
},
|
||||||
this.centerLonLat = null;
|
|
||||||
if ( (this.left == null) || (bounds.left < this.left)) {
|
/**
|
||||||
this.left = bounds.left;
|
* APIMethod: extendXY
|
||||||
}
|
* Extend the bounds to include the XY coordinate specified.
|
||||||
if ( (this.bottom == null) || (bounds.bottom < this.bottom) ) {
|
*
|
||||||
this.bottom = bounds.bottom;
|
* Parameters:
|
||||||
}
|
* x - {number} The X part of the the coordinate.
|
||||||
if ( (this.right == null) || (bounds.right > this.right) ) {
|
* y - {number} The Y part of the the coordinate.
|
||||||
this.right = bounds.right;
|
*/
|
||||||
}
|
extendXY:function(x, y) {
|
||||||
if ( (this.top == null) || (bounds.top > this.top) ) {
|
// clear cached center location
|
||||||
this.top = bounds.top;
|
this.centerLonLat = null;
|
||||||
}
|
|
||||||
}
|
if ((this.left == null) || (x < this.left)) {
|
||||||
|
this.left = x;
|
||||||
|
}
|
||||||
|
if ((this.bottom == null) || (y < this.bottom)) {
|
||||||
|
this.bottom = y;
|
||||||
|
}
|
||||||
|
if ((this.right == null) || (x > this.right)) {
|
||||||
|
this.right = x;
|
||||||
|
}
|
||||||
|
if ((this.top == null) || (y > this.top)) {
|
||||||
|
this.top = y;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: containsLonLat
|
* APIMethod: containsLonLat
|
||||||
|
* Returns whether the bounds object contains the given <OpenLayers.LonLat>.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ll - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
|
* ll - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
|
||||||
|
@ -399,6 +452,7 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: containsPixel
|
* APIMethod: containsPixel
|
||||||
|
* Returns whether the bounds object contains the given <OpenLayers.Pixel>.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* px - {<OpenLayers.Pixel>}
|
* px - {<OpenLayers.Pixel>}
|
||||||
|
@ -414,6 +468,7 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: contains
|
* APIMethod: contains
|
||||||
|
* Returns whether the bounds object contains the given x and y.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* x - {Float}
|
* x - {Float}
|
||||||
|
@ -535,7 +590,7 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: containsBounds
|
* APIMethod: containsBounds
|
||||||
* Determine whether the target bounds is contained within this bounds.
|
* Returns whether the bounds object contains the given <OpenLayers.Bounds>.
|
||||||
*
|
*
|
||||||
* bounds - {<OpenLayers.Bounds>} The target bounds.
|
* bounds - {<OpenLayers.Bounds>} The target bounds.
|
||||||
* partial - {Boolean} If any of the target corners is within this bounds
|
* partial - {Boolean} If any of the target corners is within this bounds
|
||||||
|
@ -565,10 +620,12 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: determineQuadrant
|
* APIMethod: determineQuadrant
|
||||||
*
|
* Returns the the quadrant ("br", "tr", "tl", "bl") in which the given
|
||||||
|
* <OpenLayers.LonLat> lies.
|
||||||
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* lonlat - {<OpenLayers.LonLat>}
|
* lonlat - {<OpenLayers.LonLat>}
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {String} The quadrant ("br" "tr" "tl" "bl") of the bounds in which the
|
* {String} The quadrant ("br" "tr" "tl" "bl") of the bounds in which the
|
||||||
* coordinate lies.
|
* coordinate lies.
|
||||||
|
@ -615,6 +672,7 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: wrapDateLine
|
* APIMethod: wrapDateLine
|
||||||
|
* Wraps the bounds object around the dateline.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* maxExtent - {<OpenLayers.Bounds>}
|
* maxExtent - {<OpenLayers.Bounds>}
|
||||||
|
@ -681,12 +739,18 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||||
/**
|
/**
|
||||||
* APIFunction: fromString
|
* APIFunction: fromString
|
||||||
* Alternative constructor that builds a new OpenLayers.Bounds from a
|
* Alternative constructor that builds a new OpenLayers.Bounds from a
|
||||||
* parameter string
|
* parameter string.
|
||||||
*
|
*
|
||||||
|
* (begin code)
|
||||||
|
* OpenLayers.Bounds.fromString("5,42,10,45");
|
||||||
|
* // => equivalent to ...
|
||||||
|
* new OpenLayers.Bounds(5, 42, 10, 45);
|
||||||
|
* (end)
|
||||||
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* str - {String}Comma-separated bounds string. (e.g. <i>"5,42,10,45"</i>)
|
* str - {String} Comma-separated bounds string. (e.g. "5,42,10,45")
|
||||||
* reverseAxisOrder - {Boolean} Does the string use reverse axis order?
|
* reverseAxisOrder - {Boolean} Does the string use reverse axis order?
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {<OpenLayers.Bounds>} New bounds object built from the
|
* {<OpenLayers.Bounds>} New bounds object built from the
|
||||||
* passed-in String.
|
* passed-in String.
|
||||||
|
@ -698,11 +762,16 @@ OpenLayers.Bounds.fromString = function(str, reverseAxisOrder) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIFunction: fromArray
|
* APIFunction: fromArray
|
||||||
* Alternative constructor that builds a new OpenLayers.Bounds
|
* Alternative constructor that builds a new OpenLayers.Bounds from an array.
|
||||||
* from an array
|
*
|
||||||
*
|
* (begin code)
|
||||||
|
* OpenLayers.Bounds.fromArray( [5, 42, 10, 45] );
|
||||||
|
* // => equivalent to ...
|
||||||
|
* new OpenLayers.Bounds(5, 42, 10, 45);
|
||||||
|
* (end)
|
||||||
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* bbox - {Array(Float)} Array of bounds values (e.g. <i>[5,42,10,45]</i>)
|
* bbox - {Array(Float)} Array of bounds values (e.g. [5,42,10,45])
|
||||||
* reverseAxisOrder - {Boolean} Does the array use reverse axis order?
|
* reverseAxisOrder - {Boolean} Does the array use reverse axis order?
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
|
@ -716,12 +785,17 @@ OpenLayers.Bounds.fromArray = function(bbox, reverseAxisOrder) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIFunction: fromSize
|
* APIFunction: fromSize
|
||||||
* Alternative constructor that builds a new OpenLayers.Bounds
|
* Alternative constructor that builds a new OpenLayers.Bounds from a size.
|
||||||
* from a size
|
*
|
||||||
*
|
* (begin code)
|
||||||
|
* OpenLayers.Bounds.fromSize( new OpenLayers.Size(10, 20) );
|
||||||
|
* // => equivalent to ...
|
||||||
|
* new OpenLayers.Bounds(0, 20, 10, 0);
|
||||||
|
* (end)
|
||||||
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* size - {<OpenLayers.Size>|Object} OpenLayers.Size or an object with
|
* size - {<OpenLayers.Size> or Object} <OpenLayers.Size> or an object with
|
||||||
* a 'w' and 'h' properties.
|
* both 'w' and 'h' properties.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {<OpenLayers.Bounds>} New bounds object built from the passed-in size.
|
* {<OpenLayers.Bounds>} New bounds object built from the passed-in size.
|
||||||
|
@ -737,6 +811,14 @@ OpenLayers.Bounds.fromSize = function(size) {
|
||||||
* Function: oppositeQuadrant
|
* Function: oppositeQuadrant
|
||||||
* Get the opposite quadrant for a given quadrant string.
|
* Get the opposite quadrant for a given quadrant string.
|
||||||
*
|
*
|
||||||
|
* (begin code)
|
||||||
|
* OpenLayers.Bounds.oppositeQuadrant( "tl" );
|
||||||
|
* // => "br"
|
||||||
|
*
|
||||||
|
* OpenLayers.Bounds.oppositeQuadrant( "tr" );
|
||||||
|
* // => "bl"
|
||||||
|
* (end)
|
||||||
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* quadrant - {String} two character quadrant shortstring
|
* quadrant - {String} two character quadrant shortstring
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -15,6 +15,14 @@
|
||||||
*/
|
*/
|
||||||
OpenLayers.Date = {
|
OpenLayers.Date = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: dateRegEx
|
||||||
|
* The regex to be used for validating dates. You can provide your own
|
||||||
|
* regex for instance for adding support for years before BC. Default
|
||||||
|
* value is: /^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/
|
||||||
|
*/
|
||||||
|
dateRegEx: /^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: toISOString
|
* APIMethod: toISOString
|
||||||
* Generates a string representing a date. The format of the string follows
|
* Generates a string representing a date. The format of the string follows
|
||||||
|
@ -41,13 +49,6 @@ OpenLayers.Date = {
|
||||||
return date.toISOString();
|
return date.toISOString();
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
function pad(num, len) {
|
|
||||||
var str = num + "";
|
|
||||||
while (str.length < len) {
|
|
||||||
str = "0" + str;
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
return function(date) {
|
return function(date) {
|
||||||
var str;
|
var str;
|
||||||
if (isNaN(date.getTime())) {
|
if (isNaN(date.getTime())) {
|
||||||
|
@ -57,12 +58,12 @@ OpenLayers.Date = {
|
||||||
} else {
|
} else {
|
||||||
str =
|
str =
|
||||||
date.getUTCFullYear() + "-" +
|
date.getUTCFullYear() + "-" +
|
||||||
pad(date.getUTCMonth() + 1, 2) + "-" +
|
OpenLayers.Number.zeroPad(date.getUTCMonth() + 1, 2) + "-" +
|
||||||
pad(date.getUTCDate(), 2) + "T" +
|
OpenLayers.Number.zeroPad(date.getUTCDate(), 2) + "T" +
|
||||||
pad(date.getUTCHours(), 2) + ":" +
|
OpenLayers.Number.zeroPad(date.getUTCHours(), 2) + ":" +
|
||||||
pad(date.getUTCMinutes(), 2) + ":" +
|
OpenLayers.Number.zeroPad(date.getUTCMinutes(), 2) + ":" +
|
||||||
pad(date.getUTCSeconds(), 2) + "." +
|
OpenLayers.Number.zeroPad(date.getUTCSeconds(), 2) + "." +
|
||||||
pad(date.getUTCMilliseconds(), 3) + "Z";
|
OpenLayers.Number.zeroPad(date.getUTCMilliseconds(), 3) + "Z";
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
@ -91,7 +92,7 @@ OpenLayers.Date = {
|
||||||
*/
|
*/
|
||||||
parse: function(str) {
|
parse: function(str) {
|
||||||
var date;
|
var date;
|
||||||
var match = str.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))|Z)?$/);
|
var match = str.match(this.dateRegEx);
|
||||||
if (match && (match[1] || match[7])) { // must have at least year or time
|
if (match && (match[1] || match[7])) { // must have at least year or time
|
||||||
var year = parseInt(match[1], 10) || 0;
|
var year = parseInt(match[1], 10) || 0;
|
||||||
var month = (parseInt(match[2], 10) - 1) || 0;
|
var month = (parseInt(match[2], 10) - 1) || 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -120,6 +120,12 @@ OpenLayers.Control = OpenLayers.Class({
|
||||||
*/
|
*/
|
||||||
active: null,
|
active: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: handlerOptions
|
||||||
|
* {Object} Used to set non-default properties on the control's handler
|
||||||
|
*/
|
||||||
|
handlerOptions: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: handler
|
* Property: handler
|
||||||
* {<OpenLayers.Handler>} null
|
* {<OpenLayers.Handler>} null
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -19,8 +19,8 @@ OpenLayers.Control.Attribution =
|
||||||
OpenLayers.Class(OpenLayers.Control, {
|
OpenLayers.Class(OpenLayers.Control, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: seperator
|
* APIProperty: separator
|
||||||
* {String} String used to seperate layers.
|
* {String} String used to separate layers.
|
||||||
*/
|
*/
|
||||||
separator: ", ",
|
separator: ", ",
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -111,7 +111,7 @@ OpenLayers.Control.CacheWrite = OpenLayers.Class(OpenLayers.Control, {
|
||||||
addLayer: function(evt) {
|
addLayer: function(evt) {
|
||||||
evt.layer.events.on({
|
evt.layer.events.on({
|
||||||
tileloadstart: this.makeSameOrigin,
|
tileloadstart: this.makeSameOrigin,
|
||||||
tileloaded: this.cache,
|
tileloaded: this.onTileLoaded,
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -128,7 +128,7 @@ OpenLayers.Control.CacheWrite = OpenLayers.Class(OpenLayers.Control, {
|
||||||
removeLayer: function(evt) {
|
removeLayer: function(evt) {
|
||||||
evt.layer.events.un({
|
evt.layer.events.un({
|
||||||
tileloadstart: this.makeSameOrigin,
|
tileloadstart: this.makeSameOrigin,
|
||||||
tileloaded: this.cache,
|
tileloaded: this.onTileLoaded,
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -156,6 +156,22 @@ OpenLayers.Control.CacheWrite = OpenLayers.Class(OpenLayers.Control, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: onTileLoaded
|
||||||
|
* Decides whether a tile can be cached and calls the cache method.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* evt - {Event}
|
||||||
|
*/
|
||||||
|
onTileLoaded: function(evt) {
|
||||||
|
if (this.active && !evt.aborted &&
|
||||||
|
evt.tile instanceof OpenLayers.Tile.Image &&
|
||||||
|
evt.tile.url.substr(0, 5) !== 'data:') {
|
||||||
|
this.cache({tile: evt.tile});
|
||||||
|
delete OpenLayers.Control.CacheWrite.urlMap[evt.tile.url];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: cache
|
* Method: cache
|
||||||
* Adds a tile to the cache. When the cache is full, the "cachefull" event
|
* Adds a tile to the cache. When the cache is full, the "cachefull" event
|
||||||
|
@ -166,29 +182,25 @@ OpenLayers.Control.CacheWrite = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* <OpenLayers.Tile.Image> with the data to add to the cache
|
* <OpenLayers.Tile.Image> with the data to add to the cache
|
||||||
*/
|
*/
|
||||||
cache: function(obj) {
|
cache: function(obj) {
|
||||||
if (this.active && window.localStorage) {
|
if (window.localStorage) {
|
||||||
var tile = obj.tile;
|
var tile = obj.tile;
|
||||||
if (tile instanceof OpenLayers.Tile.Image &&
|
try {
|
||||||
tile.url.substr(0, 5) !== 'data:') {
|
var canvasContext = tile.getCanvasContext();
|
||||||
try {
|
if (canvasContext) {
|
||||||
var canvasContext = tile.getCanvasContext();
|
var urlMap = OpenLayers.Control.CacheWrite.urlMap;
|
||||||
if (canvasContext) {
|
var url = urlMap[tile.url] || tile.url;
|
||||||
var urlMap = OpenLayers.Control.CacheWrite.urlMap;
|
window.localStorage.setItem(
|
||||||
var url = urlMap[tile.url] || tile.url;
|
"olCache_" + url,
|
||||||
window.localStorage.setItem(
|
canvasContext.canvas.toDataURL(this.imageFormat)
|
||||||
"olCache_" + url,
|
);
|
||||||
canvasContext.canvas.toDataURL(this.imageFormat)
|
}
|
||||||
);
|
} catch(e) {
|
||||||
delete urlMap[tile.url];
|
// local storage full or CORS violation
|
||||||
}
|
var reason = e.name || e.message;
|
||||||
} catch(e) {
|
if (reason && this.quotaRegEx.test(reason)) {
|
||||||
// local storage full or CORS violation
|
this.events.triggerEvent("cachefull", {tile: tile});
|
||||||
var reason = e.name || e.message;
|
} else {
|
||||||
if (reason && this.quotaRegEx.test(reason)) {
|
OpenLayers.Console.error(e.toString());
|
||||||
this.events.triggerEvent("cachefull", {tile: tile});
|
|
||||||
} else {
|
|
||||||
OpenLayers.Console.error(e.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -32,11 +32,12 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
|
||||||
/**
|
/**
|
||||||
* Property: interval
|
* Property: interval
|
||||||
* {Integer} The number of milliseconds that should ellapse before
|
* {Integer} The number of milliseconds that should ellapse before
|
||||||
* panning the map again. Defaults to 1 millisecond. In most cases
|
* panning the map again. Defaults to 0 milliseconds, which means that
|
||||||
* you won't want to change this value. For slow machines/devices
|
* no separate cycle is used for panning. In most cases you won't want
|
||||||
* larger values can be tried out.
|
* to change this value. For slow machines/devices larger values can be
|
||||||
|
* tried out.
|
||||||
*/
|
*/
|
||||||
interval: 1,
|
interval: 0,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: documentDrag
|
* APIProperty: documentDrag
|
||||||
|
@ -56,11 +57,11 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* {Boolean} Set this option to enable "kinetic dragging". Can be
|
* {Boolean} Set this option to enable "kinetic dragging". Can be
|
||||||
* set to true or to an object. If set to an object this
|
* set to true or to an object. If set to an object this
|
||||||
* object will be passed to the {<OpenLayers.Kinetic>}
|
* object will be passed to the {<OpenLayers.Kinetic>}
|
||||||
* constructor. Defaults to false.
|
* constructor. Defaults to true.
|
||||||
* If you set this property, you should ensure that
|
* To get kinetic dragging, ensure that OpenLayers/Kinetic.js is
|
||||||
* OpenLayers/Kinetic.js is included in your build config
|
* included in your build config.
|
||||||
*/
|
*/
|
||||||
enableKinetic: false,
|
enableKinetic: true,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: kineticInterval
|
* APIProperty: kineticInterval
|
||||||
|
@ -77,7 +78,7 @@ OpenLayers.Control.DragPan = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* <panMapDone> as callbacks.
|
* <panMapDone> as callbacks.
|
||||||
*/
|
*/
|
||||||
draw: function() {
|
draw: function() {
|
||||||
if(this.enableKinetic) {
|
if (this.enableKinetic && OpenLayers.Kinetic) {
|
||||||
var config = {interval: this.kineticInterval};
|
var config = {interval: this.kineticInterval};
|
||||||
if(typeof this.enableKinetic === "object") {
|
if(typeof this.enableKinetic === "object") {
|
||||||
config = OpenLayers.Util.extend(config, this.enableKinetic);
|
config = OpenLayers.Util.extend(config, this.enableKinetic);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -62,7 +62,6 @@ OpenLayers.Control.DrawFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* APIProperty: handlerOptions
|
* APIProperty: handlerOptions
|
||||||
* {Object} Used to set non-default properties on the control's handler
|
* {Object} Used to set non-default properties on the control's handler
|
||||||
*/
|
*/
|
||||||
handlerOptions: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Control.DrawFeature
|
* Constructor: OpenLayers.Control.DrawFeature
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -45,8 +45,15 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, {
|
||||||
/**
|
/**
|
||||||
* Property: geolocation
|
* Property: geolocation
|
||||||
* {Object} The geolocation engine, as a property to be possibly mocked.
|
* {Object} The geolocation engine, as a property to be possibly mocked.
|
||||||
|
* This is set lazily to avoid a memory leak in IE9.
|
||||||
*/
|
*/
|
||||||
geolocation: navigator.geolocation,
|
geolocation: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: available
|
||||||
|
* {Boolean} The navigator.geolocation object is available.
|
||||||
|
*/
|
||||||
|
available: ('geolocation' in navigator),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: bind
|
* APIProperty: bind
|
||||||
|
@ -90,6 +97,10 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* {Boolean} The control was effectively activated.
|
* {Boolean} The control was effectively activated.
|
||||||
*/
|
*/
|
||||||
activate: function () {
|
activate: function () {
|
||||||
|
if (this.available && !this.geolocation) {
|
||||||
|
// set lazily to avoid IE9 memory leak
|
||||||
|
this.geolocation = navigator.geolocation;
|
||||||
|
}
|
||||||
if (!this.geolocation) {
|
if (!this.geolocation) {
|
||||||
this.events.triggerEvent("locationuncapable");
|
this.events.triggerEvent("locationuncapable");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -144,7 +144,6 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* {Object} Additional options for the handlers used by this control. This
|
* {Object} Additional options for the handlers used by this control. This
|
||||||
* is a hash with the keys "click", "box" and "hover".
|
* is a hash with the keys "click", "box" and "hover".
|
||||||
*/
|
*/
|
||||||
handlerOptions: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: handlers
|
* Property: handlers
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -6,6 +6,7 @@
|
||||||
/**
|
/**
|
||||||
* @requires OpenLayers/Control.js
|
* @requires OpenLayers/Control.js
|
||||||
* @requires OpenLayers/Handler/Keyboard.js
|
* @requires OpenLayers/Handler/Keyboard.js
|
||||||
|
* @requires OpenLayers/Events.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +76,16 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
defaultKeyPress: function (evt) {
|
defaultKeyPress: function (evt) {
|
||||||
var size, handled = true;
|
var size, handled = true;
|
||||||
switch(evt.keyCode) {
|
|
||||||
|
var target = OpenLayers.Event.element(evt);
|
||||||
|
if (target &&
|
||||||
|
(target.tagName == 'INPUT' ||
|
||||||
|
target.tagName == 'TEXTAREA' ||
|
||||||
|
target.tagName == 'SELECT')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (evt.keyCode) {
|
||||||
case OpenLayers.Event.KEY_LEFT:
|
case OpenLayers.Event.KEY_LEFT:
|
||||||
this.map.pan(-this.slideFactor, 0);
|
this.map.pan(-this.slideFactor, 0);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,49 +1,30 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires OpenLayers/Control.js
|
* @requires OpenLayers/Control.js
|
||||||
* @requires OpenLayers/Lang.js
|
* @requires OpenLayers/Lang.js
|
||||||
* @requires OpenLayers/Console.js
|
* @requires OpenLayers/Util.js
|
||||||
* @requires OpenLayers/Events/buttonclick.js
|
* @requires OpenLayers/Events/buttonclick.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class: OpenLayers.Control.LayerSwitcher
|
* Class: OpenLayers.Control.LayerSwitcher
|
||||||
* The LayerSwitcher control displays a table of contents for the map. This
|
* The LayerSwitcher control displays a table of contents for the map. This
|
||||||
* allows the user interface to switch between BaseLasyers and to show or hide
|
* allows the user interface to switch between BaseLasyers and to show or hide
|
||||||
* Overlays. By default the switcher is shown minimized on the right edge of
|
* Overlays. By default the switcher is shown minimized on the right edge of
|
||||||
* the map, the user may expand it by clicking on the handle.
|
* the map, the user may expand it by clicking on the handle.
|
||||||
*
|
*
|
||||||
* To create the LayerSwitcher outside of the map, pass the Id of a html div
|
* To create the LayerSwitcher outside of the map, pass the Id of a html div
|
||||||
* as the first argument to the constructor.
|
* as the first argument to the constructor.
|
||||||
*
|
*
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
* - <OpenLayers.Control>
|
* - <OpenLayers.Control>
|
||||||
*/
|
*/
|
||||||
OpenLayers.Control.LayerSwitcher =
|
OpenLayers.Control.LayerSwitcher = OpenLayers.Class(OpenLayers.Control, {
|
||||||
OpenLayers.Class(OpenLayers.Control, {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* APIProperty: roundedCorner
|
|
||||||
* {Boolean} If true the Rico library is used for rounding the corners
|
|
||||||
* of the layer switcher div, defaults to false. *Deprecated*. Use
|
|
||||||
* CSS3's border-radius instead. If this option is set to true the
|
|
||||||
* Rico/Corner.js script must be loaded in the page, and therefore
|
|
||||||
* listed in the build profile.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
roundedCorner: false,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* APIProperty: roundedCornerColor
|
|
||||||
* {String} The color of the rounded corners, only applies if roundedCorner
|
|
||||||
* is true, defaults to "darkblue".
|
|
||||||
*/
|
|
||||||
roundedCornerColor: "darkblue",
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: layerStates
|
* Property: layerStates
|
||||||
* {Array(Object)} Basically a copy of the "state" of the map's layers
|
* {Array(Object)} Basically a copy of the "state" of the map's layers
|
||||||
|
@ -51,90 +32,85 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
* unnecessarily redrawing the control.
|
* unnecessarily redrawing the control.
|
||||||
*/
|
*/
|
||||||
layerStates: null,
|
layerStates: null,
|
||||||
|
|
||||||
|
|
||||||
// DOM Elements
|
// DOM Elements
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: layersDiv
|
* Property: layersDiv
|
||||||
* {DOMElement}
|
* {DOMElement}
|
||||||
*/
|
*/
|
||||||
layersDiv: null,
|
layersDiv: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: baseLayersDiv
|
* Property: baseLayersDiv
|
||||||
* {DOMElement}
|
* {DOMElement}
|
||||||
*/
|
*/
|
||||||
baseLayersDiv: null,
|
baseLayersDiv: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: baseLayers
|
* Property: baseLayers
|
||||||
* {Array(Object)}
|
* {Array(Object)}
|
||||||
*/
|
*/
|
||||||
baseLayers: null,
|
baseLayers: null,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: dataLbl
|
* Property: dataLbl
|
||||||
* {DOMElement}
|
* {DOMElement}
|
||||||
*/
|
*/
|
||||||
dataLbl: null,
|
dataLbl: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: dataLayersDiv
|
* Property: dataLayersDiv
|
||||||
* {DOMElement}
|
* {DOMElement}
|
||||||
*/
|
*/
|
||||||
dataLayersDiv: null,
|
dataLayersDiv: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: dataLayers
|
* Property: dataLayers
|
||||||
* {Array(Object)}
|
* {Array(Object)}
|
||||||
*/
|
*/
|
||||||
dataLayers: null,
|
dataLayers: null,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: minimizeDiv
|
* Property: minimizeDiv
|
||||||
* {DOMElement}
|
* {DOMElement}
|
||||||
*/
|
*/
|
||||||
minimizeDiv: null,
|
minimizeDiv: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: maximizeDiv
|
* Property: maximizeDiv
|
||||||
* {DOMElement}
|
* {DOMElement}
|
||||||
*/
|
*/
|
||||||
maximizeDiv: null,
|
maximizeDiv: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: ascending
|
* APIProperty: ascending
|
||||||
* {Boolean}
|
* {Boolean}
|
||||||
*/
|
*/
|
||||||
ascending: true,
|
ascending: true,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Control.LayerSwitcher
|
* Constructor: OpenLayers.Control.LayerSwitcher
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* options - {Object}
|
* options - {Object}
|
||||||
*/
|
*/
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
||||||
this.layerStates = [];
|
this.layerStates = [];
|
||||||
|
|
||||||
if(this.roundedCorner) {
|
|
||||||
OpenLayers.Console.warn('roundedCorner option is deprecated');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: destroy
|
* APIMethod: destroy
|
||||||
*/
|
*/
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
|
|
||||||
//clear out layers info and unregister their events
|
//clear out layers info and unregister their events
|
||||||
this.clearLayersArray("base");
|
this.clearLayersArray("base");
|
||||||
this.clearLayersArray("data");
|
this.clearLayersArray("data");
|
||||||
|
|
||||||
this.map.events.un({
|
this.map.events.un({
|
||||||
buttonclick: this.onButtonClick,
|
buttonclick: this.onButtonClick,
|
||||||
addlayer: this.redraw,
|
addlayer: this.redraw,
|
||||||
|
@ -144,15 +120,15 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
this.events.unregister("buttonclick", this, this.onButtonClick);
|
this.events.unregister("buttonclick", this, this.onButtonClick);
|
||||||
|
|
||||||
OpenLayers.Control.prototype.destroy.apply(this, arguments);
|
OpenLayers.Control.prototype.destroy.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: setMap
|
* Method: setMap
|
||||||
*
|
*
|
||||||
* Properties:
|
* Properties:
|
||||||
* map - {<OpenLayers.Map>}
|
* map - {<OpenLayers.Map>}
|
||||||
*/
|
*/
|
||||||
setMap: function(map) {
|
setMap: function(map) {
|
||||||
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
||||||
|
@ -176,9 +152,9 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
* Method: draw
|
* Method: draw
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {DOMElement} A reference to the DIV DOMElement containing the
|
* {DOMElement} A reference to the DIV DOMElement containing the
|
||||||
* switcher tabs.
|
* switcher tabs.
|
||||||
*/
|
*/
|
||||||
draw: function() {
|
draw: function() {
|
||||||
OpenLayers.Control.prototype.draw.apply(this);
|
OpenLayers.Control.prototype.draw.apply(this);
|
||||||
|
|
||||||
|
@ -191,7 +167,7 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
}
|
}
|
||||||
|
|
||||||
// populate div with current info
|
// populate div with current info
|
||||||
this.redraw();
|
this.redraw();
|
||||||
|
|
||||||
return this.div;
|
return this.div;
|
||||||
},
|
},
|
||||||
|
@ -224,13 +200,13 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: clearLayersArray
|
* Method: clearLayersArray
|
||||||
* User specifies either "base" or "data". we then clear all the
|
* User specifies either "base" or "data". we then clear all the
|
||||||
* corresponding listeners, the div, and reinitialize a new array.
|
* corresponding listeners, the div, and reinitialize a new array.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* layersType - {String}
|
* layersType - {String}
|
||||||
*/
|
*/
|
||||||
clearLayersArray: function(layersType) {
|
clearLayersArray: function(layersType) {
|
||||||
this[layersType + "LayersDiv"].innerHTML = "";
|
this[layersType + "LayersDiv"].innerHTML = "";
|
||||||
|
@ -241,54 +217,53 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
/**
|
/**
|
||||||
* Method: checkRedraw
|
* Method: checkRedraw
|
||||||
* Checks if the layer state has changed since the last redraw() call.
|
* Checks if the layer state has changed since the last redraw() call.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {Boolean} The layer state changed since the last redraw() call.
|
* {Boolean} The layer state changed since the last redraw() call.
|
||||||
*/
|
*/
|
||||||
checkRedraw: function() {
|
checkRedraw: function() {
|
||||||
var redraw = false;
|
|
||||||
if ( !this.layerStates.length ||
|
if ( !this.layerStates.length ||
|
||||||
(this.map.layers.length != this.layerStates.length) ) {
|
(this.map.layers.length != this.layerStates.length) ) {
|
||||||
redraw = true;
|
return true;
|
||||||
} else {
|
}
|
||||||
for (var i=0, len=this.layerStates.length; i<len; i++) {
|
|
||||||
var layerState = this.layerStates[i];
|
for (var i = 0, len = this.layerStates.length; i < len; i++) {
|
||||||
var layer = this.map.layers[i];
|
var layerState = this.layerStates[i];
|
||||||
if ( (layerState.name != layer.name) ||
|
var layer = this.map.layers[i];
|
||||||
(layerState.inRange != layer.inRange) ||
|
if ( (layerState.name != layer.name) ||
|
||||||
(layerState.id != layer.id) ||
|
(layerState.inRange != layer.inRange) ||
|
||||||
(layerState.visibility != layer.visibility) ) {
|
(layerState.id != layer.id) ||
|
||||||
redraw = true;
|
(layerState.visibility != layer.visibility) ) {
|
||||||
break;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return redraw;
|
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: redraw
|
* Method: redraw
|
||||||
* Goes through and takes the current state of the Map and rebuilds the
|
* Goes through and takes the current state of the Map and rebuilds the
|
||||||
* control to display that state. Groups base layers into a
|
* control to display that state. Groups base layers into a
|
||||||
* radio-button group and lists each data layer with a checkbox.
|
* radio-button group and lists each data layer with a checkbox.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {DOMElement} A reference to the DIV DOMElement containing the control
|
* {DOMElement} A reference to the DIV DOMElement containing the control
|
||||||
*/
|
*/
|
||||||
redraw: function() {
|
redraw: function() {
|
||||||
//if the state hasn't changed since last redraw, no need
|
//if the state hasn't changed since last redraw, no need
|
||||||
// to do anything. Just return the existing div.
|
// to do anything. Just return the existing div.
|
||||||
if (!this.checkRedraw()) {
|
if (!this.checkRedraw()) {
|
||||||
return this.div;
|
return this.div;
|
||||||
}
|
}
|
||||||
|
|
||||||
//clear out previous layers
|
//clear out previous layers
|
||||||
this.clearLayersArray("base");
|
this.clearLayersArray("base");
|
||||||
this.clearLayersArray("data");
|
this.clearLayersArray("data");
|
||||||
|
|
||||||
var containsOverlays = false;
|
var containsOverlays = false;
|
||||||
var containsBaseLayers = false;
|
var containsBaseLayers = false;
|
||||||
|
|
||||||
// Save state -- for checking layer if the map state changed.
|
// Save state -- for checking layer if the map state changed.
|
||||||
// We save this before redrawing, because in the process of redrawing
|
// We save this before redrawing, because in the process of redrawing
|
||||||
// we will trigger more visibility changes, and we want to not redraw
|
// we will trigger more visibility changes, and we want to not redraw
|
||||||
|
@ -298,12 +273,12 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
for (var i=0; i <len; i++) {
|
for (var i=0; i <len; i++) {
|
||||||
var layer = this.map.layers[i];
|
var layer = this.map.layers[i];
|
||||||
this.layerStates[i] = {
|
this.layerStates[i] = {
|
||||||
'name': layer.name,
|
'name': layer.name,
|
||||||
'visibility': layer.visibility,
|
'visibility': layer.visibility,
|
||||||
'inRange': layer.inRange,
|
'inRange': layer.inRange,
|
||||||
'id': layer.id
|
'id': layer.id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var layers = this.map.layers.slice();
|
var layers = this.map.layers.slice();
|
||||||
if (!this.ascending) { layers.reverse(); }
|
if (!this.ascending) { layers.reverse(); }
|
||||||
|
@ -317,16 +292,22 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
containsBaseLayers = true;
|
containsBaseLayers = true;
|
||||||
} else {
|
} else {
|
||||||
containsOverlays = true;
|
containsOverlays = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only check a baselayer if it is *the* baselayer, check data
|
// only check a baselayer if it is *the* baselayer, check data
|
||||||
// layers if they are visible
|
// layers if they are visible
|
||||||
var checked = (baseLayer) ? (layer == this.map.baseLayer)
|
var checked = (baseLayer) ? (layer == this.map.baseLayer)
|
||||||
: layer.getVisibility();
|
: layer.getVisibility();
|
||||||
|
|
||||||
// create input element
|
// create input element
|
||||||
var inputElem = document.createElement("input");
|
var inputElem = document.createElement("input"),
|
||||||
inputElem.id = this.id + "_input_" + layer.name;
|
// The input shall have an id attribute so we can use
|
||||||
|
// labels to interact with them.
|
||||||
|
inputId = OpenLayers.Util.createUniqueID(
|
||||||
|
this.id + "_input_"
|
||||||
|
);
|
||||||
|
|
||||||
|
inputElem.id = inputId;
|
||||||
inputElem.name = (baseLayer) ? this.id + "_baseLayers" : layer.name;
|
inputElem.name = (baseLayer) ? this.id + "_baseLayers" : layer.name;
|
||||||
inputElem.type = (baseLayer) ? "radio" : "checkbox";
|
inputElem.type = (baseLayer) ? "radio" : "checkbox";
|
||||||
inputElem.value = layer.name;
|
inputElem.value = layer.name;
|
||||||
|
@ -339,9 +320,11 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
if (!baseLayer && !layer.inRange) {
|
if (!baseLayer && !layer.inRange) {
|
||||||
inputElem.disabled = true;
|
inputElem.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create span
|
// create span
|
||||||
var labelSpan = document.createElement("label");
|
var labelSpan = document.createElement("label");
|
||||||
|
// this isn't the DOM attribute 'for', but an arbitrary name we
|
||||||
|
// use to find the appropriate input element in <onButtonClick>
|
||||||
labelSpan["for"] = inputElem.id;
|
labelSpan["for"] = inputElem.id;
|
||||||
OpenLayers.Element.addClass(labelSpan, "labelSpan olButton");
|
OpenLayers.Element.addClass(labelSpan, "labelSpan olButton");
|
||||||
labelSpan._layer = layer.id;
|
labelSpan._layer = layer.id;
|
||||||
|
@ -350,12 +333,12 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
labelSpan.style.color = "gray";
|
labelSpan.style.color = "gray";
|
||||||
}
|
}
|
||||||
labelSpan.innerHTML = layer.name;
|
labelSpan.innerHTML = layer.name;
|
||||||
labelSpan.style.verticalAlign = (baseLayer) ? "bottom"
|
labelSpan.style.verticalAlign = (baseLayer) ? "bottom"
|
||||||
: "baseline";
|
: "baseline";
|
||||||
// create line break
|
// create line break
|
||||||
var br = document.createElement("br");
|
var br = document.createElement("br");
|
||||||
|
|
||||||
|
|
||||||
var groupArray = (baseLayer) ? this.baseLayers
|
var groupArray = (baseLayer) ? this.baseLayers
|
||||||
: this.dataLayers;
|
: this.dataLayers;
|
||||||
groupArray.push({
|
groupArray.push({
|
||||||
|
@ -363,8 +346,8 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
'inputElem': inputElem,
|
'inputElem': inputElem,
|
||||||
'labelSpan': labelSpan
|
'labelSpan': labelSpan
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var groupDiv = (baseLayer) ? this.baseLayersDiv
|
var groupDiv = (baseLayer) ? this.baseLayersDiv
|
||||||
: this.dataLayersDiv;
|
: this.dataLayersDiv;
|
||||||
groupDiv.appendChild(inputElem);
|
groupDiv.appendChild(inputElem);
|
||||||
|
@ -374,24 +357,24 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no overlays, dont display the overlay label
|
// if no overlays, dont display the overlay label
|
||||||
this.dataLbl.style.display = (containsOverlays) ? "" : "none";
|
this.dataLbl.style.display = (containsOverlays) ? "" : "none";
|
||||||
|
|
||||||
// if no baselayers, dont display the baselayer label
|
// if no baselayers, dont display the baselayer label
|
||||||
this.baseLbl.style.display = (containsBaseLayers) ? "" : "none";
|
this.baseLbl.style.display = (containsBaseLayers) ? "" : "none";
|
||||||
|
|
||||||
return this.div;
|
return this.div;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: updateMap
|
* Method: updateMap
|
||||||
* Cycles through the loaded data and base layer input arrays and makes
|
* Cycles through the loaded data and base layer input arrays and makes
|
||||||
* the necessary calls to the Map object such that that the map's
|
* the necessary calls to the Map object such that that the map's
|
||||||
* visual state corresponds to what the user has selected in
|
* visual state corresponds to what the user has selected in
|
||||||
* the control.
|
* the control.
|
||||||
*/
|
*/
|
||||||
updateMap: function() {
|
updateMap: function() {
|
||||||
|
|
||||||
// set the newly selected base layer
|
// set the newly selected base layer
|
||||||
for(var i=0, len=this.baseLayers.length; i<len; i++) {
|
for(var i=0, len=this.baseLayers.length; i<len; i++) {
|
||||||
var layerEntry = this.baseLayers[i];
|
var layerEntry = this.baseLayers[i];
|
||||||
if (layerEntry.inputElem.checked) {
|
if (layerEntry.inputElem.checked) {
|
||||||
|
@ -401,18 +384,18 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
|
|
||||||
// set the correct visibilities for the overlays
|
// set the correct visibilities for the overlays
|
||||||
for(var i=0, len=this.dataLayers.length; i<len; i++) {
|
for(var i=0, len=this.dataLayers.length; i<len; i++) {
|
||||||
var layerEntry = this.dataLayers[i];
|
var layerEntry = this.dataLayers[i];
|
||||||
layerEntry.layer.setVisibility(layerEntry.inputElem.checked);
|
layerEntry.layer.setVisibility(layerEntry.inputElem.checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: maximizeControl
|
* Method: maximizeControl
|
||||||
* Set up the labels and divs for the control
|
* Set up the labels and divs for the control
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* e - {Event}
|
* e - {Event}
|
||||||
*/
|
*/
|
||||||
maximizeControl: function(e) {
|
maximizeControl: function(e) {
|
||||||
|
|
||||||
|
@ -424,17 +407,17 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
this.showControls(false);
|
this.showControls(false);
|
||||||
|
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
OpenLayers.Event.stop(e);
|
OpenLayers.Event.stop(e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: minimizeControl
|
* Method: minimizeControl
|
||||||
* Hide all the contents of the control, shrink the size,
|
* Hide all the contents of the control, shrink the size,
|
||||||
* add the maximize icon
|
* add the maximize icon
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* e - {Event}
|
* e - {Event}
|
||||||
*/
|
*/
|
||||||
minimizeControl: function(e) {
|
minimizeControl: function(e) {
|
||||||
|
|
||||||
|
@ -448,7 +431,7 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
this.showControls(true);
|
this.showControls(true);
|
||||||
|
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
OpenLayers.Event.stop(e);
|
OpenLayers.Event.stop(e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -456,7 +439,7 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
* Method: showControls
|
* Method: showControls
|
||||||
* Hide/Show all LayerSwitcher controls depending on whether we are
|
* Hide/Show all LayerSwitcher controls depending on whether we are
|
||||||
* minimized or not
|
* minimized or not
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* minimize - {Boolean}
|
* minimize - {Boolean}
|
||||||
*/
|
*/
|
||||||
|
@ -467,14 +450,14 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
|
|
||||||
this.layersDiv.style.display = minimize ? "none" : "";
|
this.layersDiv.style.display = minimize ? "none" : "";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: loadContents
|
* Method: loadContents
|
||||||
* Set up the labels and divs for the control
|
* Set up the labels and divs for the control
|
||||||
*/
|
*/
|
||||||
loadContents: function() {
|
loadContents: function() {
|
||||||
|
|
||||||
// layers list div
|
// layers list div
|
||||||
this.layersDiv = document.createElement("div");
|
this.layersDiv = document.createElement("div");
|
||||||
this.layersDiv.id = this.id + "_layersDiv";
|
this.layersDiv.id = this.id + "_layersDiv";
|
||||||
OpenLayers.Element.addClass(this.layersDiv, "layersDiv");
|
OpenLayers.Element.addClass(this.layersDiv, "layersDiv");
|
||||||
|
@ -482,14 +465,14 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
this.baseLbl = document.createElement("div");
|
this.baseLbl = document.createElement("div");
|
||||||
this.baseLbl.innerHTML = OpenLayers.i18n("Base Layer");
|
this.baseLbl.innerHTML = OpenLayers.i18n("Base Layer");
|
||||||
OpenLayers.Element.addClass(this.baseLbl, "baseLbl");
|
OpenLayers.Element.addClass(this.baseLbl, "baseLbl");
|
||||||
|
|
||||||
this.baseLayersDiv = document.createElement("div");
|
this.baseLayersDiv = document.createElement("div");
|
||||||
OpenLayers.Element.addClass(this.baseLayersDiv, "baseLayersDiv");
|
OpenLayers.Element.addClass(this.baseLayersDiv, "baseLayersDiv");
|
||||||
|
|
||||||
this.dataLbl = document.createElement("div");
|
this.dataLbl = document.createElement("div");
|
||||||
this.dataLbl.innerHTML = OpenLayers.i18n("Overlays");
|
this.dataLbl.innerHTML = OpenLayers.i18n("Overlays");
|
||||||
OpenLayers.Element.addClass(this.dataLbl, "dataLbl");
|
OpenLayers.Element.addClass(this.dataLbl, "dataLbl");
|
||||||
|
|
||||||
this.dataLayersDiv = document.createElement("div");
|
this.dataLayersDiv = document.createElement("div");
|
||||||
OpenLayers.Element.addClass(this.dataLayersDiv, "dataLayersDiv");
|
OpenLayers.Element.addClass(this.dataLayersDiv, "dataLayersDiv");
|
||||||
|
|
||||||
|
@ -503,46 +486,36 @@ OpenLayers.Control.LayerSwitcher =
|
||||||
this.layersDiv.appendChild(this.dataLayersDiv);
|
this.layersDiv.appendChild(this.dataLayersDiv);
|
||||||
this.layersDiv.appendChild(this.baseLbl);
|
this.layersDiv.appendChild(this.baseLbl);
|
||||||
this.layersDiv.appendChild(this.baseLayersDiv);
|
this.layersDiv.appendChild(this.baseLayersDiv);
|
||||||
}
|
|
||||||
|
|
||||||
this.div.appendChild(this.layersDiv);
|
|
||||||
|
|
||||||
if(this.roundedCorner) {
|
|
||||||
OpenLayers.Rico.Corner.round(this.div, {
|
|
||||||
corners: "tl bl",
|
|
||||||
bgColor: "transparent",
|
|
||||||
color: this.roundedCornerColor,
|
|
||||||
blend: false
|
|
||||||
});
|
|
||||||
OpenLayers.Rico.Corner.changeOpacity(this.layersDiv, 0.75);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.div.appendChild(this.layersDiv);
|
||||||
|
|
||||||
// maximize button div
|
// maximize button div
|
||||||
var img = OpenLayers.Util.getImageLocation('layer-switcher-maximize.png');
|
var img = OpenLayers.Util.getImageLocation('layer-switcher-maximize.png');
|
||||||
this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
||||||
"OpenLayers_Control_MaximizeDiv",
|
"OpenLayers_Control_MaximizeDiv",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
img,
|
img,
|
||||||
"absolute");
|
"absolute");
|
||||||
OpenLayers.Element.addClass(this.maximizeDiv, "maximizeDiv olButton");
|
OpenLayers.Element.addClass(this.maximizeDiv, "maximizeDiv olButton");
|
||||||
this.maximizeDiv.style.display = "none";
|
this.maximizeDiv.style.display = "none";
|
||||||
|
|
||||||
this.div.appendChild(this.maximizeDiv);
|
this.div.appendChild(this.maximizeDiv);
|
||||||
|
|
||||||
// minimize button div
|
// minimize button div
|
||||||
var img = OpenLayers.Util.getImageLocation('layer-switcher-minimize.png');
|
var img = OpenLayers.Util.getImageLocation('layer-switcher-minimize.png');
|
||||||
this.minimizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
this.minimizeDiv = OpenLayers.Util.createAlphaImageDiv(
|
||||||
"OpenLayers_Control_MinimizeDiv",
|
"OpenLayers_Control_MinimizeDiv",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
img,
|
img,
|
||||||
"absolute");
|
"absolute");
|
||||||
OpenLayers.Element.addClass(this.minimizeDiv, "minimizeDiv olButton");
|
OpenLayers.Element.addClass(this.minimizeDiv, "minimizeDiv olButton");
|
||||||
this.minimizeDiv.style.display = "none";
|
this.minimizeDiv.style.display = "none";
|
||||||
|
|
||||||
this.div.appendChild(this.minimizeDiv);
|
this.div.appendChild(this.minimizeDiv);
|
||||||
},
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Control.LayerSwitcher"
|
CLASS_NAME: "OpenLayers.Control.LayerSwitcher"
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: events
|
* APIProperty: events
|
||||||
* {<OpenLayers.Events>} Events instance for listeners and triggering
|
* {<OpenLayers.Events>} Events instance for listeners and triggering
|
||||||
* control specific events.
|
* control specific events.
|
||||||
|
@ -41,29 +41,28 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* APIProperty: handlerOptions
|
* APIProperty: handlerOptions
|
||||||
* {Object} Used to set non-default properties on the control's handler
|
* {Object} Used to set non-default properties on the control's handler
|
||||||
*/
|
*/
|
||||||
handlerOptions: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: callbacks
|
* Property: callbacks
|
||||||
* {Object} The functions that are sent to the handler for callback
|
* {Object} The functions that are sent to the handler for callback
|
||||||
*/
|
*/
|
||||||
callbacks: null,
|
callbacks: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: displaySystem
|
* APIProperty: displaySystem
|
||||||
* {String} Display system for output measurements. Supported values
|
* {String} Display system for output measurements. Supported values
|
||||||
* are 'english', 'metric', and 'geographic'. Default is 'metric'.
|
* are 'english', 'metric', and 'geographic'. Default is 'metric'.
|
||||||
*/
|
*/
|
||||||
displaySystem: 'metric',
|
displaySystem: 'metric',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: geodesic
|
* APIProperty: geodesic
|
||||||
* {Boolean} Calculate geodesic metrics instead of planar metrics. This
|
* {Boolean} Calculate geodesic metrics instead of planar metrics. This
|
||||||
* requires that geometries can be transformed into Geographic/WGS84
|
* requires that geometries can be transformed into Geographic/WGS84
|
||||||
* (if that is not already the map projection). Default is false.
|
* (if that is not already the map projection). Default is false.
|
||||||
*/
|
*/
|
||||||
geodesic: false,
|
geodesic: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: displaySystemUnits
|
* Property: displaySystemUnits
|
||||||
* {Object} Units for various measurement systems. Values are arrays
|
* {Object} Units for various measurement systems. Values are arrays
|
||||||
|
@ -112,10 +111,10 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Control.Measure
|
* Constructor: OpenLayers.Control.Measure
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* handler - {<OpenLayers.Handler>}
|
* handler - {<OpenLayers.Handler>}
|
||||||
* options - {Object}
|
* options - {Object}
|
||||||
*/
|
*/
|
||||||
initialize: function(handler, options) {
|
initialize: function(handler, options) {
|
||||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||||
|
@ -126,14 +125,14 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||||
}
|
}
|
||||||
this.callbacks = OpenLayers.Util.extend(callbacks, this.callbacks);
|
this.callbacks = OpenLayers.Util.extend(callbacks, this.callbacks);
|
||||||
|
|
||||||
// let the handler options override, so old code that passes 'persist'
|
// let the handler options override, so old code that passes 'persist'
|
||||||
// directly to the handler does not need an update
|
// directly to the handler does not need an update
|
||||||
this.handlerOptions = OpenLayers.Util.extend(
|
this.handlerOptions = OpenLayers.Util.extend(
|
||||||
{persist: this.persist}, this.handlerOptions
|
{persist: this.persist}, this.handlerOptions
|
||||||
);
|
);
|
||||||
this.handler = new handler(this, this.callbacks, this.handlerOptions);
|
this.handler = new handler(this, this.callbacks, this.handlerOptions);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: deactivate
|
* APIMethod: deactivate
|
||||||
*/
|
*/
|
||||||
|
@ -165,7 +164,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||||
delete this.callbacks.modify;
|
delete this.callbacks.modify;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: updateHandler
|
* Method: updateHandler
|
||||||
*
|
*
|
||||||
|
@ -195,7 +194,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||||
this.cancelDelay();
|
this.cancelDelay();
|
||||||
this.measure(geometry, "measure");
|
this.measure(geometry, "measure");
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: measurePartial
|
* Method: measurePartial
|
||||||
* Called each time a new point is added to the measurement sketch.
|
* Called each time a new point is added to the measurement sketch.
|
||||||
|
@ -226,9 +225,11 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||||
/**
|
/**
|
||||||
* Method: measureImmediate
|
* Method: measureImmediate
|
||||||
* Called each time the measurement sketch is modified.
|
* Called each time the measurement sketch is modified.
|
||||||
*
|
*
|
||||||
* Parameters: point - {<OpenLayers.Geometry.Point>} The point at the
|
* Parameters:
|
||||||
* mouseposition. feature - {<OpenLayers.Feature.Vector>} The sketch feature.
|
* point - {<OpenLayers.Geometry.Point>} The point at the mouse position.
|
||||||
|
* feature - {<OpenLayers.Feature.Vector>} The sketch feature.
|
||||||
|
* drawing - {Boolean} Indicates whether we're currently drawing.
|
||||||
*/
|
*/
|
||||||
measureImmediate : function(point, feature, drawing) {
|
measureImmediate : function(point, feature, drawing) {
|
||||||
if (drawing && !this.handler.freehandMode(this.handler.evt)) {
|
if (drawing && !this.handler.freehandMode(this.handler.evt)) {
|
||||||
|
@ -271,7 +272,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||||
geometry: geometry
|
geometry: geometry
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: getBestArea
|
* Method: getBestArea
|
||||||
* Based on the <displaySystem> returns the area of a geometry.
|
* Based on the <displaySystem> returns the area of a geometry.
|
||||||
|
@ -295,7 +296,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||||
}
|
}
|
||||||
return [area, unit];
|
return [area, unit];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: getArea
|
* Method: getArea
|
||||||
*
|
*
|
||||||
|
@ -322,7 +323,7 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
|
||||||
}
|
}
|
||||||
return area;
|
return area;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: getBestLength
|
* Method: getBestLength
|
||||||
* Based on the <displaySystem> returns the length of a geometry.
|
* Based on the <displaySystem> returns the length of a geometry.
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires OpenLayers/Control/DragFeature.js
|
* @requires OpenLayers/Control.js
|
||||||
* @requires OpenLayers/Control/SelectFeature.js
|
* @requires OpenLayers/Handler/Drag.js
|
||||||
* @requires OpenLayers/Handler/Keyboard.js
|
* @requires OpenLayers/Handler/Keyboard.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -22,6 +22,13 @@
|
||||||
*/
|
*/
|
||||||
OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: documentDrag
|
||||||
|
* {Boolean} If set to true, dragging vertices will continue even if the
|
||||||
|
* mouse cursor leaves the map viewport. Default is false.
|
||||||
|
*/
|
||||||
|
documentDrag: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: geometryTypes
|
* APIProperty: geometryTypes
|
||||||
* {Array(String)} To restrict modification to a limited set of geometry
|
* {Array(String)} To restrict modification to a limited set of geometry
|
||||||
|
@ -43,7 +50,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* Default is true.
|
* Default is true.
|
||||||
*/
|
*/
|
||||||
toggle: true,
|
toggle: true,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: standalone
|
* APIProperty: standalone
|
||||||
* {Boolean} Set to true to create a control without SelectFeature
|
* {Boolean} Set to true to create a control without SelectFeature
|
||||||
|
@ -60,20 +67,26 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* {<OpenLayers.Layer.Vector>}
|
* {<OpenLayers.Layer.Vector>}
|
||||||
*/
|
*/
|
||||||
layer: null,
|
layer: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: feature
|
* Property: feature
|
||||||
* {<OpenLayers.Feature.Vector>} Feature currently available for modification.
|
* {<OpenLayers.Feature.Vector>} Feature currently available for modification.
|
||||||
*/
|
*/
|
||||||
feature: null,
|
feature: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: vertex
|
||||||
|
* {<OpenLayers.Feature.Vector>} Vertex currently being modified.
|
||||||
|
*/
|
||||||
|
vertex: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: vertices
|
* Property: vertices
|
||||||
* {Array(<OpenLayers.Feature.Vector>)} Verticies currently available
|
* {Array(<OpenLayers.Feature.Vector>)} Verticies currently available
|
||||||
* for dragging.
|
* for dragging.
|
||||||
*/
|
*/
|
||||||
vertices: null,
|
vertices: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: virtualVertices
|
* Property: virtualVertices
|
||||||
* {Array(<OpenLayers.Feature.Vector>)} Virtual vertices in the middle
|
* {Array(<OpenLayers.Feature.Vector>)} Virtual vertices in the middle
|
||||||
|
@ -81,24 +94,12 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
virtualVertices: null,
|
virtualVertices: null,
|
||||||
|
|
||||||
/**
|
|
||||||
* Property: selectControl
|
|
||||||
* {<OpenLayers.Control.SelectFeature>}
|
|
||||||
*/
|
|
||||||
selectControl: null,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Property: dragControl
|
|
||||||
* {<OpenLayers.Control.DragFeature>}
|
|
||||||
*/
|
|
||||||
dragControl: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: handlers
|
* Property: handlers
|
||||||
* {Object}
|
* {Object}
|
||||||
*/
|
*/
|
||||||
handlers: null,
|
handlers: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: deleteCodes
|
* APIProperty: deleteCodes
|
||||||
* {Array(Integer)} Keycodes for deleting verticies. Set to null to disable
|
* {Array(Integer)} Keycodes for deleting verticies. Set to null to disable
|
||||||
|
@ -113,7 +114,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* {Object} A symbolizer to be used for virtual vertices.
|
* {Object} A symbolizer to be used for virtual vertices.
|
||||||
*/
|
*/
|
||||||
virtualStyle: null,
|
virtualStyle: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: vertexRenderIntent
|
* APIProperty: vertexRenderIntent
|
||||||
* {String} The renderIntent to use for vertices. If no <virtualStyle> is
|
* {String} The renderIntent to use for vertices. If no <virtualStyle> is
|
||||||
|
@ -225,63 +226,50 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
if(!(OpenLayers.Util.isArray(this.deleteCodes))) {
|
if(!(OpenLayers.Util.isArray(this.deleteCodes))) {
|
||||||
this.deleteCodes = [this.deleteCodes];
|
this.deleteCodes = [this.deleteCodes];
|
||||||
}
|
}
|
||||||
var control = this;
|
|
||||||
|
// configure the drag handler
|
||||||
// configure the select control
|
var dragCallbacks = {
|
||||||
var selectOptions = {
|
down: function(pixel) {
|
||||||
geometryTypes: this.geometryTypes,
|
this.vertex = null;
|
||||||
clickout: this.clickout,
|
var feature = this.layer.getFeatureFromEvent(
|
||||||
toggle: this.toggle,
|
this.handlers.drag.evt);
|
||||||
onBeforeSelect: this.beforeSelectFeature,
|
if (feature) {
|
||||||
onSelect: this.selectFeature,
|
this.dragStart(feature);
|
||||||
onUnselect: this.unselectFeature,
|
} else if (this.clickout) {
|
||||||
scope: this
|
this._unselect = this.feature;
|
||||||
};
|
}
|
||||||
if(this.standalone === false) {
|
|
||||||
this.selectControl = new OpenLayers.Control.SelectFeature(
|
|
||||||
layer, selectOptions
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// configure the drag control
|
|
||||||
var dragOptions = {
|
|
||||||
geometryTypes: ["OpenLayers.Geometry.Point"],
|
|
||||||
onStart: function(feature, pixel) {
|
|
||||||
control.dragStart.apply(control, [feature, pixel]);
|
|
||||||
},
|
},
|
||||||
onDrag: function(feature, pixel) {
|
move: function(pixel) {
|
||||||
control.dragVertex.apply(control, [feature, pixel]);
|
delete this._unselect;
|
||||||
|
if (this.vertex) {
|
||||||
|
this.dragVertex(this.vertex, pixel);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onComplete: function(feature) {
|
up: function() {
|
||||||
control.dragComplete.apply(control, [feature]);
|
this.handlers.drag.stopDown = false;
|
||||||
|
if (this._unselect) {
|
||||||
|
this.unselectFeature(this._unselect);
|
||||||
|
delete this._unselect;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
featureCallbacks: {
|
done: function(pixel) {
|
||||||
over: function(feature) {
|
if (this.vertex) {
|
||||||
/**
|
this.dragComplete(this.vertex);
|
||||||
* In normal mode, the feature handler is set up to allow
|
|
||||||
* dragging of all points. In standalone mode, we only
|
|
||||||
* want to allow dragging of sketch vertices and virtual
|
|
||||||
* vertices - or, in the case of a modifiable point, the
|
|
||||||
* point itself.
|
|
||||||
*/
|
|
||||||
if(control.standalone !== true || feature._sketch ||
|
|
||||||
control.feature === feature) {
|
|
||||||
control.dragControl.overFeature.apply(
|
|
||||||
control.dragControl, [feature]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.dragControl = new OpenLayers.Control.DragFeature(
|
var dragOptions = {
|
||||||
layer, dragOptions
|
documentDrag: this.documentDrag,
|
||||||
);
|
stopDown: false
|
||||||
|
};
|
||||||
|
|
||||||
// configure the keyboard handler
|
// configure the keyboard handler
|
||||||
var keyboardOptions = {
|
var keyboardOptions = {
|
||||||
keydown: this.handleKeypress
|
keydown: this.handleKeypress
|
||||||
};
|
};
|
||||||
this.handlers = {
|
this.handlers = {
|
||||||
keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions)
|
keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions),
|
||||||
|
drag: new OpenLayers.Handler.Drag(this, dragCallbacks, dragOptions)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -290,9 +278,14 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* Take care of things that are not handled in superclass.
|
* Take care of things that are not handled in superclass.
|
||||||
*/
|
*/
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
|
if (this.map) {
|
||||||
|
this.map.events.un({
|
||||||
|
"removelayer": this.handleMapEvents,
|
||||||
|
"changelayer": this.handleMapEvents,
|
||||||
|
scope: this
|
||||||
|
});
|
||||||
|
}
|
||||||
this.layer = null;
|
this.layer = null;
|
||||||
this.standalone || this.selectControl.destroy();
|
|
||||||
this.dragControl.destroy();
|
|
||||||
OpenLayers.Control.prototype.destroy.apply(this, []);
|
OpenLayers.Control.prototype.destroy.apply(this, []);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -304,8 +297,14 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* {Boolean} Successfully activated the control.
|
* {Boolean} Successfully activated the control.
|
||||||
*/
|
*/
|
||||||
activate: function() {
|
activate: function() {
|
||||||
return ((this.standalone || this.selectControl.activate()) &&
|
this.moveLayerToTop();
|
||||||
this.handlers.keyboard.activate() &&
|
this.map.events.on({
|
||||||
|
"removelayer": this.handleMapEvents,
|
||||||
|
"changelayer": this.handleMapEvents,
|
||||||
|
scope: this
|
||||||
|
});
|
||||||
|
return (this.handlers.keyboard.activate() &&
|
||||||
|
this.handlers.drag.activate() &&
|
||||||
OpenLayers.Control.prototype.activate.apply(this, arguments));
|
OpenLayers.Control.prototype.activate.apply(this, arguments));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -320,29 +319,26 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
var deactivated = false;
|
var deactivated = false;
|
||||||
// the return from the controls is unimportant in this case
|
// the return from the controls is unimportant in this case
|
||||||
if(OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {
|
if(OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {
|
||||||
|
this.moveLayerBack();
|
||||||
|
this.map.events.un({
|
||||||
|
"removelayer": this.handleMapEvents,
|
||||||
|
"changelayer": this.handleMapEvents,
|
||||||
|
scope: this
|
||||||
|
});
|
||||||
this.layer.removeFeatures(this.vertices, {silent: true});
|
this.layer.removeFeatures(this.vertices, {silent: true});
|
||||||
this.layer.removeFeatures(this.virtualVertices, {silent: true});
|
this.layer.removeFeatures(this.virtualVertices, {silent: true});
|
||||||
this.vertices = [];
|
this.vertices = [];
|
||||||
this.dragControl.deactivate();
|
this.handlers.drag.deactivate();
|
||||||
var feature = this.feature;
|
|
||||||
var valid = feature && feature.geometry && feature.layer;
|
|
||||||
if(this.standalone === false) {
|
|
||||||
if(valid) {
|
|
||||||
this.selectControl.unselect.apply(this.selectControl,
|
|
||||||
[feature]);
|
|
||||||
}
|
|
||||||
this.selectControl.deactivate();
|
|
||||||
} else {
|
|
||||||
if(valid) {
|
|
||||||
this.unselectFeature(feature);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.handlers.keyboard.deactivate();
|
this.handlers.keyboard.deactivate();
|
||||||
|
var feature = this.feature;
|
||||||
|
if (feature && feature.geometry && feature.layer) {
|
||||||
|
this.unselectFeature(feature);
|
||||||
|
}
|
||||||
deactivated = true;
|
deactivated = true;
|
||||||
}
|
}
|
||||||
return deactivated;
|
return deactivated;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: beforeSelectFeature
|
* Method: beforeSelectFeature
|
||||||
* Called before a feature is selected.
|
* Called before a feature is selected.
|
||||||
|
@ -359,19 +355,28 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
/**
|
/**
|
||||||
* APIMethod: selectFeature
|
* APIMethod: selectFeature
|
||||||
* Select a feature for modification in standalone mode. In non-standalone
|
* Select a feature for modification in standalone mode. In non-standalone
|
||||||
* mode, this method is called when the select feature control selects a
|
* mode, this method is called when a feature is selected by clicking.
|
||||||
* feature. Register a listener to the beforefeaturemodified event and
|
* Register a listener to the beforefeaturemodified event and return false
|
||||||
* return false to prevent feature modification.
|
* to prevent feature modification.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* feature - {<OpenLayers.Feature.Vector>} the selected feature.
|
* feature - {<OpenLayers.Feature.Vector>} the selected feature.
|
||||||
*/
|
*/
|
||||||
selectFeature: function(feature) {
|
selectFeature: function(feature) {
|
||||||
if (!this.standalone || this.beforeSelectFeature(feature) !== false) {
|
if (this.feature === feature ||
|
||||||
|
(this.geometryTypes && OpenLayers.Util.indexOf(this.geometryTypes,
|
||||||
|
feature.geometry.CLASS_NAME) == -1)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.beforeSelectFeature(feature) !== false) {
|
||||||
|
if (this.feature) {
|
||||||
|
this.unselectFeature(this.feature);
|
||||||
|
}
|
||||||
this.feature = feature;
|
this.feature = feature;
|
||||||
|
this.layer.selectedFeatures.push(feature);
|
||||||
|
this.layer.drawFeature(feature, 'select');
|
||||||
this.modified = false;
|
this.modified = false;
|
||||||
this.resetVertices();
|
this.resetVertices();
|
||||||
this.dragControl.activate();
|
|
||||||
this.onModificationStart(this.feature);
|
this.onModificationStart(this.feature);
|
||||||
}
|
}
|
||||||
// keep track of geometry modifications
|
// keep track of geometry modifications
|
||||||
|
@ -401,8 +406,9 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
this.layer.destroyFeatures([this.radiusHandle], {silent: true});
|
this.layer.destroyFeatures([this.radiusHandle], {silent: true});
|
||||||
delete this.radiusHandle;
|
delete this.radiusHandle;
|
||||||
}
|
}
|
||||||
|
this.layer.drawFeature(this.feature, 'default');
|
||||||
this.feature = null;
|
this.feature = null;
|
||||||
this.dragControl.deactivate();
|
OpenLayers.Util.removeItem(this.layer.selectedFeatures, feature);
|
||||||
this.onModificationEnd(feature);
|
this.onModificationEnd(feature);
|
||||||
this.layer.events.triggerEvent("afterfeaturemodified", {
|
this.layer.events.triggerEvent("afterfeaturemodified", {
|
||||||
feature: feature,
|
feature: feature,
|
||||||
|
@ -410,64 +416,48 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
});
|
});
|
||||||
this.modified = false;
|
this.modified = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: dragStart
|
* Method: dragStart
|
||||||
* Called by the drag feature control with before a feature is dragged.
|
* Called by the drag handler before a feature is dragged. This method is
|
||||||
* This method is used to differentiate between points and vertices
|
* used to differentiate between points and vertices
|
||||||
* of higher order geometries. This respects the <geometryTypes>
|
* of higher order geometries.
|
||||||
* property and forces a select of points when the drag control is
|
|
||||||
* already active (and stops events from propagating to the select
|
|
||||||
* control).
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* feature - {<OpenLayers.Feature.Vector>} The point or vertex about to be
|
* feature - {<OpenLayers.Feature.Vector>} The point or vertex about to be
|
||||||
* dragged.
|
* dragged.
|
||||||
* pixel - {<OpenLayers.Pixel>} Pixel location of the mouse event.
|
|
||||||
*/
|
*/
|
||||||
dragStart: function(feature, pixel) {
|
dragStart: function(feature) {
|
||||||
// only change behavior if the feature is not in the vertices array
|
var isPoint = feature.geometry.CLASS_NAME ==
|
||||||
if(feature != this.feature && !feature.geometry.parent &&
|
'OpenLayers.Geometry.Point';
|
||||||
feature != this.dragHandle && feature != this.radiusHandle) {
|
if (!this.standalone &&
|
||||||
if(this.standalone === false && this.feature) {
|
((!feature._sketch && isPoint) || !feature._sketch)) {
|
||||||
// unselect the currently selected feature
|
if (this.toggle && this.feature === feature) {
|
||||||
this.selectControl.clickFeature.apply(this.selectControl,
|
// mark feature for unselection
|
||||||
[this.feature]);
|
this._unselect = feature;
|
||||||
}
|
|
||||||
// check any constraints on the geometry type
|
|
||||||
if(this.geometryTypes == null ||
|
|
||||||
OpenLayers.Util.indexOf(this.geometryTypes,
|
|
||||||
feature.geometry.CLASS_NAME) != -1) {
|
|
||||||
// select the point
|
|
||||||
this.standalone || this.selectControl.clickFeature.apply(
|
|
||||||
this.selectControl, [feature]);
|
|
||||||
/**
|
|
||||||
* TBD: These lines improve workflow by letting the user
|
|
||||||
* immediately start dragging after the mouse down.
|
|
||||||
* However, it is very ugly to be messing with controls
|
|
||||||
* and their handlers in this way. I'd like a better
|
|
||||||
* solution if the workflow change is necessary.
|
|
||||||
*/
|
|
||||||
// prepare the point for dragging
|
|
||||||
this.dragControl.overFeature.apply(this.dragControl,
|
|
||||||
[feature]);
|
|
||||||
this.dragControl.lastPixel = pixel;
|
|
||||||
this.dragControl.handlers.drag.started = true;
|
|
||||||
this.dragControl.handlers.drag.start = pixel;
|
|
||||||
this.dragControl.handlers.drag.last = pixel;
|
|
||||||
}
|
}
|
||||||
|
this.selectFeature(feature);
|
||||||
|
}
|
||||||
|
if (feature._sketch || isPoint) {
|
||||||
|
// feature is a drag or virtual handle or point
|
||||||
|
this.vertex = feature;
|
||||||
|
this.handlers.drag.stopDown = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: dragVertex
|
* Method: dragVertex
|
||||||
* Called by the drag feature control with each drag move of a vertex.
|
* Called by the drag handler with each drag move of a vertex.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged.
|
* vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged.
|
||||||
* pixel - {<OpenLayers.Pixel>} Pixel location of the mouse event.
|
* pixel - {<OpenLayers.Pixel>} Pixel location of the mouse event.
|
||||||
*/
|
*/
|
||||||
dragVertex: function(vertex, pixel) {
|
dragVertex: function(vertex, pixel) {
|
||||||
|
var pos = this.map.getLonLatFromViewPortPx(pixel);
|
||||||
|
var geom = vertex.geometry;
|
||||||
|
geom.move(pos.lon - geom.x, pos.lat - geom.y);
|
||||||
this.modified = true;
|
this.modified = true;
|
||||||
/**
|
/**
|
||||||
* Five cases:
|
* Five cases:
|
||||||
|
@ -479,9 +469,6 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
if(this.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
|
if(this.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
|
||||||
// dragging a simple point
|
// dragging a simple point
|
||||||
if(this.feature != vertex) {
|
|
||||||
this.feature = vertex;
|
|
||||||
}
|
|
||||||
this.layer.events.triggerEvent("vertexmodified", {
|
this.layer.events.triggerEvent("vertexmodified", {
|
||||||
vertex: vertex.geometry,
|
vertex: vertex.geometry,
|
||||||
feature: this.feature,
|
feature: this.feature,
|
||||||
|
@ -518,7 +505,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
this.virtualVertices = [];
|
this.virtualVertices = [];
|
||||||
}
|
}
|
||||||
this.layer.drawFeature(this.feature, this.standalone ? undefined :
|
this.layer.drawFeature(this.feature, this.standalone ? undefined :
|
||||||
this.selectControl.renderIntent);
|
'select');
|
||||||
}
|
}
|
||||||
// keep the vertex on top so it gets the mouseout after dragging
|
// keep the vertex on top so it gets the mouseout after dragging
|
||||||
// this should be removed in favor of an option to draw under or
|
// this should be removed in favor of an option to draw under or
|
||||||
|
@ -528,7 +515,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: dragComplete
|
* Method: dragComplete
|
||||||
* Called by the drag feature control when the feature dragging is complete.
|
* Called by the drag handler when the feature dragging is complete.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged.
|
* vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged.
|
||||||
|
@ -564,16 +551,6 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* Method: resetVertices
|
* Method: resetVertices
|
||||||
*/
|
*/
|
||||||
resetVertices: function() {
|
resetVertices: function() {
|
||||||
// if coming from a drag complete we're about to destroy the vertex
|
|
||||||
// that was just dragged. For that reason, the drag feature control
|
|
||||||
// will never detect a mouse-out on that vertex, meaning that the drag
|
|
||||||
// handler won't be deactivated. This can cause errors because the drag
|
|
||||||
// feature control still has a feature to drag but that feature is
|
|
||||||
// destroyed. To prevent this, we call outFeature on the drag feature
|
|
||||||
// control if the control actually has a feature to drag.
|
|
||||||
if(this.dragControl.feature) {
|
|
||||||
this.dragControl.outFeature(this.dragControl.feature);
|
|
||||||
}
|
|
||||||
if(this.vertices.length > 0) {
|
if(this.vertices.length > 0) {
|
||||||
this.layer.removeFeatures(this.vertices, {silent: true});
|
this.layer.removeFeatures(this.vertices, {silent: true});
|
||||||
this.vertices = [];
|
this.vertices = [];
|
||||||
|
@ -624,11 +601,10 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
// check for delete key
|
// check for delete key
|
||||||
if(this.feature &&
|
if(this.feature &&
|
||||||
OpenLayers.Util.indexOf(this.deleteCodes, code) != -1) {
|
OpenLayers.Util.indexOf(this.deleteCodes, code) != -1) {
|
||||||
var vertex = this.dragControl.feature;
|
var vertex = this.layer.getFeatureFromEvent(this.handlers.drag.evt);
|
||||||
if(vertex &&
|
if (vertex &&
|
||||||
OpenLayers.Util.indexOf(this.vertices, vertex) != -1 &&
|
OpenLayers.Util.indexOf(this.vertices, vertex) != -1 &&
|
||||||
!this.dragControl.handlers.drag.dragging &&
|
!this.handlers.drag.dragging && vertex.geometry.parent) {
|
||||||
vertex.geometry.parent) {
|
|
||||||
// remove the vertex
|
// remove the vertex
|
||||||
vertex.geometry.parent.removeComponent(vertex.geometry);
|
vertex.geometry.parent.removeComponent(vertex.geometry);
|
||||||
this.layer.events.triggerEvent("vertexremoved", {
|
this.layer.events.triggerEvent("vertexremoved", {
|
||||||
|
@ -637,8 +613,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
pixel: evt.xy
|
pixel: evt.xy
|
||||||
});
|
});
|
||||||
this.layer.drawFeature(this.feature, this.standalone ?
|
this.layer.drawFeature(this.feature, this.standalone ?
|
||||||
undefined :
|
undefined : 'select');
|
||||||
this.selectControl.renderIntent);
|
|
||||||
this.modified = true;
|
this.modified = true;
|
||||||
this.resetVertices();
|
this.resetVertices();
|
||||||
this.setFeatureState();
|
this.setFeatureState();
|
||||||
|
@ -792,11 +767,49 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* map - {<OpenLayers.Map>} The control's map.
|
* map - {<OpenLayers.Map>} The control's map.
|
||||||
*/
|
*/
|
||||||
setMap: function(map) {
|
setMap: function(map) {
|
||||||
this.standalone || this.selectControl.setMap(map);
|
this.handlers.drag.setMap(map);
|
||||||
this.dragControl.setMap(map);
|
|
||||||
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: handleMapEvents
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* evt - {Object}
|
||||||
|
*/
|
||||||
|
handleMapEvents: function(evt) {
|
||||||
|
if (evt.type == "removelayer" || evt.property == "order") {
|
||||||
|
this.moveLayerToTop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: moveLayerToTop
|
||||||
|
* Moves the layer for this handler to the top, so mouse events can reach
|
||||||
|
* it.
|
||||||
|
*/
|
||||||
|
moveLayerToTop: function() {
|
||||||
|
var index = Math.max(this.map.Z_INDEX_BASE['Feature'] - 1,
|
||||||
|
this.layer.getZIndex()) + 1;
|
||||||
|
this.layer.setZIndex(index);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: moveLayerBack
|
||||||
|
* Moves the layer back to the position determined by the map's layers
|
||||||
|
* array.
|
||||||
|
*/
|
||||||
|
moveLayerBack: function() {
|
||||||
|
var index = this.layer.getZIndex() - 1;
|
||||||
|
if (index >= this.map.Z_INDEX_BASE['Feature']) {
|
||||||
|
this.layer.setZIndex(index);
|
||||||
|
} else {
|
||||||
|
this.map.setLayerZIndex(this.layer,
|
||||||
|
this.map.getLayerIndex(this.layer));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Control.ModifyFeature"
|
CLASS_NAME: "OpenLayers.Control.ModifyFeature"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -13,11 +13,23 @@
|
||||||
* The MousePosition control displays geographic coordinates of the mouse
|
* The MousePosition control displays geographic coordinates of the mouse
|
||||||
* pointer, as it is moved about the map.
|
* pointer, as it is moved about the map.
|
||||||
*
|
*
|
||||||
|
* You can use the <prefix>- or <suffix>-properties to provide more information
|
||||||
|
* about the displayed coordinates to the user:
|
||||||
|
*
|
||||||
|
* (code)
|
||||||
|
* var mousePositionCtrl = new OpenLayers.Control.MousePosition({
|
||||||
|
* prefix: '<a target="_blank" ' +
|
||||||
|
* 'href="http://spatialreference.org/ref/epsg/4326/">' +
|
||||||
|
* 'EPSG:4326</a> coordinates: '
|
||||||
|
* }
|
||||||
|
* );
|
||||||
|
* (end code)
|
||||||
|
*
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
* - <OpenLayers.Control>
|
* - <OpenLayers.Control>
|
||||||
*/
|
*/
|
||||||
OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: autoActivate
|
* APIProperty: autoActivate
|
||||||
* {Boolean} Activate the control when it is added to a map. Default is
|
* {Boolean} Activate the control when it is added to a map. Default is
|
||||||
|
@ -25,50 +37,55 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
autoActivate: true,
|
autoActivate: true,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: element
|
* Property: element
|
||||||
* {DOMElement}
|
* {DOMElement}
|
||||||
*/
|
*/
|
||||||
element: null,
|
element: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: prefix
|
* APIProperty: prefix
|
||||||
* {String}
|
* {String} A string to be prepended to the current pointers coordinates
|
||||||
|
* when it is rendered. Defaults to the empty string ''.
|
||||||
*/
|
*/
|
||||||
prefix: '',
|
prefix: '',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: separator
|
* APIProperty: separator
|
||||||
* {String}
|
* {String} A string to be used to seperate the two coordinates from each
|
||||||
|
* other. Defaults to the string ', ', which will result in a
|
||||||
|
* rendered coordinate of e.g. '42.12, 21.22'.
|
||||||
*/
|
*/
|
||||||
separator: ', ',
|
separator: ', ',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: suffix
|
* APIProperty: suffix
|
||||||
* {String}
|
* {String} A string to be appended to the current pointers coordinates
|
||||||
|
* when it is rendered. Defaults to the empty string ''.
|
||||||
*/
|
*/
|
||||||
suffix: '',
|
suffix: '',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: numDigits
|
* APIProperty: numDigits
|
||||||
* {Integer}
|
* {Integer} The number of digits each coordinate shall have when being
|
||||||
|
* rendered, Defaults to 5.
|
||||||
*/
|
*/
|
||||||
numDigits: 5,
|
numDigits: 5,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: granularity
|
* APIProperty: granularity
|
||||||
* {Integer}
|
* {Integer}
|
||||||
*/
|
*/
|
||||||
granularity: 10,
|
granularity: 10,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: emptyString
|
* APIProperty: emptyString
|
||||||
* {String} Set this to some value to set when the mouse is outside the
|
* {String} Set this to some value to set when the mouse is outside the
|
||||||
* map.
|
* map.
|
||||||
*/
|
*/
|
||||||
emptyString: null,
|
emptyString: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: lastXy
|
* Property: lastXy
|
||||||
* {<OpenLayers.Pixel>}
|
* {<OpenLayers.Pixel>}
|
||||||
*/
|
*/
|
||||||
|
@ -76,14 +93,14 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: displayProjection
|
* APIProperty: displayProjection
|
||||||
* {<OpenLayers.Projection>} The projection in which the
|
* {<OpenLayers.Projection>} The projection in which the mouse position is
|
||||||
* mouse position is displayed
|
* displayed.
|
||||||
*/
|
*/
|
||||||
displayProjection: null,
|
displayProjection: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Control.MousePosition
|
* Constructor: OpenLayers.Control.MousePosition
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* options - {Object} Options for control.
|
* options - {Object} Options for control.
|
||||||
*/
|
*/
|
||||||
|
@ -109,7 +126,7 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: deactivate
|
* APIMethod: deactivate
|
||||||
*/
|
*/
|
||||||
|
@ -127,7 +144,7 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||||
/**
|
/**
|
||||||
* Method: draw
|
* Method: draw
|
||||||
* {DOMElement}
|
* {DOMElement}
|
||||||
*/
|
*/
|
||||||
draw: function() {
|
draw: function() {
|
||||||
OpenLayers.Control.prototype.draw.apply(this, arguments);
|
OpenLayers.Control.prototype.draw.apply(this, arguments);
|
||||||
|
|
||||||
|
@ -136,12 +153,12 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||||
this.div.top = "";
|
this.div.top = "";
|
||||||
this.element = this.div;
|
this.element = this.div;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.div;
|
return this.div;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: redraw
|
* Method: redraw
|
||||||
*/
|
*/
|
||||||
redraw: function(evt) {
|
redraw: function(evt) {
|
||||||
|
|
||||||
|
@ -160,18 +177,18 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||||
}
|
}
|
||||||
|
|
||||||
lonLat = this.map.getLonLatFromPixel(evt.xy);
|
lonLat = this.map.getLonLatFromPixel(evt.xy);
|
||||||
if (!lonLat) {
|
if (!lonLat) {
|
||||||
// map has not yet been properly initialized
|
// map has not yet been properly initialized
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.displayProjection) {
|
if (this.displayProjection) {
|
||||||
lonLat.transform(this.map.getProjectionObject(),
|
lonLat.transform(this.map.getProjectionObject(),
|
||||||
this.displayProjection );
|
this.displayProjection );
|
||||||
}
|
}
|
||||||
this.lastXy = evt.xy;
|
this.lastXy = evt.xy;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var newHtml = this.formatOutput(lonLat);
|
var newHtml = this.formatOutput(lonLat);
|
||||||
|
|
||||||
if (newHtml != this.element.innerHTML) {
|
if (newHtml != this.element.innerHTML) {
|
||||||
|
@ -200,7 +217,7 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
|
||||||
var newHtml =
|
var newHtml =
|
||||||
this.prefix +
|
this.prefix +
|
||||||
lonLat.lon.toFixed(digits) +
|
lonLat.lon.toFixed(digits) +
|
||||||
this.separator +
|
this.separator +
|
||||||
lonLat.lat.toFixed(digits) +
|
lonLat.lat.toFixed(digits) +
|
||||||
this.suffix;
|
this.suffix;
|
||||||
return newHtml;
|
return newHtml;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -77,7 +77,9 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||||
/**
|
/**
|
||||||
* Property: mouseWheelOptions
|
* Property: mouseWheelOptions
|
||||||
* {Object} Options passed to the MouseWheel control (only useful if
|
* {Object} Options passed to the MouseWheel control (only useful if
|
||||||
* <zoomWheelEnabled> is set to true)
|
* <zoomWheelEnabled> is set to true). Default is no options for maps
|
||||||
|
* with fractionalZoom set to true, otherwise
|
||||||
|
* {cumulative: false, interval: 50, maxDelta: 6}
|
||||||
*/
|
*/
|
||||||
mouseWheelOptions: null,
|
mouseWheelOptions: null,
|
||||||
|
|
||||||
|
@ -208,10 +210,15 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||||
{map: this.map, keyMask: this.zoomBoxKeyMask});
|
{map: this.map, keyMask: this.zoomBoxKeyMask});
|
||||||
this.dragPan.draw();
|
this.dragPan.draw();
|
||||||
this.zoomBox.draw();
|
this.zoomBox.draw();
|
||||||
|
var wheelOptions = this.map.fractionalZoom ? {} : {
|
||||||
|
cumulative: false,
|
||||||
|
interval: 50,
|
||||||
|
maxDelta: 6
|
||||||
|
};
|
||||||
this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
|
this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
|
||||||
this, {"up" : this.wheelUp,
|
this, {up : this.wheelUp, down: this.wheelDown},
|
||||||
"down": this.wheelDown},
|
OpenLayers.Util.extend(wheelOptions, this.mouseWheelOptions)
|
||||||
this.mouseWheelOptions );
|
);
|
||||||
if (OpenLayers.Control.PinchZoom) {
|
if (OpenLayers.Control.PinchZoom) {
|
||||||
this.pinchZoom = new OpenLayers.Control.PinchZoom(
|
this.pinchZoom = new OpenLayers.Control.PinchZoom(
|
||||||
OpenLayers.Util.extend(
|
OpenLayers.Util.extend(
|
||||||
|
@ -238,8 +245,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* evt - {Event}
|
* evt - {Event}
|
||||||
*/
|
*/
|
||||||
defaultDblClick: function (evt) {
|
defaultDblClick: function (evt) {
|
||||||
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
this.map.zoomTo(this.map.zoom + 1, evt.xy);
|
||||||
this.map.setCenter(newCenter, this.map.zoom + 1);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -249,8 +255,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* evt - {Event}
|
* evt - {Event}
|
||||||
*/
|
*/
|
||||||
defaultDblRightClick: function (evt) {
|
defaultDblRightClick: function (evt) {
|
||||||
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
this.map.zoomTo(this.map.zoom - 1, evt.xy);
|
||||||
this.map.setCenter(newCenter, this.map.zoom - 1);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -261,22 +266,17 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* deltaZ - {Integer}
|
* deltaZ - {Integer}
|
||||||
*/
|
*/
|
||||||
wheelChange: function(evt, deltaZ) {
|
wheelChange: function(evt, deltaZ) {
|
||||||
var currentZoom = this.map.getZoom();
|
if (!this.map.fractionalZoom) {
|
||||||
var newZoom = this.map.getZoom() + Math.round(deltaZ);
|
deltaZ = Math.round(deltaZ);
|
||||||
|
}
|
||||||
|
var currentZoom = this.map.getZoom(),
|
||||||
|
newZoom = currentZoom + deltaZ;
|
||||||
newZoom = Math.max(newZoom, 0);
|
newZoom = Math.max(newZoom, 0);
|
||||||
newZoom = Math.min(newZoom, this.map.getNumZoomLevels());
|
newZoom = Math.min(newZoom, this.map.getNumZoomLevels());
|
||||||
if (newZoom === currentZoom) {
|
if (newZoom === currentZoom) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var size = this.map.getSize();
|
this.map.zoomTo(newZoom, evt.xy);
|
||||||
var deltaX = size.w/2 - evt.xy.x;
|
|
||||||
var deltaY = evt.xy.y - size.h/2;
|
|
||||||
var newRes = this.map.baseLayer.getResolutionForZoom(newZoom);
|
|
||||||
var zoomPoint = this.map.getLonLatFromPixel(evt.xy);
|
|
||||||
var newCenter = new OpenLayers.LonLat(
|
|
||||||
zoomPoint.lon + deltaX * newRes,
|
|
||||||
zoomPoint.lat + deltaY * newRes );
|
|
||||||
this.map.setCenter( newCenter, newZoom );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -7,6 +7,9 @@
|
||||||
* @requires OpenLayers/Control.js
|
* @requires OpenLayers/Control.js
|
||||||
* @requires OpenLayers/BaseTypes.js
|
* @requires OpenLayers/BaseTypes.js
|
||||||
* @requires OpenLayers/Events/buttonclick.js
|
* @requires OpenLayers/Events/buttonclick.js
|
||||||
|
* @requires OpenLayers/Map.js
|
||||||
|
* @requires OpenLayers/Handler/Click.js
|
||||||
|
* @requires OpenLayers/Handler/Drag.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,6 +130,20 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
maximized: false,
|
maximized: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: maximizeTitle
|
||||||
|
* {String} This property is used for showing a tooltip over the
|
||||||
|
* maximize div. Defaults to "" (no title).
|
||||||
|
*/
|
||||||
|
maximizeTitle: "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: minimizeTitle
|
||||||
|
* {String} This property is used for showing a tooltip over the
|
||||||
|
* minimize div. Defaults to "" (no title).
|
||||||
|
*/
|
||||||
|
minimizeTitle: "",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Control.OverviewMap
|
* Constructor: OpenLayers.Control.OverviewMap
|
||||||
* Create a new overview map
|
* Create a new overview map
|
||||||
|
@ -247,6 +264,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||||
'absolute');
|
'absolute');
|
||||||
this.maximizeDiv.style.display = 'none';
|
this.maximizeDiv.style.display = 'none';
|
||||||
this.maximizeDiv.className = this.displayClass + 'MaximizeButton olButton';
|
this.maximizeDiv.className = this.displayClass + 'MaximizeButton olButton';
|
||||||
|
if (this.maximizeTitle) {
|
||||||
|
this.maximizeDiv.title = this.maximizeTitle;
|
||||||
|
}
|
||||||
this.div.appendChild(this.maximizeDiv);
|
this.div.appendChild(this.maximizeDiv);
|
||||||
|
|
||||||
// minimize button div
|
// minimize button div
|
||||||
|
@ -259,6 +279,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||||
'absolute');
|
'absolute');
|
||||||
this.minimizeDiv.style.display = 'none';
|
this.minimizeDiv.style.display = 'none';
|
||||||
this.minimizeDiv.className = this.displayClass + 'MinimizeButton olButton';
|
this.minimizeDiv.className = this.displayClass + 'MinimizeButton olButton';
|
||||||
|
if (this.minimizeTitle) {
|
||||||
|
this.minimizeDiv.title = this.minimizeTitle;
|
||||||
|
}
|
||||||
this.div.appendChild(this.minimizeDiv);
|
this.div.appendChild(this.minimizeDiv);
|
||||||
this.minimizeControl();
|
this.minimizeControl();
|
||||||
} else {
|
} else {
|
||||||
|
@ -398,8 +421,12 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* minimize - {Boolean}
|
* minimize - {Boolean}
|
||||||
*/
|
*/
|
||||||
showToggle: function(minimize) {
|
showToggle: function(minimize) {
|
||||||
this.maximizeDiv.style.display = minimize ? '' : 'none';
|
if (this.maximizeDiv) {
|
||||||
this.minimizeDiv.style.display = minimize ? 'none' : '';
|
this.maximizeDiv.style.display = minimize ? '' : 'none';
|
||||||
|
}
|
||||||
|
if (this.minimizeDiv) {
|
||||||
|
this.minimizeDiv.style.display = minimize ? 'none' : '';
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -426,7 +453,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
isSuitableOverview: function() {
|
isSuitableOverview: function() {
|
||||||
var mapExtent = this.map.getExtent();
|
var mapExtent = this.map.getExtent();
|
||||||
var maxExtent = this.map.maxExtent;
|
var maxExtent = this.map.getMaxExtent();
|
||||||
var testExtent = new OpenLayers.Bounds(
|
var testExtent = new OpenLayers.Bounds(
|
||||||
Math.max(mapExtent.left, maxExtent.left),
|
Math.max(mapExtent.left, maxExtent.left),
|
||||||
Math.max(mapExtent.bottom, maxExtent.bottom),
|
Math.max(mapExtent.bottom, maxExtent.bottom),
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires OpenLayers/Control.js
|
* @requires OpenLayers/Control/Button.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
* - <OpenLayers.Control>
|
* - <OpenLayers.Control>
|
||||||
*/
|
*/
|
||||||
OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
|
OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control.Button, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: slideFactor
|
* APIProperty: slideFactor
|
||||||
|
@ -40,14 +40,6 @@ OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
direction: null,
|
direction: null,
|
||||||
|
|
||||||
/**
|
|
||||||
* Property: type
|
|
||||||
* {String} The type of <OpenLayers.Control> -- When added to a
|
|
||||||
* <Control.Panel>, 'type' is used by the panel to determine how to
|
|
||||||
* handle our events.
|
|
||||||
*/
|
|
||||||
type: OpenLayers.Control.TYPE_BUTTON,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Control.Pan
|
* Constructor: OpenLayers.Control.Pan
|
||||||
* Control which handles the panning (in any of the cardinal directions)
|
* Control which handles the panning (in any of the cardinal directions)
|
||||||
|
@ -70,26 +62,27 @@ OpenLayers.Control.Pan = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* Method: trigger
|
* Method: trigger
|
||||||
*/
|
*/
|
||||||
trigger: function(){
|
trigger: function(){
|
||||||
|
if (this.map) {
|
||||||
|
var getSlideFactor = OpenLayers.Function.bind(function (dim) {
|
||||||
|
return this.slideRatio ?
|
||||||
|
this.map.getSize()[dim] * this.slideRatio :
|
||||||
|
this.slideFactor;
|
||||||
|
}, this);
|
||||||
|
|
||||||
var getSlideFactor = OpenLayers.Function.bind(function (dim) {
|
switch (this.direction) {
|
||||||
return this.slideRatio ?
|
case OpenLayers.Control.Pan.NORTH:
|
||||||
this.map.getSize()[dim] * this.slideRatio :
|
this.map.pan(0, -getSlideFactor("h"));
|
||||||
this.slideFactor;
|
break;
|
||||||
}, this);
|
case OpenLayers.Control.Pan.SOUTH:
|
||||||
|
this.map.pan(0, getSlideFactor("h"));
|
||||||
switch (this.direction) {
|
break;
|
||||||
case OpenLayers.Control.Pan.NORTH:
|
case OpenLayers.Control.Pan.WEST:
|
||||||
this.map.pan(0, -getSlideFactor("h"));
|
this.map.pan(-getSlideFactor("w"), 0);
|
||||||
break;
|
break;
|
||||||
case OpenLayers.Control.Pan.SOUTH:
|
case OpenLayers.Control.Pan.EAST:
|
||||||
this.map.pan(0, getSlideFactor("h"));
|
this.map.pan(getSlideFactor("w"), 0);
|
||||||
break;
|
break;
|
||||||
case OpenLayers.Control.Pan.WEST:
|
}
|
||||||
this.map.pan(-getSlideFactor("w"), 0);
|
|
||||||
break;
|
|
||||||
case OpenLayers.Control.Pan.EAST:
|
|
||||||
this.map.pan(getSlideFactor("w"), 0);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -99,6 +99,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||||
|
|
||||||
this.map.events.un({
|
this.map.events.un({
|
||||||
"changebaselayer": this.redraw,
|
"changebaselayer": this.redraw,
|
||||||
|
"updatesize": this.redraw,
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -116,7 +117,11 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||||
*/
|
*/
|
||||||
setMap: function(map) {
|
setMap: function(map) {
|
||||||
OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments);
|
OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments);
|
||||||
this.map.events.register("changebaselayer", this, this.redraw);
|
this.map.events.on({
|
||||||
|
"changebaselayer": this.redraw,
|
||||||
|
"updatesize": this.redraw,
|
||||||
|
scope: this
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -189,6 +194,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||||
_addZoomBar:function(centered) {
|
_addZoomBar:function(centered) {
|
||||||
var imgLocation = OpenLayers.Util.getImageLocation("slider.png");
|
var imgLocation = OpenLayers.Util.getImageLocation("slider.png");
|
||||||
var id = this.id + "_" + this.map.id;
|
var id = this.id + "_" + this.map.id;
|
||||||
|
var minZoom = this.map.getMinZoom();
|
||||||
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();
|
var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom();
|
||||||
var slider = OpenLayers.Util.createAlphaImageDiv(id,
|
var slider = OpenLayers.Util.createAlphaImageDiv(id,
|
||||||
centered.add(-1, zoomsToEnd * this.zoomStopHeight),
|
centered.add(-1, zoomsToEnd * this.zoomStopHeight),
|
||||||
|
@ -211,7 +217,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||||
|
|
||||||
var sz = {
|
var sz = {
|
||||||
w: this.zoomStopWidth,
|
w: this.zoomStopWidth,
|
||||||
h: this.zoomStopHeight * this.map.getNumZoomLevels()
|
h: this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom)
|
||||||
};
|
};
|
||||||
var imgLocation = OpenLayers.Util.getImageLocation("zoombar.png");
|
var imgLocation = OpenLayers.Util.getImageLocation("zoombar.png");
|
||||||
var div = null;
|
var div = null;
|
||||||
|
@ -242,7 +248,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||||
this.map.events.register("zoomend", this, this.moveZoomBar);
|
this.map.events.register("zoomend", this, this.moveZoomBar);
|
||||||
|
|
||||||
centered = centered.add(0,
|
centered = centered.add(0,
|
||||||
this.zoomStopHeight * this.map.getNumZoomLevels());
|
this.zoomStopHeight * (this.map.getNumZoomLevels() - minZoom));
|
||||||
return centered;
|
return centered;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -172,11 +172,18 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
|
||||||
updateLink: function() {
|
updateLink: function() {
|
||||||
var separator = this.anchor ? '#' : '?';
|
var separator = this.anchor ? '#' : '?';
|
||||||
var href = this.base;
|
var href = this.base;
|
||||||
|
var anchor = null;
|
||||||
|
if (href.indexOf("#") != -1 && this.anchor == false) {
|
||||||
|
anchor = href.substring( href.indexOf("#"), href.length);
|
||||||
|
}
|
||||||
if (href.indexOf(separator) != -1) {
|
if (href.indexOf(separator) != -1) {
|
||||||
href = href.substring( 0, href.indexOf(separator) );
|
href = href.substring( 0, href.indexOf(separator) );
|
||||||
}
|
}
|
||||||
|
var splits = href.split("#");
|
||||||
href += separator + OpenLayers.Util.getParameterString(this.createParams());
|
href = splits[0] + separator+ OpenLayers.Util.getParameterString(this.createParams());
|
||||||
|
if (anchor) {
|
||||||
|
href += anchor;
|
||||||
|
}
|
||||||
if (this.anchor && !this.element) {
|
if (this.anchor && !this.element) {
|
||||||
window.location.href = href;
|
window.location.href = href;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -21,12 +21,6 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
type: OpenLayers.Control.TYPE_TOOL,
|
type: OpenLayers.Control.TYPE_TOOL,
|
||||||
|
|
||||||
/**
|
|
||||||
* Property: containerCenter
|
|
||||||
* {Object} Cached object representing the layer container center (in pixels).
|
|
||||||
*/
|
|
||||||
containerCenter: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: pinchOrigin
|
* Property: pinchOrigin
|
||||||
* {Object} Cached object representing the pinch start (in pixels).
|
* {Object} Cached object representing the pinch start (in pixels).
|
||||||
|
@ -45,7 +39,23 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* true.
|
* true.
|
||||||
*/
|
*/
|
||||||
autoActivate: true,
|
autoActivate: true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: preserveCenter
|
||||||
|
* {Boolean} Set this to true if you don't want the map center to change
|
||||||
|
* while pinching. For example you may want to set preserveCenter to
|
||||||
|
* true when the user location is being watched and you want to preserve
|
||||||
|
* the user location at the center of the map even if he zooms in or
|
||||||
|
* out using pinch. This property's value can be changed any time on an
|
||||||
|
* existing instance. Default is false.
|
||||||
|
*/
|
||||||
|
preserveCenter: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: handlerOptions
|
||||||
|
* {Object} Used to set non-default properties on the pinch handler
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: OpenLayers.Control.PinchZoom
|
* Constructor: OpenLayers.Control.PinchZoom
|
||||||
* Create a control for zooming with pinch gestures. This works on devices
|
* Create a control for zooming with pinch gestures. This works on devices
|
||||||
|
@ -64,57 +74,6 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
|
||||||
}, this.handlerOptions);
|
}, this.handlerOptions);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* APIMethod: activate
|
|
||||||
* Activate this control. Must be called after the control is added to a
|
|
||||||
* map.
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* {Boolean} The control was successfully activated.
|
|
||||||
*/
|
|
||||||
activate: function() {
|
|
||||||
var activated = OpenLayers.Control.prototype.activate.apply(this,arguments);
|
|
||||||
if (activated) {
|
|
||||||
this.map.events.on({
|
|
||||||
moveend: this.updateContainerCenter,
|
|
||||||
scope: this
|
|
||||||
});
|
|
||||||
this.updateContainerCenter();
|
|
||||||
}
|
|
||||||
return activated;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* APIMethod: deactivate
|
|
||||||
* Deactivate this control.
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* {Boolean} The control was successfully deactivated.
|
|
||||||
*/
|
|
||||||
deactivate: function() {
|
|
||||||
var deactivated = OpenLayers.Control.prototype.deactivate.apply(this,arguments);
|
|
||||||
if (this.map && this.map.events) {
|
|
||||||
this.map.events.un({
|
|
||||||
moveend: this.updateContainerCenter,
|
|
||||||
scope: this
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return deactivated;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method: updateContainerCenter
|
|
||||||
* Must be called each time the layer container moves.
|
|
||||||
*/
|
|
||||||
updateContainerCenter: function() {
|
|
||||||
var container = this.map.layerContainerDiv;
|
|
||||||
// the layer container div is a square of 100px/100px
|
|
||||||
this.containerCenter = {
|
|
||||||
x: parseInt(container.style.left, 10) + 50,
|
|
||||||
y: parseInt(container.style.top, 10) + 50
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: pinchStart
|
* Method: pinchStart
|
||||||
*
|
*
|
||||||
|
@ -124,8 +83,10 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* of the pinch gesture. This give us the current scale of the pinch.
|
* of the pinch gesture. This give us the current scale of the pinch.
|
||||||
*/
|
*/
|
||||||
pinchStart: function(evt, pinchData) {
|
pinchStart: function(evt, pinchData) {
|
||||||
this.pinchOrigin = evt.xy;
|
var xy = (this.preserveCenter) ?
|
||||||
this.currentCenter = evt.xy;
|
this.map.getPixelFromLonLat(this.map.getCenter()) : evt.xy;
|
||||||
|
this.pinchOrigin = xy;
|
||||||
|
this.currentCenter = xy;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,29 +99,18 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
pinchMove: function(evt, pinchData) {
|
pinchMove: function(evt, pinchData) {
|
||||||
var scale = pinchData.scale;
|
var scale = pinchData.scale;
|
||||||
var containerCenter = this.containerCenter;
|
var containerOrigin = this.map.layerContainerOriginPx;
|
||||||
var pinchOrigin = this.pinchOrigin;
|
var pinchOrigin = this.pinchOrigin;
|
||||||
var current = evt.xy;
|
var current = (this.preserveCenter) ?
|
||||||
|
this.map.getPixelFromLonLat(this.map.getCenter()) : evt.xy;
|
||||||
|
|
||||||
var dx = Math.round((current.x - pinchOrigin.x) + (scale - 1) * (containerCenter.x - pinchOrigin.x));
|
var dx = Math.round((containerOrigin.x + current.x - pinchOrigin.x) + (scale - 1) * (containerOrigin.x - pinchOrigin.x));
|
||||||
var dy = Math.round((current.y - pinchOrigin.y) + (scale - 1) * (containerCenter.y - pinchOrigin.y));
|
var dy = Math.round((containerOrigin.y + current.y - pinchOrigin.y) + (scale - 1) * (containerOrigin.y - pinchOrigin.y));
|
||||||
|
|
||||||
this.applyTransform(
|
this.map.applyTransform(dx, dy, scale);
|
||||||
"translate(" + dx + "px, " + dy + "px) scale(" + scale + ")"
|
|
||||||
);
|
|
||||||
this.currentCenter = current;
|
this.currentCenter = current;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Method: applyTransform
|
|
||||||
* Applies the given transform to layers.
|
|
||||||
*/
|
|
||||||
applyTransform: function(transform) {
|
|
||||||
var style = this.map.layerContainerDiv.style;
|
|
||||||
style['-webkit-transform'] = transform;
|
|
||||||
style['-moz-transform'] = transform;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: pinchDone
|
* Method: pinchDone
|
||||||
*
|
*
|
||||||
|
@ -172,7 +122,7 @@ OpenLayers.Control.PinchZoom = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* of the pinch gesture. This give us the final scale of the pinch.
|
* of the pinch gesture. This give us the final scale of the pinch.
|
||||||
*/
|
*/
|
||||||
pinchDone: function(evt, start, last) {
|
pinchDone: function(evt, start, last) {
|
||||||
this.applyTransform("");
|
this.map.applyTransform();
|
||||||
var zoom = this.map.getZoomForResolution(this.map.getResolution() / last.scale, true);
|
var zoom = this.map.getZoomForResolution(this.map.getResolution() / last.scale, true);
|
||||||
if (zoom !== this.map.getZoom() || !this.currentCenter.equals(this.pinchOrigin)) {
|
if (zoom !== this.map.getZoom() || !this.currentCenter.equals(this.pinchOrigin)) {
|
||||||
var resolution = this.map.getResolutionForZoom(zoom);
|
var resolution = this.map.getResolutionForZoom(zoom);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -82,7 +82,6 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* APIProperty: handlerOptions
|
* APIProperty: handlerOptions
|
||||||
* {Object} Used to set non-default properties on the control's handler
|
* {Object} Used to set non-default properties on the control's handler
|
||||||
*/
|
*/
|
||||||
handlerOptions: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: sketchStyle
|
* APIProperty: sketchStyle
|
||||||
|
@ -97,7 +96,7 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* layerOptions: {
|
* layerOptions: {
|
||||||
* styleMap: new OpenLayers.StyleMap({
|
* styleMap: new OpenLayers.StyleMap({
|
||||||
* "default": {strokeColor: "yellow"}
|
* "default": {strokeColor: "yellow"}
|
||||||
* });
|
* })
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* });
|
* });
|
||||||
|
@ -534,12 +533,13 @@ OpenLayers.Control.SLDSelect = OpenLayers.Class(OpenLayers.Control, {
|
||||||
}
|
}
|
||||||
|
|
||||||
var selectionLayer = this.createSelectionLayer(layer);
|
var selectionLayer = this.createSelectionLayer(layer);
|
||||||
var sld = this.createSLD(layer, filters, geometryAttributes);
|
|
||||||
|
|
||||||
this.events.triggerEvent("selected", {
|
this.events.triggerEvent("selected", {
|
||||||
layer: layer,
|
layer: layer,
|
||||||
filters: filters
|
filters: filters
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var sld = this.createSLD(layer, filters, geometryAttributes);
|
||||||
|
|
||||||
selectionLayer.mergeNewParams({SLD_BODY: sld});
|
selectionLayer.mergeNewParams({SLD_BODY: sld});
|
||||||
delete this._queue;
|
delete this._queue;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -300,14 +300,22 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
unselectAll: function(options) {
|
unselectAll: function(options) {
|
||||||
// we'll want an option to supress notification here
|
// we'll want an option to supress notification here
|
||||||
var layers = this.layers || [this.layer];
|
var layers = this.layers || [this.layer],
|
||||||
var layer, feature;
|
layer, feature, l, numExcept;
|
||||||
for(var l=0; l<layers.length; ++l) {
|
for(l=0; l<layers.length; ++l) {
|
||||||
layer = layers[l];
|
layer = layers[l];
|
||||||
for(var i=layer.selectedFeatures.length-1; i>=0; --i) {
|
numExcept = 0;
|
||||||
feature = layer.selectedFeatures[i];
|
//layer.selectedFeatures is null when layer is destroyed and
|
||||||
if(!options || options.except != feature) {
|
//one of it's preremovelayer listener calls setLayer
|
||||||
this.unselect(feature);
|
//with another layer on this control
|
||||||
|
if(layer.selectedFeatures != null) {
|
||||||
|
while(layer.selectedFeatures.length > numExcept) {
|
||||||
|
feature = layer.selectedFeatures[numExcept];
|
||||||
|
if(!options || options.except != feature) {
|
||||||
|
this.unselect(feature);
|
||||||
|
} else {
|
||||||
|
++numExcept;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -124,7 +124,7 @@ OpenLayers.Control.Snapping = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* objects below. If the items in the targets list are vector layers
|
* objects below. If the items in the targets list are vector layers
|
||||||
* (instead of configuration objects), the defaults from the <defaults>
|
* (instead of configuration objects), the defaults from the <defaults>
|
||||||
* property will apply. The editable layer itself may be a target
|
* property will apply. The editable layer itself may be a target
|
||||||
* layer - allowing newly created or edited features to be snapped to
|
* layer, allowing newly created or edited features to be snapped to
|
||||||
* existing features from the same layer. If no targets are provided
|
* existing features from the same layer. If no targets are provided
|
||||||
* the layer given in the constructor (as <layer>) will become the
|
* the layer given in the constructor (as <layer>) will become the
|
||||||
* initial target.
|
* initial target.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -240,7 +240,7 @@ OpenLayers.Control.Split = OpenLayers.Class(OpenLayers.Control, {
|
||||||
var deactivated = OpenLayers.Control.prototype.deactivate.call(this);
|
var deactivated = OpenLayers.Control.prototype.deactivate.call(this);
|
||||||
if(deactivated) {
|
if(deactivated) {
|
||||||
if(this.source && this.source.events) {
|
if(this.source && this.source.events) {
|
||||||
this.layer.events.un({
|
this.source.events.un({
|
||||||
sketchcomplete: this.onSketchComplete,
|
sketchcomplete: this.onSketchComplete,
|
||||||
afterfeaturemodified: this.afterFeatureModified,
|
afterfeaturemodified: this.afterFeatureModified,
|
||||||
scope: this
|
scope: this
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -175,8 +175,7 @@ OpenLayers.Control.TouchNavigation = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* evt - {Event}
|
* evt - {Event}
|
||||||
*/
|
*/
|
||||||
defaultDblClick: function (evt) {
|
defaultDblClick: function (evt) {
|
||||||
var newCenter = this.map.getLonLatFromViewPortPx(evt.xy);
|
this.map.zoomTo(this.map.zoom + 1, evt.xy);
|
||||||
this.map.setCenter(newCenter, this.map.zoom + 1);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Control.TouchNavigation"
|
CLASS_NAME: "OpenLayers.Control.TouchNavigation"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -15,10 +15,10 @@
|
||||||
/**
|
/**
|
||||||
* Class: OpenLayers.Control.WMSGetFeatureInfo
|
* Class: OpenLayers.Control.WMSGetFeatureInfo
|
||||||
* The WMSGetFeatureInfo control uses a WMS query to get information about a point on the map. The
|
* The WMSGetFeatureInfo control uses a WMS query to get information about a point on the map. The
|
||||||
* information may be in a display-friendly format such as HTML, or a machine-friendly format such
|
* information may be in a display-friendly format such as HTML, or a machine-friendly format such
|
||||||
* as GML, depending on the server's capabilities and the client's configuration. This control
|
* as GML, depending on the server's capabilities and the client's configuration. This control
|
||||||
* handles click or hover events, attempts to parse the results using an OpenLayers.Format, and
|
* handles click or hover events, attempts to parse the results using an OpenLayers.Format, and
|
||||||
* fires a 'getfeatureinfo' event with the click position, the raw body of the response, and an
|
* fires a 'getfeatureinfo' event with the click position, the raw body of the response, and an
|
||||||
* array of features if it successfully read the response.
|
* array of features if it successfully read the response.
|
||||||
*
|
*
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
|
@ -49,23 +49,25 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
maxFeatures: 10,
|
maxFeatures: 10,
|
||||||
|
|
||||||
/** APIProperty: clickCallback
|
/**
|
||||||
* {String} The click callback to register in the
|
* APIProperty: clickCallback
|
||||||
* {<OpenLayers.Handler.Click>} object created when the hover
|
* {String} The click callback to register in the
|
||||||
* option is set to false. Default is "click".
|
* {<OpenLayers.Handler.Click>} object created when the hover
|
||||||
|
* option is set to false. Default is "click".
|
||||||
*/
|
*/
|
||||||
clickCallback: "click",
|
clickCallback: "click",
|
||||||
|
|
||||||
/** APIProperty: output
|
/**
|
||||||
* {String} Either "features" or "object". When triggering a
|
* APIProperty: output
|
||||||
* getfeatureinfo request should we pass on an array of features
|
* {String} Either "features" or "object". When triggering a getfeatureinfo
|
||||||
* or an object with with a "features" property and other properties
|
* request should we pass on an array of features or an object with with
|
||||||
* (such as the url of the WMS). Default is "features".
|
* a "features" property and other properties (such as the url of the
|
||||||
|
* WMS). Default is "features".
|
||||||
*/
|
*/
|
||||||
output: "features",
|
output: "features",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: layers
|
* APIProperty: layers
|
||||||
* {Array(<OpenLayers.Layer.WMS>)} The layers to query for feature info.
|
* {Array(<OpenLayers.Layer.WMS>)} The layers to query for feature info.
|
||||||
* If omitted, all map WMS layers with a url that matches this <url> or
|
* If omitted, all map WMS layers with a url that matches this <url> or
|
||||||
* <layerUrls> will be considered.
|
* <layerUrls> will be considered.
|
||||||
|
@ -73,21 +75,21 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
layers: null,
|
layers: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: queryVisible
|
* APIProperty: queryVisible
|
||||||
* {Boolean} If true, filter out hidden layers when searching the map for
|
* {Boolean} If true, filter out hidden layers when searching the map for
|
||||||
* layers to query. Default is false.
|
* layers to query. Default is false.
|
||||||
*/
|
*/
|
||||||
queryVisible: false,
|
queryVisible: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: url
|
* APIProperty: url
|
||||||
* {String} The URL of the WMS service to use. If not provided, the url
|
* {String} The URL of the WMS service to use. If not provided, the url
|
||||||
* of the first eligible layer will be used.
|
* of the first eligible layer will be used.
|
||||||
*/
|
*/
|
||||||
url: null,
|
url: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: layerUrls
|
* APIProperty: layerUrls
|
||||||
* {Array(String)} Optional list of urls for layers that should be queried.
|
* {Array(String)} Optional list of urls for layers that should be queried.
|
||||||
* This can be used when the layer url differs from the url used for
|
* This can be used when the layer url differs from the url used for
|
||||||
* making GetFeatureInfo requests (in the case of a layer using cached
|
* making GetFeatureInfo requests (in the case of a layer using cached
|
||||||
|
@ -96,18 +98,18 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
layerUrls: null,
|
layerUrls: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: infoFormat
|
* APIProperty: infoFormat
|
||||||
* {String} The mimetype to request from the server. If you are using
|
* {String} The mimetype to request from the server. If you are using
|
||||||
* drillDown mode and have multiple servers that do not share a common
|
* drillDown mode and have multiple servers that do not share a common
|
||||||
* infoFormat, you can override the control's infoFormat by providing an
|
* infoFormat, you can override the control's infoFormat by providing an
|
||||||
* INFO_FORMAT parameter in your <OpenLayers.Layer.WMS> instance(s).
|
* INFO_FORMAT parameter in your <OpenLayers.Layer.WMS> instance(s).
|
||||||
*/
|
*/
|
||||||
infoFormat: 'text/html',
|
infoFormat: 'text/html',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: vendorParams
|
* APIProperty: vendorParams
|
||||||
* {Object} Additional parameters that will be added to the request, for
|
* {Object} Additional parameters that will be added to the request, for
|
||||||
* WMS implementations that support them. This could e.g. look like
|
* WMS implementations that support them. This could e.g. look like
|
||||||
* (start code)
|
* (start code)
|
||||||
* {
|
* {
|
||||||
* radius: 5
|
* radius: 5
|
||||||
|
@ -115,16 +117,16 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* (end)
|
* (end)
|
||||||
*/
|
*/
|
||||||
vendorParams: {},
|
vendorParams: {},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: format
|
* APIProperty: format
|
||||||
* {<OpenLayers.Format>} A format for parsing GetFeatureInfo responses.
|
* {<OpenLayers.Format>} A format for parsing GetFeatureInfo responses.
|
||||||
* Default is <OpenLayers.Format.WMSGetFeatureInfo>.
|
* Default is <OpenLayers.Format.WMSGetFeatureInfo>.
|
||||||
*/
|
*/
|
||||||
format: null,
|
format: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: formatOptions
|
* APIProperty: formatOptions
|
||||||
* {Object} Optional properties to set on the format (if one is not provided
|
* {Object} Optional properties to set on the format (if one is not provided
|
||||||
* in the <format> property.
|
* in the <format> property.
|
||||||
*/
|
*/
|
||||||
|
@ -140,22 +142,21 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* }
|
* }
|
||||||
* (end)
|
* (end)
|
||||||
*/
|
*/
|
||||||
handlerOptions: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: handler
|
* Property: handler
|
||||||
* {Object} Reference to the <OpenLayers.Handler> for this control
|
* {Object} Reference to the <OpenLayers.Handler> for this control
|
||||||
*/
|
*/
|
||||||
handler: null,
|
handler: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: hoverRequest
|
* Property: hoverRequest
|
||||||
* {<OpenLayers.Request>} contains the currently running hover request
|
* {<OpenLayers.Request>} contains the currently running hover request
|
||||||
* (if any).
|
* (if any).
|
||||||
*/
|
*/
|
||||||
hoverRequest: null,
|
hoverRequest: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: events
|
* APIProperty: events
|
||||||
* {<OpenLayers.Events>} Events instance for listeners and triggering
|
* {<OpenLayers.Events>} Events instance for listeners and triggering
|
||||||
* control specific events.
|
* control specific events.
|
||||||
|
@ -167,7 +168,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*
|
*
|
||||||
* Supported event types (in addition to those from <OpenLayers.Control.events>):
|
* Supported event types (in addition to those from <OpenLayers.Control.events>):
|
||||||
* beforegetfeatureinfo - Triggered before the request is sent.
|
* beforegetfeatureinfo - Triggered before the request is sent.
|
||||||
* The event object has an *xy* property with the position of the
|
* The event object has an *xy* property with the position of the
|
||||||
* mouse click or hover event that triggers the request.
|
* mouse click or hover event that triggers the request.
|
||||||
* nogetfeatureinfo - no queryable layers were found.
|
* nogetfeatureinfo - no queryable layers were found.
|
||||||
* getfeatureinfo - Triggered when a GetFeatureInfo response is received.
|
* getfeatureinfo - Triggered when a GetFeatureInfo response is received.
|
||||||
|
@ -185,20 +186,20 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* Constructor: <OpenLayers.Control.WMSGetFeatureInfo>
|
* Constructor: <OpenLayers.Control.WMSGetFeatureInfo>
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* options - {Object}
|
* options - {Object}
|
||||||
*/
|
*/
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
options.handlerOptions = options.handlerOptions || {};
|
options.handlerOptions = options.handlerOptions || {};
|
||||||
|
|
||||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||||
|
|
||||||
if(!this.format) {
|
if(!this.format) {
|
||||||
this.format = new OpenLayers.Format.WMSGetFeatureInfo(
|
this.format = new OpenLayers.Format.WMSGetFeatureInfo(
|
||||||
options.formatOptions
|
options.formatOptions
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.drillDown === true) {
|
if(this.drillDown === true) {
|
||||||
this.hover = false;
|
this.hover = false;
|
||||||
}
|
}
|
||||||
|
@ -221,11 +222,11 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: getInfoForClick
|
* Method: getInfoForClick
|
||||||
* Called on click
|
* Called on click
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* evt - {<OpenLayers.Event>}
|
* evt - {<OpenLayers.Event>}
|
||||||
*/
|
*/
|
||||||
getInfoForClick: function(evt) {
|
getInfoForClick: function(evt) {
|
||||||
this.events.triggerEvent("beforegetfeatureinfo", {xy: evt.xy});
|
this.events.triggerEvent("beforegetfeatureinfo", {xy: evt.xy});
|
||||||
|
@ -234,7 +235,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
OpenLayers.Element.addClass(this.map.viewPortDiv, "olCursorWait");
|
OpenLayers.Element.addClass(this.map.viewPortDiv, "olCursorWait");
|
||||||
this.request(evt.xy, {});
|
this.request(evt.xy, {});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: getInfoForHover
|
* Method: getInfoForHover
|
||||||
* Pause callback for the hover handler
|
* Pause callback for the hover handler
|
||||||
|
@ -285,7 +286,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
}
|
}
|
||||||
return layers;
|
return layers;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: urlMatches
|
* Method: urlMatches
|
||||||
* Test to see if the provided url matches either the control <url> or one
|
* Test to see if the provided url matches either the control <url> or one
|
||||||
|
@ -384,7 +385,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* Method: getStyleNames
|
* Method: getStyleNames
|
||||||
* Gets the STYLES parameter for the layer. Make sure the STYLES parameter
|
* Gets the STYLES parameter for the layer. Make sure the STYLES parameter
|
||||||
* matches the LAYERS parameter
|
* matches the LAYERS parameter
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* layer - {<OpenLayers.Layer.WMS>}
|
* layer - {<OpenLayers.Layer.WMS>}
|
||||||
*
|
*
|
||||||
|
@ -412,12 +413,12 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
/**
|
/**
|
||||||
* Method: request
|
* Method: request
|
||||||
* Sends a GetFeatureInfo request to the WMS
|
* Sends a GetFeatureInfo request to the WMS
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* clickPosition - {<OpenLayers.Pixel>} The position on the map where the
|
* clickPosition - {<OpenLayers.Pixel>} The position on the map where the
|
||||||
* mouse event occurred.
|
* mouse event occurred.
|
||||||
* options - {Object} additional options for this method.
|
* options - {Object} additional options for this method.
|
||||||
*
|
*
|
||||||
* Valid options:
|
* Valid options:
|
||||||
* - *hover* {Boolean} true if we do the request for the hover handler
|
* - *hover* {Boolean} true if we do the request for the hover handler
|
||||||
*/
|
*/
|
||||||
|
@ -429,13 +430,13 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");
|
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
if(this.drillDown === false) {
|
if(this.drillDown === false) {
|
||||||
var wmsOptions = this.buildWMSOptions(this.url, layers,
|
var wmsOptions = this.buildWMSOptions(this.url, layers,
|
||||||
clickPosition, layers[0].params.FORMAT);
|
clickPosition, layers[0].params.FORMAT);
|
||||||
var request = OpenLayers.Request.GET(wmsOptions);
|
var request = OpenLayers.Request.GET(wmsOptions);
|
||||||
|
|
||||||
if (options.hover === true) {
|
if (options.hover === true) {
|
||||||
this.hoverRequest = request;
|
this.hoverRequest = request;
|
||||||
}
|
}
|
||||||
|
@ -459,9 +460,9 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
var layers;
|
var layers;
|
||||||
for (var url in services) {
|
for (var url in services) {
|
||||||
layers = services[url];
|
layers = services[url];
|
||||||
var wmsOptions = this.buildWMSOptions(url, layers,
|
var wmsOptions = this.buildWMSOptions(url, layers,
|
||||||
clickPosition, layers[0].params.FORMAT);
|
clickPosition, layers[0].params.FORMAT);
|
||||||
OpenLayers.Request.GET(wmsOptions);
|
OpenLayers.Request.GET(wmsOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -489,11 +490,11 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
// Reset the cursor.
|
// Reset the cursor.
|
||||||
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");
|
OpenLayers.Element.removeClass(this.map.viewPortDiv, "olCursorWait");
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: handleResponse
|
* Method: handleResponse
|
||||||
* Handler for the GetFeatureInfo response.
|
* Handler for the GetFeatureInfo response.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* xy - {<OpenLayers.Pixel>} The position on the map where the
|
* xy - {<OpenLayers.Pixel>} The position on the map where the
|
||||||
* mouse event occurred.
|
* mouse event occurred.
|
||||||
|
@ -501,7 +502,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* url - {String} The url which was used for this request.
|
* url - {String} The url which was used for this request.
|
||||||
*/
|
*/
|
||||||
handleResponse: function(xy, request, url) {
|
handleResponse: function(xy, request, url) {
|
||||||
|
|
||||||
var doc = request.responseXML;
|
var doc = request.responseXML;
|
||||||
if(!doc || !doc.documentElement) {
|
if(!doc || !doc.documentElement) {
|
||||||
doc = request.responseText;
|
doc = request.responseText;
|
||||||
|
@ -519,7 +520,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
this._features = (this._features || []).concat(features);
|
this._features = (this._features || []).concat(features);
|
||||||
}
|
}
|
||||||
if (this._requestCount === this._numRequests) {
|
if (this._requestCount === this._numRequests) {
|
||||||
this.triggerGetFeatureInfo(request, xy, this._features.concat());
|
this.triggerGetFeatureInfo(request, xy, this._features.concat());
|
||||||
delete this._features;
|
delete this._features;
|
||||||
delete this._requestCount;
|
delete this._requestCount;
|
||||||
delete this._numRequests;
|
delete this._numRequests;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -120,7 +120,6 @@ OpenLayers.Control.WMTSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, {
|
||||||
* }
|
* }
|
||||||
* (end)
|
* (end)
|
||||||
*/
|
*/
|
||||||
handlerOptions: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: handler
|
* Property: handler
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -37,9 +37,9 @@ OpenLayers.Control.Zoom = OpenLayers.Class(OpenLayers.Control, {
|
||||||
/**
|
/**
|
||||||
* APIProperty: zoomOutText
|
* APIProperty: zoomOutText
|
||||||
* {String}
|
* {String}
|
||||||
* Text for zoom-out link. Default is "-".
|
* Text for zoom-out link. Default is "\u2212".
|
||||||
*/
|
*/
|
||||||
zoomOutText: "-",
|
zoomOutText: "\u2212",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: zoomOutId
|
* APIProperty: zoomOutId
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -41,9 +41,17 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: alwaysZoom
|
* APIProperty: alwaysZoom
|
||||||
* {Boolean} Always zoom in/out, when box drawed
|
* {Boolean} Always zoom in/out when box drawn, even if the zoom level does
|
||||||
|
* not change.
|
||||||
*/
|
*/
|
||||||
alwaysZoom: false,
|
alwaysZoom: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: zoomOnClick
|
||||||
|
* {Boolean} Should we zoom when no box was dragged, i.e. the user only
|
||||||
|
* clicked? Default is true.
|
||||||
|
*/
|
||||||
|
zoomOnClick: true,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: draw
|
* Method: draw
|
||||||
|
@ -61,7 +69,8 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
|
||||||
*/
|
*/
|
||||||
zoomBox: function (position) {
|
zoomBox: function (position) {
|
||||||
if (position instanceof OpenLayers.Bounds) {
|
if (position instanceof OpenLayers.Bounds) {
|
||||||
var bounds;
|
var bounds,
|
||||||
|
targetCenterPx = position.getCenterPixel();
|
||||||
if (!this.out) {
|
if (!this.out) {
|
||||||
var minXY = this.map.getLonLatFromPixel({
|
var minXY = this.map.getLonLatFromPixel({
|
||||||
x: position.left,
|
x: position.left,
|
||||||
|
@ -74,13 +83,12 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
|
||||||
bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,
|
bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,
|
||||||
maxXY.lon, maxXY.lat);
|
maxXY.lon, maxXY.lat);
|
||||||
} else {
|
} else {
|
||||||
var pixWidth = Math.abs(position.right-position.left);
|
var pixWidth = position.right - position.left;
|
||||||
var pixHeight = Math.abs(position.top-position.bottom);
|
var pixHeight = position.bottom - position.top;
|
||||||
var zoomFactor = Math.min((this.map.size.h / pixHeight),
|
var zoomFactor = Math.min((this.map.size.h / pixHeight),
|
||||||
(this.map.size.w / pixWidth));
|
(this.map.size.w / pixWidth));
|
||||||
var extent = this.map.getExtent();
|
var extent = this.map.getExtent();
|
||||||
var center = this.map.getLonLatFromPixel(
|
var center = this.map.getLonLatFromPixel(targetCenterPx);
|
||||||
position.getCenterPixel());
|
|
||||||
var xmin = center.lon - (extent.getWidth()/2)*zoomFactor;
|
var xmin = center.lon - (extent.getWidth()/2)*zoomFactor;
|
||||||
var xmax = center.lon + (extent.getWidth()/2)*zoomFactor;
|
var xmax = center.lon + (extent.getWidth()/2)*zoomFactor;
|
||||||
var ymin = center.lat - (extent.getHeight()/2)*zoomFactor;
|
var ymin = center.lat - (extent.getHeight()/2)*zoomFactor;
|
||||||
|
@ -88,18 +96,31 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
|
||||||
bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax);
|
bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax);
|
||||||
}
|
}
|
||||||
// always zoom in/out
|
// always zoom in/out
|
||||||
var lastZoom = this.map.getZoom();
|
var lastZoom = this.map.getZoom(),
|
||||||
this.map.zoomToExtent(bounds);
|
size = this.map.getSize(),
|
||||||
|
centerPx = {x: size.w / 2, y: size.h / 2},
|
||||||
|
zoom = this.map.getZoomForExtent(bounds),
|
||||||
|
oldRes = this.map.getResolution(),
|
||||||
|
newRes = this.map.getResolutionForZoom(zoom);
|
||||||
|
if (oldRes == newRes) {
|
||||||
|
this.map.setCenter(this.map.getLonLatFromPixel(targetCenterPx));
|
||||||
|
} else {
|
||||||
|
var zoomOriginPx = {
|
||||||
|
x: (oldRes * targetCenterPx.x - newRes * centerPx.x) /
|
||||||
|
(oldRes - newRes),
|
||||||
|
y: (oldRes * targetCenterPx.y - newRes * centerPx.y) /
|
||||||
|
(oldRes - newRes)
|
||||||
|
};
|
||||||
|
this.map.zoomTo(zoom, zoomOriginPx);
|
||||||
|
}
|
||||||
if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){
|
if (lastZoom == this.map.getZoom() && this.alwaysZoom == true){
|
||||||
this.map.zoomTo(lastZoom + (this.out ? -1 : 1));
|
this.map.zoomTo(lastZoom + (this.out ? -1 : 1));
|
||||||
}
|
}
|
||||||
} else { // it's a pixel
|
} else if (this.zoomOnClick) { // it's a pixel
|
||||||
if (!this.out) {
|
if (!this.out) {
|
||||||
this.map.setCenter(this.map.getLonLatFromPixel(position),
|
this.map.zoomTo(this.map.getZoom() + 1, position);
|
||||||
this.map.getZoom() + 1);
|
|
||||||
} else {
|
} else {
|
||||||
this.map.setCenter(this.map.getLonLatFromPixel(position),
|
this.map.zoomTo(this.map.getZoom() - 1, position);
|
||||||
this.map.getZoom() - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires OpenLayers/Control.js
|
* @requires OpenLayers/Control/Button.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,21 +14,15 @@
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
* - <OpenLayers.Control>
|
* - <OpenLayers.Control>
|
||||||
*/
|
*/
|
||||||
OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control, {
|
OpenLayers.Control.ZoomIn = OpenLayers.Class(OpenLayers.Control.Button, {
|
||||||
|
|
||||||
/**
|
|
||||||
* Property: type
|
|
||||||
* {String} The type of <OpenLayers.Control> -- When added to a
|
|
||||||
* <Control.Panel>, 'type' is used by the panel to determine how to
|
|
||||||
* handle our events.
|
|
||||||
*/
|
|
||||||
type: OpenLayers.Control.TYPE_BUTTON,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: trigger
|
* Method: trigger
|
||||||
*/
|
*/
|
||||||
trigger: function(){
|
trigger: function(){
|
||||||
this.map.zoomIn();
|
if (this.map) {
|
||||||
|
this.map.zoomIn();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Control.ZoomIn"
|
CLASS_NAME: "OpenLayers.Control.ZoomIn"
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires OpenLayers/Control.js
|
* @requires OpenLayers/Control/Button.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,21 +14,15 @@
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
* - <OpenLayers.Control>
|
* - <OpenLayers.Control>
|
||||||
*/
|
*/
|
||||||
OpenLayers.Control.ZoomOut = OpenLayers.Class(OpenLayers.Control, {
|
OpenLayers.Control.ZoomOut = OpenLayers.Class(OpenLayers.Control.Button, {
|
||||||
|
|
||||||
/**
|
|
||||||
* Property: type
|
|
||||||
* {String} The type of <OpenLayers.Control> -- When added to a
|
|
||||||
* <Control.Panel>, 'type' is used by the panel to determine how to
|
|
||||||
* handle our events.
|
|
||||||
*/
|
|
||||||
type: OpenLayers.Control.TYPE_BUTTON,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: trigger
|
* Method: trigger
|
||||||
*/
|
*/
|
||||||
trigger: function(){
|
trigger: function(){
|
||||||
this.map.zoomOut();
|
if (this.map) {
|
||||||
|
this.map.zoomOut();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Control.ZoomOut"
|
CLASS_NAME: "OpenLayers.Control.ZoomOut"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires OpenLayers/Control.js
|
* @requires OpenLayers/Control/Button.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,19 +16,14 @@
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
* - <OpenLayers.Control>
|
* - <OpenLayers.Control>
|
||||||
*/
|
*/
|
||||||
OpenLayers.Control.ZoomToMaxExtent = OpenLayers.Class(OpenLayers.Control, {
|
OpenLayers.Control.ZoomToMaxExtent = OpenLayers.Class(OpenLayers.Control.Button, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: type
|
|
||||||
* {String} The type of <OpenLayers.Control> -- When added to a
|
|
||||||
* <Control.Panel>, 'type' is used by the panel to determine how to
|
|
||||||
* handle our events.
|
|
||||||
*/
|
|
||||||
type: OpenLayers.Control.TYPE_BUTTON,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Method: trigger
|
* Method: trigger
|
||||||
* Do the zoom.
|
*
|
||||||
|
* Called whenever this control is being rendered inside of a panel and a
|
||||||
|
* click occurs on this controls element. Actually zooms to the maximum
|
||||||
|
* extent of this controls map.
|
||||||
*/
|
*/
|
||||||
trigger: function() {
|
trigger: function() {
|
||||||
if (this.map) {
|
if (this.map) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -167,11 +167,7 @@ OpenLayers.Event = {
|
||||||
stop: function(event, allowDefault) {
|
stop: function(event, allowDefault) {
|
||||||
|
|
||||||
if (!allowDefault) {
|
if (!allowDefault) {
|
||||||
if (event.preventDefault) {
|
OpenLayers.Event.preventDefault(event);
|
||||||
event.preventDefault();
|
|
||||||
} else {
|
|
||||||
event.returnValue = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.stopPropagation) {
|
if (event.stopPropagation) {
|
||||||
|
@ -181,6 +177,22 @@ OpenLayers.Event = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: preventDefault
|
||||||
|
* Cancels the event if it is cancelable, without stopping further
|
||||||
|
* propagation of the event.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* event - {Event}
|
||||||
|
*/
|
||||||
|
preventDefault: function(event) {
|
||||||
|
if (event.preventDefault) {
|
||||||
|
event.preventDefault();
|
||||||
|
} else {
|
||||||
|
event.returnValue = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: findElement
|
* Method: findElement
|
||||||
*
|
*
|
||||||
|
@ -285,11 +297,9 @@ OpenLayers.Event = {
|
||||||
if (elementObservers) {
|
if (elementObservers) {
|
||||||
for(var i = elementObservers.length-1; i >= 0; i--) {
|
for(var i = elementObservers.length-1; i >= 0; i--) {
|
||||||
var entry = elementObservers[i];
|
var entry = elementObservers[i];
|
||||||
var args = new Array(entry.element,
|
OpenLayers.Event.stopObserving.apply(this, [
|
||||||
entry.name,
|
entry.element, entry.name, entry.observer, entry.useCapture
|
||||||
entry.observer,
|
]);
|
||||||
entry.useCapture);
|
|
||||||
var removed = OpenLayers.Event.stopObserving.apply(this, args);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -556,6 +566,7 @@ OpenLayers.Events = OpenLayers.Class({
|
||||||
this.listeners = {};
|
this.listeners = {};
|
||||||
this.extensions = {};
|
this.extensions = {};
|
||||||
this.extensionCount = {};
|
this.extensionCount = {};
|
||||||
|
this._msTouches = [];
|
||||||
|
|
||||||
// if a dom element is specified, add a listeners list
|
// if a dom element is specified, add a listeners list
|
||||||
// for browser events on the element and register them
|
// for browser events on the element and register them
|
||||||
|
@ -622,11 +633,16 @@ OpenLayers.Events = OpenLayers.Class({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.element = element;
|
this.element = element;
|
||||||
|
var msTouch = !!window.navigator.msMaxTouchPoints;
|
||||||
|
var type;
|
||||||
for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
|
for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
|
||||||
|
type = this.BROWSER_EVENTS[i];
|
||||||
// register the event cross-browser
|
// register the event cross-browser
|
||||||
OpenLayers.Event.observe(
|
OpenLayers.Event.observe(element, type, this.eventHandler
|
||||||
element, this.BROWSER_EVENTS[i], this.eventHandler
|
|
||||||
);
|
);
|
||||||
|
if (msTouch && type.indexOf('touch') === 0) {
|
||||||
|
this.addMsTouchListener(element, type, this.eventHandler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// disable dragstart in IE so that mousedown/move/up works normally
|
// disable dragstart in IE so that mousedown/move/up works normally
|
||||||
OpenLayers.Event.observe(element, "dragstart", OpenLayers.Event.stop);
|
OpenLayers.Event.observe(element, "dragstart", OpenLayers.Event.stop);
|
||||||
|
@ -824,7 +840,7 @@ OpenLayers.Events = OpenLayers.Class({
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* type - {String}
|
* type - {String}
|
||||||
* evt - {Event}
|
* evt - {Event || Object} will be passed to the listeners.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {Boolean} The last listener return. If a listener returns false, the
|
* {Boolean} The last listener return. If a listener returns false, the
|
||||||
|
@ -893,7 +909,7 @@ OpenLayers.Events = OpenLayers.Class({
|
||||||
var num = touches.length;
|
var num = touches.length;
|
||||||
var touch;
|
var touch;
|
||||||
for (var i=0; i<num; ++i) {
|
for (var i=0; i<num; ++i) {
|
||||||
touch = touches[i];
|
touch = this.getTouchClientXY(touches[i]);
|
||||||
x += touch.clientX;
|
x += touch.clientX;
|
||||||
y += touch.clientY;
|
y += touch.clientY;
|
||||||
}
|
}
|
||||||
|
@ -905,7 +921,48 @@ OpenLayers.Events = OpenLayers.Class({
|
||||||
}
|
}
|
||||||
this.triggerEvent(type, evt);
|
this.triggerEvent(type, evt);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: getTouchClientXY
|
||||||
|
* WebKit has a few bugs for clientX/clientY. This method detects them
|
||||||
|
* and calculate the correct values.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* evt - {Touch} a Touch object from a TouchEvent
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {Object} An object with only clientX and clientY properties with the
|
||||||
|
* calculated values.
|
||||||
|
*/
|
||||||
|
getTouchClientXY: function (evt) {
|
||||||
|
// olMochWin is to override window, used for testing
|
||||||
|
var win = window.olMockWin || window,
|
||||||
|
winPageX = win.pageXOffset,
|
||||||
|
winPageY = win.pageYOffset,
|
||||||
|
x = evt.clientX,
|
||||||
|
y = evt.clientY;
|
||||||
|
|
||||||
|
if (evt.pageY === 0 && Math.floor(y) > Math.floor(evt.pageY) ||
|
||||||
|
evt.pageX === 0 && Math.floor(x) > Math.floor(evt.pageX)) {
|
||||||
|
// iOS4 include scroll offset in clientX/Y
|
||||||
|
x = x - winPageX;
|
||||||
|
y = y - winPageY;
|
||||||
|
} else if (y < (evt.pageY - winPageY) || x < (evt.pageX - winPageX) ) {
|
||||||
|
// Some Android browsers have totally bogus values for clientX/Y
|
||||||
|
// when scrolling/zooming a page
|
||||||
|
x = evt.pageX - winPageX;
|
||||||
|
y = evt.pageY - winPageY;
|
||||||
|
}
|
||||||
|
|
||||||
|
evt.olClientX = x;
|
||||||
|
evt.olClientY = y;
|
||||||
|
|
||||||
|
return {
|
||||||
|
clientX: x,
|
||||||
|
clientY: y
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: clearMouseCache
|
* APIMethod: clearMouseCache
|
||||||
* Clear cached data about the mouse position. This should be called any
|
* Clear cached data about the mouse position. This should be called any
|
||||||
|
@ -915,17 +972,7 @@ OpenLayers.Events = OpenLayers.Class({
|
||||||
clearMouseCache: function() {
|
clearMouseCache: function() {
|
||||||
this.element.scrolls = null;
|
this.element.scrolls = null;
|
||||||
this.element.lefttop = null;
|
this.element.lefttop = null;
|
||||||
// OpenLayers.Util.pagePosition needs to use
|
this.element.offsets = null;
|
||||||
// element.getBoundingClientRect to correctly calculate the offsets
|
|
||||||
// for the iPhone, but once the page is scrolled, getBoundingClientRect
|
|
||||||
// returns incorrect offsets. So our best bet is to not invalidate the
|
|
||||||
// offsets once we have them, and hope that the page was not scrolled
|
|
||||||
// when we did the initial calculation.
|
|
||||||
var body = document.body;
|
|
||||||
if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
|
|
||||||
navigator.userAgent.match(/iPhone/i))) {
|
|
||||||
this.element.offsets = null;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -949,8 +996,8 @@ OpenLayers.Events = OpenLayers.Class({
|
||||||
if (!this.element.scrolls) {
|
if (!this.element.scrolls) {
|
||||||
var viewportElement = OpenLayers.Util.getViewportElement();
|
var viewportElement = OpenLayers.Util.getViewportElement();
|
||||||
this.element.scrolls = [
|
this.element.scrolls = [
|
||||||
viewportElement.scrollLeft,
|
window.pageXOffset || viewportElement.scrollLeft,
|
||||||
viewportElement.scrollTop
|
window.pageYOffset || viewportElement.scrollTop
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,5 +1020,151 @@ OpenLayers.Events = OpenLayers.Class({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: addMsTouchListener
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* element - {DOMElement} The DOM element to register the listener on
|
||||||
|
* type - {String} The event type
|
||||||
|
* handler - {Function} the handler
|
||||||
|
*/
|
||||||
|
addMsTouchListener: function (element, type, handler) {
|
||||||
|
var eventHandler = this.eventHandler;
|
||||||
|
var touches = this._msTouches;
|
||||||
|
|
||||||
|
function msHandler(evt) {
|
||||||
|
handler(OpenLayers.Util.applyDefaults({
|
||||||
|
stopPropagation: function() {
|
||||||
|
for (var i=touches.length-1; i>=0; --i) {
|
||||||
|
touches[i].stopPropagation();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
preventDefault: function() {
|
||||||
|
for (var i=touches.length-1; i>=0; --i) {
|
||||||
|
touches[i].preventDefault();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
type: type
|
||||||
|
}, evt));
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 'touchstart':
|
||||||
|
return this.addMsTouchListenerStart(element, type, msHandler);
|
||||||
|
case 'touchend':
|
||||||
|
return this.addMsTouchListenerEnd(element, type, msHandler);
|
||||||
|
case 'touchmove':
|
||||||
|
return this.addMsTouchListenerMove(element, type, msHandler);
|
||||||
|
default:
|
||||||
|
throw 'Unknown touch event type';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: addMsTouchListenerStart
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* element - {DOMElement} The DOM element to register the listener on
|
||||||
|
* type - {String} The event type
|
||||||
|
* handler - {Function} the handler
|
||||||
|
*/
|
||||||
|
addMsTouchListenerStart: function(element, type, handler) {
|
||||||
|
var touches = this._msTouches;
|
||||||
|
|
||||||
|
var cb = function(e) {
|
||||||
|
|
||||||
|
var alreadyInArray = false;
|
||||||
|
for (var i=0, ii=touches.length; i<ii; ++i) {
|
||||||
|
if (touches[i].pointerId == e.pointerId) {
|
||||||
|
alreadyInArray = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!alreadyInArray) {
|
||||||
|
touches.push(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
e.touches = touches.slice();
|
||||||
|
handler(e);
|
||||||
|
};
|
||||||
|
|
||||||
|
OpenLayers.Event.observe(element, 'MSPointerDown', cb);
|
||||||
|
|
||||||
|
// Need to also listen for end events to keep the _msTouches list
|
||||||
|
// accurate
|
||||||
|
var internalCb = function(e) {
|
||||||
|
for (var i=0, ii=touches.length; i<ii; ++i) {
|
||||||
|
if (touches[i].pointerId == e.pointerId) {
|
||||||
|
touches.splice(i, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
OpenLayers.Event.observe(element, 'MSPointerUp', internalCb);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: addMsTouchListenerMove
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* element - {DOMElement} The DOM element to register the listener on
|
||||||
|
* type - {String} The event type
|
||||||
|
* handler - {Function} the handler
|
||||||
|
*/
|
||||||
|
addMsTouchListenerMove: function (element, type, handler) {
|
||||||
|
var touches = this._msTouches;
|
||||||
|
var cb = function(e) {
|
||||||
|
|
||||||
|
//Don't fire touch moves when mouse isn't down
|
||||||
|
if (e.pointerType == e.MSPOINTER_TYPE_MOUSE && e.buttons == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (touches.length == 1 && touches[0].pageX == e.pageX &&
|
||||||
|
touches[0].pageY == e.pageY) {
|
||||||
|
// don't trigger event when pointer has not moved
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (var i=0, ii=touches.length; i<ii; ++i) {
|
||||||
|
if (touches[i].pointerId == e.pointerId) {
|
||||||
|
touches[i] = e;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
e.touches = touches.slice();
|
||||||
|
handler(e);
|
||||||
|
};
|
||||||
|
|
||||||
|
OpenLayers.Event.observe(element, 'MSPointerMove', cb);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: addMsTouchListenerEnd
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* element - {DOMElement} The DOM element to register the listener on
|
||||||
|
* type - {String} The event type
|
||||||
|
* handler - {Function} the handler
|
||||||
|
*/
|
||||||
|
addMsTouchListenerEnd: function (element, type, handler) {
|
||||||
|
var touches = this._msTouches;
|
||||||
|
|
||||||
|
var cb = function(e) {
|
||||||
|
|
||||||
|
for (var i=0, ii=touches.length; i<ii; ++i) {
|
||||||
|
if (touches[i].pointerId == e.pointerId) {
|
||||||
|
touches.splice(i, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
e.touches = touches.slice();
|
||||||
|
handler(e);
|
||||||
|
};
|
||||||
|
|
||||||
|
OpenLayers.Event.observe(element, 'MSPointerUp', cb);
|
||||||
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Events"
|
CLASS_NAME: "OpenLayers.Events"
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -121,6 +121,26 @@ OpenLayers.Events.buttonclick = OpenLayers.Class({
|
||||||
} while(--depth > 0 && element);
|
} while(--depth > 0 && element);
|
||||||
return button;
|
return button;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: ignore
|
||||||
|
* Check for event target elements that should be ignored by OpenLayers.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* element - {DOMElement} The event target.
|
||||||
|
*/
|
||||||
|
ignore: function(element) {
|
||||||
|
var depth = 3,
|
||||||
|
ignore = false;
|
||||||
|
do {
|
||||||
|
if (element.nodeName.toLowerCase() === 'a') {
|
||||||
|
ignore = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
element = element.parentNode;
|
||||||
|
} while (--depth > 0 && element);
|
||||||
|
return ignore;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: buttonClick
|
* Method: buttonClick
|
||||||
|
@ -150,6 +170,12 @@ OpenLayers.Events.buttonclick = OpenLayers.Class({
|
||||||
} else if (this.startEvt) {
|
} else if (this.startEvt) {
|
||||||
if (this.completeRegEx.test(evt.type)) {
|
if (this.completeRegEx.test(evt.type)) {
|
||||||
var pos = OpenLayers.Util.pagePosition(button);
|
var pos = OpenLayers.Util.pagePosition(button);
|
||||||
|
var viewportElement = OpenLayers.Util.getViewportElement();
|
||||||
|
var scrollTop = window.pageYOffset || viewportElement.scrollTop;
|
||||||
|
var scrollLeft = window.pageXOffset || viewportElement.scrollLeft;
|
||||||
|
pos[0] = pos[0] - scrollLeft;
|
||||||
|
pos[1] = pos[1] - scrollTop;
|
||||||
|
|
||||||
this.target.triggerEvent("buttonclick", {
|
this.target.triggerEvent("buttonclick", {
|
||||||
buttonElement: button,
|
buttonElement: button,
|
||||||
buttonXY: {
|
buttonXY: {
|
||||||
|
@ -170,6 +196,7 @@ OpenLayers.Events.buttonclick = OpenLayers.Class({
|
||||||
propagate = false;
|
propagate = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
propagate = !this.ignore(OpenLayers.Event.element(evt));
|
||||||
delete this.startEvt;
|
delete this.startEvt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,321 @@
|
||||||
|
/* 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/Events.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class: OpenLayers.Events.featureclick
|
||||||
|
*
|
||||||
|
* Extension event type for handling feature click events, including overlapping
|
||||||
|
* features.
|
||||||
|
*
|
||||||
|
* Event types provided by this extension:
|
||||||
|
* - featureclick
|
||||||
|
*/
|
||||||
|
OpenLayers.Events.featureclick = OpenLayers.Class({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: cache
|
||||||
|
* {Object} A cache of features under the mouse.
|
||||||
|
*/
|
||||||
|
cache: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: map
|
||||||
|
* {<OpenLayers.Map>} The map to register browser events on.
|
||||||
|
*/
|
||||||
|
map: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: provides
|
||||||
|
* {Array(String)} The event types provided by this extension.
|
||||||
|
*/
|
||||||
|
provides: ["featureclick", "nofeatureclick", "featureover", "featureout"],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor: OpenLayers.Events.featureclick
|
||||||
|
* Create a new featureclick event type.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* target - {<OpenLayers.Events>} The events instance to create the events
|
||||||
|
* for.
|
||||||
|
*/
|
||||||
|
initialize: function(target) {
|
||||||
|
this.target = target;
|
||||||
|
if (target.object instanceof OpenLayers.Map) {
|
||||||
|
this.setMap(target.object);
|
||||||
|
} else if (target.object instanceof OpenLayers.Layer.Vector) {
|
||||||
|
if (target.object.map) {
|
||||||
|
this.setMap(target.object.map);
|
||||||
|
} else {
|
||||||
|
target.object.events.register("added", this, function(evt) {
|
||||||
|
this.setMap(target.object.map);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw("Listeners for '" + this.provides.join("', '") +
|
||||||
|
"' events can only be registered for OpenLayers.Layer.Vector " +
|
||||||
|
"or OpenLayers.Map instances");
|
||||||
|
}
|
||||||
|
for (var i=this.provides.length-1; i>=0; --i) {
|
||||||
|
target.extensions[this.provides[i]] = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: setMap
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* map - {<OpenLayers.Map>} The map to register browser events on.
|
||||||
|
*/
|
||||||
|
setMap: function(map) {
|
||||||
|
this.map = map;
|
||||||
|
this.cache = {};
|
||||||
|
map.events.register("mousedown", this, this.start, {extension: true});
|
||||||
|
map.events.register("mouseup", this, this.onClick, {extension: true});
|
||||||
|
map.events.register("touchstart", this, this.start, {extension: true});
|
||||||
|
map.events.register("touchmove", this, this.cancel, {extension: true});
|
||||||
|
map.events.register("touchend", this, this.onClick, {extension: true});
|
||||||
|
map.events.register("mousemove", this, this.onMousemove, {extension: true});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: start
|
||||||
|
* Sets startEvt = evt.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* evt - {<OpenLayers.Event>}
|
||||||
|
*/
|
||||||
|
start: function(evt) {
|
||||||
|
this.startEvt = evt;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: cancel
|
||||||
|
* Deletes the start event.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* evt - {<OpenLayers.Event>}
|
||||||
|
*/
|
||||||
|
cancel: function(evt) {
|
||||||
|
delete this.startEvt;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: onClick
|
||||||
|
* Listener for the click event.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* evt - {<OpenLayers.Event>}
|
||||||
|
*/
|
||||||
|
onClick: function(evt) {
|
||||||
|
if (!this.startEvt || evt.type !== "touchend" &&
|
||||||
|
!OpenLayers.Event.isLeftClick(evt)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var features = this.getFeatures(this.startEvt);
|
||||||
|
delete this.startEvt;
|
||||||
|
// fire featureclick events
|
||||||
|
var feature, layer, more, clicked = {};
|
||||||
|
for (var i=0, len=features.length; i<len; ++i) {
|
||||||
|
feature = features[i];
|
||||||
|
layer = feature.layer;
|
||||||
|
clicked[layer.id] = true;
|
||||||
|
more = this.triggerEvent("featureclick", {feature: feature});
|
||||||
|
if (more === false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// fire nofeatureclick events on all vector layers with no targets
|
||||||
|
for (i=0, len=this.map.layers.length; i<len; ++i) {
|
||||||
|
layer = this.map.layers[i];
|
||||||
|
if (layer instanceof OpenLayers.Layer.Vector && !clicked[layer.id]) {
|
||||||
|
this.triggerEvent("nofeatureclick", {layer: layer});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: onMousemove
|
||||||
|
* Listener for the mousemove event.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* evt - {<OpenLayers.Event>}
|
||||||
|
*/
|
||||||
|
onMousemove: function(evt) {
|
||||||
|
delete this.startEvt;
|
||||||
|
var features = this.getFeatures(evt);
|
||||||
|
var over = {}, newly = [], feature;
|
||||||
|
for (var i=0, len=features.length; i<len; ++i) {
|
||||||
|
feature = features[i];
|
||||||
|
over[feature.id] = feature;
|
||||||
|
if (!this.cache[feature.id]) {
|
||||||
|
newly.push(feature);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// check if already over features
|
||||||
|
var out = [];
|
||||||
|
for (var id in this.cache) {
|
||||||
|
feature = this.cache[id];
|
||||||
|
if (feature.layer && feature.layer.map) {
|
||||||
|
if (!over[feature.id]) {
|
||||||
|
out.push(feature);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// removed
|
||||||
|
delete this.cache[id];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// fire featureover events
|
||||||
|
var more;
|
||||||
|
for (i=0, len=newly.length; i<len; ++i) {
|
||||||
|
feature = newly[i];
|
||||||
|
this.cache[feature.id] = feature;
|
||||||
|
more = this.triggerEvent("featureover", {feature: feature});
|
||||||
|
if (more === false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// fire featureout events
|
||||||
|
for (i=0, len=out.length; i<len; ++i) {
|
||||||
|
feature = out[i];
|
||||||
|
delete this.cache[feature.id];
|
||||||
|
more = this.triggerEvent("featureout", {feature: feature});
|
||||||
|
if (more === false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: triggerEvent
|
||||||
|
* Determines where to trigger the event and triggers it.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* type - {String} The event type to trigger
|
||||||
|
* evt - {Object} The listener argument
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {Boolean} The last listener return.
|
||||||
|
*/
|
||||||
|
triggerEvent: function(type, evt) {
|
||||||
|
var layer = evt.feature ? evt.feature.layer : evt.layer,
|
||||||
|
object = this.target.object;
|
||||||
|
if (object instanceof OpenLayers.Map || object === layer) {
|
||||||
|
return this.target.triggerEvent(type, evt);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: getFeatures
|
||||||
|
* Get all features at the given screen location.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* evt - {Object} Event object.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {Array(<OpenLayers.Feature.Vector>)} List of features at the given point.
|
||||||
|
*/
|
||||||
|
getFeatures: function(evt) {
|
||||||
|
var x = evt.clientX, y = evt.clientY,
|
||||||
|
features = [], targets = [], layers = [],
|
||||||
|
layer, target, feature, i, len;
|
||||||
|
// go through all layers looking for targets
|
||||||
|
for (i=this.map.layers.length-1; i>=0; --i) {
|
||||||
|
layer = this.map.layers[i];
|
||||||
|
if (layer.div.style.display !== "none") {
|
||||||
|
if (layer.renderer instanceof OpenLayers.Renderer.Elements) {
|
||||||
|
if (layer instanceof OpenLayers.Layer.Vector) {
|
||||||
|
target = document.elementFromPoint(x, y);
|
||||||
|
while (target && target._featureId) {
|
||||||
|
feature = layer.getFeatureById(target._featureId);
|
||||||
|
if (feature) {
|
||||||
|
features.push(feature);
|
||||||
|
target.style.display = "none";
|
||||||
|
targets.push(target);
|
||||||
|
target = document.elementFromPoint(x, y);
|
||||||
|
} else {
|
||||||
|
// sketch, all bets off
|
||||||
|
target = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
layers.push(layer);
|
||||||
|
layer.div.style.display = "none";
|
||||||
|
} else if (layer.renderer instanceof OpenLayers.Renderer.Canvas) {
|
||||||
|
feature = layer.renderer.getFeatureIdFromEvent(evt);
|
||||||
|
if (feature) {
|
||||||
|
features.push(feature);
|
||||||
|
layers.push(layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// restore feature visibility
|
||||||
|
for (i=0, len=targets.length; i<len; ++i) {
|
||||||
|
targets[i].style.display = "";
|
||||||
|
}
|
||||||
|
// restore layer visibility
|
||||||
|
for (i=layers.length-1; i>=0; --i) {
|
||||||
|
layers[i].div.style.display = "block";
|
||||||
|
}
|
||||||
|
return features;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: destroy
|
||||||
|
* Clean up.
|
||||||
|
*/
|
||||||
|
destroy: function() {
|
||||||
|
for (var i=this.provides.length-1; i>=0; --i) {
|
||||||
|
delete this.target.extensions[this.provides[i]];
|
||||||
|
}
|
||||||
|
this.map.events.un({
|
||||||
|
mousemove: this.onMousemove,
|
||||||
|
mousedown: this.start,
|
||||||
|
mouseup: this.onClick,
|
||||||
|
touchstart: this.start,
|
||||||
|
touchmove: this.cancel,
|
||||||
|
touchend: this.onClick,
|
||||||
|
scope: this
|
||||||
|
});
|
||||||
|
delete this.cache;
|
||||||
|
delete this.map;
|
||||||
|
delete this.target;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class: OpenLayers.Events.nofeatureclick
|
||||||
|
*
|
||||||
|
* Extension event type for handling click events that do not hit a feature.
|
||||||
|
*
|
||||||
|
* Event types provided by this extension:
|
||||||
|
* - nofeatureclick
|
||||||
|
*/
|
||||||
|
OpenLayers.Events.nofeatureclick = OpenLayers.Events.featureclick;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class: OpenLayers.Events.featureover
|
||||||
|
*
|
||||||
|
* Extension event type for handling hovering over a feature.
|
||||||
|
*
|
||||||
|
* Event types provided by this extension:
|
||||||
|
* - featureover
|
||||||
|
*/
|
||||||
|
OpenLayers.Events.featureover = OpenLayers.Events.featureclick;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class: OpenLayers.Events.featureout
|
||||||
|
*
|
||||||
|
* Extension event type for handling leaving a feature.
|
||||||
|
*
|
||||||
|
* Event types provided by this extension:
|
||||||
|
* - featureout
|
||||||
|
*/
|
||||||
|
OpenLayers.Events.featureout = OpenLayers.Events.featureclick;
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -403,7 +403,8 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
|
||||||
* graphicZIndex - {Number} The integer z-index value to use in rendering.
|
* graphicZIndex - {Number} The integer z-index value to use in rendering.
|
||||||
* graphicName - {String} Named graphic to use when rendering points. Supported values include "circle" (default),
|
* graphicName - {String} Named graphic to use when rendering points. Supported values include "circle" (default),
|
||||||
* "square", "star", "x", "cross", "triangle".
|
* "square", "star", "x", "cross", "triangle".
|
||||||
* graphicTitle - {String} Tooltip for an external graphic.
|
* graphicTitle - {String} Tooltip when hovering over a feature. *deprecated*, use title instead
|
||||||
|
* title - {String} Tooltip when hovering over a feature. Not supported by the canvas renderer.
|
||||||
* backgroundGraphic - {String} Url to a graphic to be used as the background under an externalGraphic.
|
* backgroundGraphic - {String} Url to a graphic to be used as the background under an externalGraphic.
|
||||||
* backgroundGraphicZIndex - {Number} The integer z-index value to use in rendering the background graphic.
|
* backgroundGraphicZIndex - {Number} The integer z-index value to use in rendering the background graphic.
|
||||||
* backgroundXOffset - {Number} The x offset (in pixels) for the background graphic.
|
* backgroundXOffset - {Number} The x offset (in pixels) for the background graphic.
|
||||||
|
@ -421,7 +422,8 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
|
||||||
* labelSelect - {Boolean} If set to true, labels will be selectable using SelectFeature or similar controls.
|
* labelSelect - {Boolean} If set to true, labels will be selectable using SelectFeature or similar controls.
|
||||||
* Default is false.
|
* Default is false.
|
||||||
* labelOutlineColor - {String} The color of the label outline. Default is 'white'. Only supported by the canvas & SVG renderers.
|
* labelOutlineColor - {String} The color of the label outline. Default is 'white'. Only supported by the canvas & SVG renderers.
|
||||||
* labelOutlineWidth - {Number} The width of the label outline. Default is 3, set to 0 or null to disable. Only supported by the canvas & SVG renderers.
|
* labelOutlineWidth - {Number} The width of the label outline. Default is 3, set to 0 or null to disable. Only supported by the SVG renderers.
|
||||||
|
* labelOutlineOpacity - {Number} The opacity (0-1) of the label outline. Default is fontOpacity. Only supported by the canvas & SVG renderers.
|
||||||
* fontColor - {String} The font color for the label, to be provided like CSS.
|
* fontColor - {String} The font color for the label, to be provided like CSS.
|
||||||
* fontOpacity - {Number} Opacity (0-1) for the label
|
* fontOpacity - {Number} Opacity (0-1) for the label
|
||||||
* fontFamily - {String} The font family for the label, to be provided like in CSS.
|
* fontFamily - {String} The font family for the label, to be provided like in CSS.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -26,7 +26,8 @@ OpenLayers.Filter.Comparison = OpenLayers.Class(OpenLayers.Filter, {
|
||||||
* - OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO = "<=";
|
* - OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO = "<=";
|
||||||
* - OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
|
* - OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
|
||||||
* - OpenLayers.Filter.Comparison.BETWEEN = "..";
|
* - OpenLayers.Filter.Comparison.BETWEEN = "..";
|
||||||
* - OpenLayers.Filter.Comparison.LIKE = "~";
|
* - OpenLayers.Filter.Comparison.LIKE = "~";
|
||||||
|
* - OpenLayers.Filter.Comparison.IS_NULL = "NULL";
|
||||||
*/
|
*/
|
||||||
type: null,
|
type: null,
|
||||||
|
|
||||||
|
@ -154,6 +155,9 @@ OpenLayers.Filter.Comparison = OpenLayers.Class(OpenLayers.Filter, {
|
||||||
var regexp = new RegExp(this.value, "gi");
|
var regexp = new RegExp(this.value, "gi");
|
||||||
result = regexp.test(got);
|
result = regexp.test(got);
|
||||||
break;
|
break;
|
||||||
|
case OpenLayers.Filter.Comparison.IS_NULL:
|
||||||
|
result = (got === null);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
@ -260,3 +264,4 @@ OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO = "<=";
|
||||||
OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
|
OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
|
||||||
OpenLayers.Filter.Comparison.BETWEEN = "..";
|
OpenLayers.Filter.Comparison.BETWEEN = "..";
|
||||||
OpenLayers.Filter.Comparison.LIKE = "~";
|
OpenLayers.Filter.Comparison.LIKE = "~";
|
||||||
|
OpenLayers.Filter.Comparison.IS_NULL = "NULL";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class: OpenLayers.Format.ArcXML
|
* Class: OpenLayers.Format.ArcXML
|
||||||
* Read/Wite ArcXML. Create a new instance with the <OpenLayers.Format.ArcXML>
|
* Read/Write ArcXML. Create a new instance with the <OpenLayers.Format.ArcXML>
|
||||||
* constructor.
|
* constructor.
|
||||||
*
|
*
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class: OpenLayers.Format.ArcXML.Features
|
* Class: OpenLayers.Format.ArcXML.Features
|
||||||
* Read/Wite ArcXML features. Create a new instance with the
|
* Read/Write ArcXML features. Create a new instance with the
|
||||||
* <OpenLayers.Format.ArcXML.Features> constructor.
|
* <OpenLayers.Format.ArcXML.Features> constructor.
|
||||||
*
|
*
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -646,7 +646,7 @@ OpenLayers.Format.Atom = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
}
|
}
|
||||||
components.push(
|
components.push(
|
||||||
new OpenLayers.Geometry.Polygon(
|
new OpenLayers.Geometry.Polygon(
|
||||||
[new OpenLayers.Geometry.LinearRing(components)]
|
[new OpenLayers.Geometry.LinearRing(points)]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @requires OpenLayers/Format/WKT.js
|
* @requires OpenLayers/Format/WKT.js
|
||||||
|
* @requires OpenLayers/Filter/Comparison.js
|
||||||
|
* @requires OpenLayers/Filter/Logical.js
|
||||||
|
* @requires OpenLayers/Filter/Spatial.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,9 +28,10 @@ OpenLayers.Format.CQL = (function() {
|
||||||
patterns = {
|
patterns = {
|
||||||
PROPERTY: /^[_a-zA-Z]\w*/,
|
PROPERTY: /^[_a-zA-Z]\w*/,
|
||||||
COMPARISON: /^(=|<>|<=|<|>=|>|LIKE)/i,
|
COMPARISON: /^(=|<>|<=|<|>=|>|LIKE)/i,
|
||||||
|
IS_NULL: /^IS NULL/i,
|
||||||
COMMA: /^,/,
|
COMMA: /^,/,
|
||||||
LOGICAL: /^(AND|OR)/i,
|
LOGICAL: /^(AND|OR)/i,
|
||||||
VALUE: /^('\w+'|\d+(\.\d*)?|\.\d+)/,
|
VALUE: /^('([^']|'')*'|\d+(\.\d*)?|\.\d+)/,
|
||||||
LPAREN: /^\(/,
|
LPAREN: /^\(/,
|
||||||
RPAREN: /^\)/,
|
RPAREN: /^\)/,
|
||||||
SPATIAL: /^(BBOX|INTERSECTS|DWITHIN|WITHIN|CONTAINS)/i,
|
SPATIAL: /^(BBOX|INTERSECTS|DWITHIN|WITHIN|CONTAINS)/i,
|
||||||
|
@ -63,8 +67,9 @@ OpenLayers.Format.CQL = (function() {
|
||||||
follows = {
|
follows = {
|
||||||
LPAREN: ['GEOMETRY', 'SPATIAL', 'PROPERTY', 'VALUE', 'LPAREN'],
|
LPAREN: ['GEOMETRY', 'SPATIAL', 'PROPERTY', 'VALUE', 'LPAREN'],
|
||||||
RPAREN: ['NOT', 'LOGICAL', 'END', 'RPAREN'],
|
RPAREN: ['NOT', 'LOGICAL', 'END', 'RPAREN'],
|
||||||
PROPERTY: ['COMPARISON', 'BETWEEN', 'COMMA'],
|
PROPERTY: ['COMPARISON', 'BETWEEN', 'COMMA', 'IS_NULL'],
|
||||||
BETWEEN: ['VALUE'],
|
BETWEEN: ['VALUE'],
|
||||||
|
IS_NULL: ['END'],
|
||||||
COMPARISON: ['VALUE'],
|
COMPARISON: ['VALUE'],
|
||||||
COMMA: ['GEOMETRY', 'VALUE', 'PROPERTY'],
|
COMMA: ['GEOMETRY', 'VALUE', 'PROPERTY'],
|
||||||
VALUE: ['LOGICAL', 'COMMA', 'RPAREN', 'END'],
|
VALUE: ['LOGICAL', 'COMMA', 'RPAREN', 'END'],
|
||||||
|
@ -82,7 +87,8 @@ OpenLayers.Format.CQL = (function() {
|
||||||
'>': OpenLayers.Filter.Comparison.GREATER_THAN,
|
'>': OpenLayers.Filter.Comparison.GREATER_THAN,
|
||||||
'>=': OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
|
'>=': OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
|
||||||
'LIKE': OpenLayers.Filter.Comparison.LIKE,
|
'LIKE': OpenLayers.Filter.Comparison.LIKE,
|
||||||
'BETWEEN': OpenLayers.Filter.Comparison.BETWEEN
|
'BETWEEN': OpenLayers.Filter.Comparison.BETWEEN,
|
||||||
|
'IS NULL': OpenLayers.Filter.Comparison.IS_NULL
|
||||||
},
|
},
|
||||||
|
|
||||||
operatorReverse = {},
|
operatorReverse = {},
|
||||||
|
@ -178,6 +184,7 @@ OpenLayers.Format.CQL = (function() {
|
||||||
break;
|
break;
|
||||||
case "COMPARISON":
|
case "COMPARISON":
|
||||||
case "BETWEEN":
|
case "BETWEEN":
|
||||||
|
case "IS_NULL":
|
||||||
case "LOGICAL":
|
case "LOGICAL":
|
||||||
var p = precedence[tok.type];
|
var p = precedence[tok.type];
|
||||||
|
|
||||||
|
@ -254,9 +261,16 @@ OpenLayers.Format.CQL = (function() {
|
||||||
value: value,
|
value: value,
|
||||||
type: operators[tok.text.toUpperCase()]
|
type: operators[tok.text.toUpperCase()]
|
||||||
});
|
});
|
||||||
|
case "IS_NULL":
|
||||||
|
var property = buildTree();
|
||||||
|
return new OpenLayers.Filter.Comparison({
|
||||||
|
property: property,
|
||||||
|
type: operators[tok.text.toUpperCase()]
|
||||||
|
});
|
||||||
case "VALUE":
|
case "VALUE":
|
||||||
if ((/^'.*'$/).test(tok.text)) {
|
var match = tok.text.match(/^'(.*)'$/);
|
||||||
return tok.text.substr(1, tok.text.length - 2);
|
if (match) {
|
||||||
|
return match[1].replace(/''/g, "'");
|
||||||
} else {
|
} else {
|
||||||
return Number(tok.text);
|
return Number(tok.text);
|
||||||
}
|
}
|
||||||
|
@ -415,14 +429,14 @@ OpenLayers.Format.CQL = (function() {
|
||||||
this.write(filter.lowerBoundary) + " AND " +
|
this.write(filter.lowerBoundary) + " AND " +
|
||||||
this.write(filter.upperBoundary);
|
this.write(filter.upperBoundary);
|
||||||
} else {
|
} else {
|
||||||
|
return (filter.value !== null) ? filter.property +
|
||||||
return filter.property +
|
|
||||||
" " + operatorReverse[filter.type] + " " +
|
" " + operatorReverse[filter.type] + " " +
|
||||||
this.write(filter.value);
|
this.write(filter.value) : filter.property +
|
||||||
|
" " + operatorReverse[filter.type];
|
||||||
}
|
}
|
||||||
case undefined:
|
case undefined:
|
||||||
if (typeof filter === "string") {
|
if (typeof filter === "string") {
|
||||||
return "'" + filter + "'";
|
return "'" + filter.replace(/'/g, "''") + "'";
|
||||||
} else if (typeof filter === "number") {
|
} else if (typeof filter === "number") {
|
||||||
return String(filter);
|
return String(filter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -0,0 +1,557 @@
|
||||||
|
/* 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/Format.js
|
||||||
|
* @requires OpenLayers/Feature/Vector.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class: OpenLayers.Format.EncodedPolyline
|
||||||
|
* Class for reading and writing encoded polylines. Create a new instance
|
||||||
|
* with the <OpenLayers.Format.EncodedPolyline> constructor.
|
||||||
|
*
|
||||||
|
* Inherits from:
|
||||||
|
* - <OpenLayers.Format>
|
||||||
|
*/
|
||||||
|
OpenLayers.Format.EncodedPolyline = OpenLayers.Class(OpenLayers.Format, {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIProperty: geometryType
|
||||||
|
* {String} Geometry type to output. One of: linestring (default),
|
||||||
|
* linearring, point, multipoint or polygon. If the geometryType is
|
||||||
|
* point, only the first point of the string is returned.
|
||||||
|
*/
|
||||||
|
geometryType: "linestring",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor: OpenLayers.Format.EncodedPolyline
|
||||||
|
* Create a new parser for encoded polylines
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* options - {Object} An optional object whose properties will be set on
|
||||||
|
* this instance
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {<OpenLayers.Format.EncodedPolyline>} A new encoded polylines parser.
|
||||||
|
*/
|
||||||
|
initialize: function(options) {
|
||||||
|
OpenLayers.Format.prototype.initialize.apply(this, [options]);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: read
|
||||||
|
* Deserialize an encoded polyline string and return a vector feature.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* encoded - {String} An encoded polyline string
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {<OpenLayers.Feature.Vector>} A vector feature with a linestring.
|
||||||
|
*/
|
||||||
|
read: function(encoded) {
|
||||||
|
var geomType;
|
||||||
|
if (this.geometryType == "linestring")
|
||||||
|
geomType = OpenLayers.Geometry.LineString;
|
||||||
|
else if (this.geometryType == "linearring")
|
||||||
|
geomType = OpenLayers.Geometry.LinearRing;
|
||||||
|
else if (this.geometryType == "multipoint")
|
||||||
|
geomType = OpenLayers.Geometry.MultiPoint;
|
||||||
|
else if (this.geometryType != "point" && this.geometryType != "polygon")
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var flatPoints = this.decodeDeltas(encoded, 2);
|
||||||
|
var flatPointsLength = flatPoints.length;
|
||||||
|
|
||||||
|
var pointGeometries = [];
|
||||||
|
for (var i = 0; i + 1 < flatPointsLength;) {
|
||||||
|
var y = flatPoints[i++], x = flatPoints[i++];
|
||||||
|
pointGeometries.push(new OpenLayers.Geometry.Point(x, y));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (this.geometryType == "point")
|
||||||
|
return new OpenLayers.Feature.Vector(
|
||||||
|
pointGeometries[0]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (this.geometryType == "polygon")
|
||||||
|
return new OpenLayers.Feature.Vector(
|
||||||
|
new OpenLayers.Geometry.Polygon([
|
||||||
|
new OpenLayers.Geometry.LinearRing(pointGeometries)
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
return new OpenLayers.Feature.Vector(
|
||||||
|
new geomType(pointGeometries)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: decode
|
||||||
|
* Deserialize an encoded string and return an array of n-dimensional
|
||||||
|
* points.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* encoded - {String} An encoded string
|
||||||
|
* dims - {int} The dimension of the points that are returned
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {Array(Array(int))} An array containing n-dimensional arrays of
|
||||||
|
* coordinates.
|
||||||
|
*/
|
||||||
|
decode: function(encoded, dims, opt_factor) {
|
||||||
|
var factor = opt_factor || 1e5;
|
||||||
|
var flatPoints = this.decodeDeltas(encoded, dims, factor);
|
||||||
|
var flatPointsLength = flatPoints.length;
|
||||||
|
|
||||||
|
var points = [];
|
||||||
|
for (var i = 0; i + (dims - 1) < flatPointsLength;) {
|
||||||
|
var point = [];
|
||||||
|
|
||||||
|
for (var dim = 0; dim < dims; ++dim) {
|
||||||
|
point.push(flatPoints[i++])
|
||||||
|
}
|
||||||
|
|
||||||
|
points.push(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
return points;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: write
|
||||||
|
* Serialize a feature or array of features into a WKT string.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* features - {<OpenLayers.Feature.Vector>|Array} A feature or array of
|
||||||
|
* features
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {String} The WKT string representation of the input geometries
|
||||||
|
*/
|
||||||
|
write: function(features) {
|
||||||
|
var feature;
|
||||||
|
if (features.constructor == Array)
|
||||||
|
feature = features[0];
|
||||||
|
else
|
||||||
|
feature = features;
|
||||||
|
|
||||||
|
var geometry = feature.geometry;
|
||||||
|
var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
|
||||||
|
|
||||||
|
var pointGeometries;
|
||||||
|
if (type == "point")
|
||||||
|
pointGeometries = new Array(geometry);
|
||||||
|
else if (type == "linestring" ||
|
||||||
|
type == "linearring" ||
|
||||||
|
type == "multipoint")
|
||||||
|
pointGeometries = geometry.components;
|
||||||
|
else if (type == "polygon")
|
||||||
|
pointGeometries = geometry.components[0].components;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var flatPoints = [];
|
||||||
|
|
||||||
|
var pointGeometriesLength = pointGeometries.length;
|
||||||
|
for (var i = 0; i < pointGeometriesLength; ++i) {
|
||||||
|
var pointGeometry = pointGeometries[i];
|
||||||
|
flatPoints.push(pointGeometry.y);
|
||||||
|
flatPoints.push(pointGeometry.x);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.encodeDeltas(flatPoints, 2);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: encode
|
||||||
|
* Serialize an array of n-dimensional points and return an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* points - {Array(Array(int))} An array containing n-dimensional
|
||||||
|
* arrays of coordinates
|
||||||
|
* dims - {int} The dimension of the points that should be read
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {String} An encoded string
|
||||||
|
*/
|
||||||
|
encode: function (points, dims, opt_factor) {
|
||||||
|
var factor = opt_factor || 1e5;
|
||||||
|
var flatPoints = [];
|
||||||
|
|
||||||
|
var pointsLength = points.length;
|
||||||
|
for (var i = 0; i < pointsLength; ++i) {
|
||||||
|
var point = points[i];
|
||||||
|
|
||||||
|
for (var dim = 0; dim < dims; ++dim) {
|
||||||
|
flatPoints.push(point[dim]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.encodeDeltas(flatPoints, dims, factor);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: encodeDeltas
|
||||||
|
* Encode a list of n-dimensional points and return an encoded string
|
||||||
|
*
|
||||||
|
* Attention: This function will modify the passed array!
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* numbers - {Array.<number>} A list of n-dimensional points.
|
||||||
|
* dimension - {number} The dimension of the points in the list.
|
||||||
|
* opt_factor - {number=} The factor by which the numbers will be
|
||||||
|
* multiplied. The remaining decimal places will get rounded away.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {string} The encoded string.
|
||||||
|
*/
|
||||||
|
encodeDeltas: function(numbers, dimension, opt_factor) {
|
||||||
|
var factor = opt_factor || 1e5;
|
||||||
|
var d;
|
||||||
|
|
||||||
|
var lastNumbers = new Array(dimension);
|
||||||
|
for (d = 0; d < dimension; ++d) {
|
||||||
|
lastNumbers[d] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var numbersLength = numbers.length;
|
||||||
|
for (var i = 0; i < numbersLength;) {
|
||||||
|
for (d = 0; d < dimension; ++d, ++i) {
|
||||||
|
var num = numbers[i];
|
||||||
|
var delta = num - lastNumbers[d];
|
||||||
|
lastNumbers[d] = num;
|
||||||
|
|
||||||
|
numbers[i] = delta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.encodeFloats(numbers, factor);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: decodeDeltas
|
||||||
|
* Decode a list of n-dimensional points from an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* encoded - {string} An encoded string.
|
||||||
|
* dimension - {number} The dimension of the points in the encoded string.
|
||||||
|
* opt_factor - {number=} The factor by which the resulting numbers will
|
||||||
|
* be divided.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {Array.<number>} A list of n-dimensional points.
|
||||||
|
*/
|
||||||
|
decodeDeltas: function(encoded, dimension, opt_factor) {
|
||||||
|
var factor = opt_factor || 1e5;
|
||||||
|
var d;
|
||||||
|
|
||||||
|
var lastNumbers = new Array(dimension);
|
||||||
|
for (d = 0; d < dimension; ++d) {
|
||||||
|
lastNumbers[d] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var numbers = this.decodeFloats(encoded, factor);
|
||||||
|
|
||||||
|
var numbersLength = numbers.length;
|
||||||
|
for (var i = 0; i < numbersLength;) {
|
||||||
|
for (d = 0; d < dimension; ++d, ++i) {
|
||||||
|
lastNumbers[d] += numbers[i];
|
||||||
|
|
||||||
|
numbers[i] = lastNumbers[d];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return numbers;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: encodeFloats
|
||||||
|
* Encode a list of floating point numbers and return an encoded string
|
||||||
|
*
|
||||||
|
* Attention: This function will modify the passed array!
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* numbers - {Array.<number>} A list of floating point numbers.
|
||||||
|
* opt_factor - {number=} The factor by which the numbers will be
|
||||||
|
* multiplied. The remaining decimal places will get rounded away.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {string} The encoded string.
|
||||||
|
*/
|
||||||
|
encodeFloats: function(numbers, opt_factor) {
|
||||||
|
var factor = opt_factor || 1e5;
|
||||||
|
|
||||||
|
var numbersLength = numbers.length;
|
||||||
|
for (var i = 0; i < numbersLength; ++i) {
|
||||||
|
numbers[i] = Math.round(numbers[i] * factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.encodeSignedIntegers(numbers);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: decodeFloats
|
||||||
|
* Decode a list of floating point numbers from an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* encoded - {string} An encoded string.
|
||||||
|
* opt_factor - {number=} The factor by which the result will be divided.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {Array.<number>} A list of floating point numbers.
|
||||||
|
*/
|
||||||
|
decodeFloats: function(encoded, opt_factor) {
|
||||||
|
var factor = opt_factor || 1e5;
|
||||||
|
|
||||||
|
var numbers = this.decodeSignedIntegers(encoded);
|
||||||
|
|
||||||
|
var numbersLength = numbers.length;
|
||||||
|
for (var i = 0; i < numbersLength; ++i) {
|
||||||
|
numbers[i] /= factor;
|
||||||
|
}
|
||||||
|
|
||||||
|
return numbers;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: encodeSignedIntegers
|
||||||
|
* Encode a list of signed integers and return an encoded string
|
||||||
|
*
|
||||||
|
* Attention: This function will modify the passed array!
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* numbers - {Array.<number>} A list of signed integers.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {string} The encoded string.
|
||||||
|
*/
|
||||||
|
encodeSignedIntegers: function(numbers) {
|
||||||
|
var numbersLength = numbers.length;
|
||||||
|
for (var i = 0; i < numbersLength; ++i) {
|
||||||
|
var num = numbers[i];
|
||||||
|
|
||||||
|
var signedNum = num << 1;
|
||||||
|
if (num < 0) {
|
||||||
|
signedNum = ~(signedNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
numbers[i] = signedNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.encodeUnsignedIntegers(numbers);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: decodeSignedIntegers
|
||||||
|
* Decode a list of signed integers from an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* encoded - {string} An encoded string.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {Array.<number>} A list of signed integers.
|
||||||
|
*/
|
||||||
|
decodeSignedIntegers: function(encoded) {
|
||||||
|
var numbers = this.decodeUnsignedIntegers(encoded);
|
||||||
|
|
||||||
|
var numbersLength = numbers.length;
|
||||||
|
for (var i = 0; i < numbersLength; ++i) {
|
||||||
|
var num = numbers[i];
|
||||||
|
numbers[i] = (num & 1) ? ~(num >> 1) : (num >> 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return numbers;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: encodeUnsignedIntegers
|
||||||
|
* Encode a list of unsigned integers and return an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* numbers - {Array.<number>} A list of unsigned integers.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {string} The encoded string.
|
||||||
|
*/
|
||||||
|
encodeUnsignedIntegers: function(numbers) {
|
||||||
|
var encoded = '';
|
||||||
|
|
||||||
|
var numbersLength = numbers.length;
|
||||||
|
for (var i = 0; i < numbersLength; ++i) {
|
||||||
|
encoded += this.encodeUnsignedInteger(numbers[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return encoded;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: decodeUnsignedIntegers
|
||||||
|
* Decode a list of unsigned integers from an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* encoded - {string} An encoded string.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {Array.<number>} A list of unsigned integers.
|
||||||
|
*/
|
||||||
|
decodeUnsignedIntegers: function(encoded) {
|
||||||
|
var numbers = [];
|
||||||
|
|
||||||
|
var current = 0;
|
||||||
|
var shift = 0;
|
||||||
|
|
||||||
|
var encodedLength = encoded.length;
|
||||||
|
for (var i = 0; i < encodedLength; ++i) {
|
||||||
|
var b = encoded.charCodeAt(i) - 63;
|
||||||
|
|
||||||
|
current |= (b & 0x1f) << shift;
|
||||||
|
|
||||||
|
if (b < 0x20) {
|
||||||
|
numbers.push(current);
|
||||||
|
current = 0;
|
||||||
|
shift = 0;
|
||||||
|
} else {
|
||||||
|
shift += 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return numbers;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: encodeFloat
|
||||||
|
* Encode one single floating point number and return an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* num - {number} Floating point number that should be encoded.
|
||||||
|
* opt_factor - {number=} The factor by which num will be multiplied.
|
||||||
|
* The remaining decimal places will get rounded away.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {string} The encoded string.
|
||||||
|
*/
|
||||||
|
encodeFloat: function(num, opt_factor) {
|
||||||
|
num = Math.round(num * (opt_factor || 1e5));
|
||||||
|
return this.encodeSignedInteger(num);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: decodeFloat
|
||||||
|
* Decode one single floating point number from an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* encoded - {string} An encoded string.
|
||||||
|
* opt_factor - {number=} The factor by which the result will be divided.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {number} The decoded floating point number.
|
||||||
|
*/
|
||||||
|
decodeFloat: function(encoded, opt_factor) {
|
||||||
|
var result = this.decodeSignedInteger(encoded);
|
||||||
|
return result / (opt_factor || 1e5);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: encodeSignedInteger
|
||||||
|
* Encode one single signed integer and return an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* num - {number} Signed integer that should be encoded.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {string} The encoded string.
|
||||||
|
*/
|
||||||
|
encodeSignedInteger: function(num) {
|
||||||
|
var signedNum = num << 1;
|
||||||
|
if (num < 0) {
|
||||||
|
signedNum = ~(signedNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.encodeUnsignedInteger(signedNum);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: decodeSignedInteger
|
||||||
|
* Decode one single signed integer from an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* encoded - {string} An encoded string.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {number} The decoded signed integer.
|
||||||
|
*/
|
||||||
|
decodeSignedInteger: function(encoded) {
|
||||||
|
var result = this.decodeUnsignedInteger(encoded);
|
||||||
|
return ((result & 1) ? ~(result >> 1) : (result >> 1));
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: encodeUnsignedInteger
|
||||||
|
* Encode one single unsigned integer and return an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* num - {number} Unsigned integer that should be encoded.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {string} The encoded string.
|
||||||
|
*/
|
||||||
|
encodeUnsignedInteger: function(num) {
|
||||||
|
var value, encoded = '';
|
||||||
|
while (num >= 0x20) {
|
||||||
|
value = (0x20 | (num & 0x1f)) + 63;
|
||||||
|
encoded += (String.fromCharCode(value));
|
||||||
|
num >>= 5;
|
||||||
|
}
|
||||||
|
value = num + 63;
|
||||||
|
encoded += (String.fromCharCode(value));
|
||||||
|
return encoded;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: decodeUnsignedInteger
|
||||||
|
* Decode one single unsigned integer from an encoded string
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* encoded - {string} An encoded string.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {number} The decoded unsigned integer.
|
||||||
|
*/
|
||||||
|
decodeUnsignedInteger: function(encoded) {
|
||||||
|
var result = 0;
|
||||||
|
var shift = 0;
|
||||||
|
|
||||||
|
var encodedLength = encoded.length;
|
||||||
|
for (var i = 0; i < encodedLength; ++i) {
|
||||||
|
var b = encoded.charCodeAt(i) - 63;
|
||||||
|
|
||||||
|
result |= (b & 0x1f) << shift;
|
||||||
|
|
||||||
|
if (b < 0x20)
|
||||||
|
break;
|
||||||
|
|
||||||
|
shift += 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
|
CLASS_NAME: "OpenLayers.Format.EncodedPolyline"
|
||||||
|
});
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class: OpenLayers.Format.Filter
|
* Class: OpenLayers.Format.Filter
|
||||||
* Read/Wite ogc:Filter. Create a new instance with the <OpenLayers.Format.Filter>
|
* Read/Write ogc:Filter. Create a new instance with the <OpenLayers.Format.Filter>
|
||||||
* constructor.
|
* constructor.
|
||||||
*
|
*
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -6,6 +6,7 @@
|
||||||
* @requires OpenLayers/Format/Filter.js
|
* @requires OpenLayers/Format/Filter.js
|
||||||
* @requires OpenLayers/Format/XML.js
|
* @requires OpenLayers/Format/XML.js
|
||||||
* @requires OpenLayers/Filter/Function.js
|
* @requires OpenLayers/Filter/Function.js
|
||||||
|
* @requires OpenLayers/BaseTypes/Date.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +28,7 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
xlink: "http://www.w3.org/1999/xlink",
|
xlink: "http://www.w3.org/1999/xlink",
|
||||||
xsi: "http://www.w3.org/2001/XMLSchema-instance"
|
xsi: "http://www.w3.org/2001/XMLSchema-instance"
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: defaultPrefix
|
* Property: defaultPrefix
|
||||||
*/
|
*/
|
||||||
|
@ -180,18 +181,18 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
},
|
},
|
||||||
"Literal": function(node, obj) {
|
"Literal": function(node, obj) {
|
||||||
obj.value = OpenLayers.String.numericIf(
|
obj.value = OpenLayers.String.numericIf(
|
||||||
this.getChildValue(node));
|
this.getChildValue(node), true);
|
||||||
},
|
},
|
||||||
"PropertyName": function(node, filter) {
|
"PropertyName": function(node, filter) {
|
||||||
filter.property = this.getChildValue(node);
|
filter.property = this.getChildValue(node);
|
||||||
},
|
},
|
||||||
"LowerBoundary": function(node, filter) {
|
"LowerBoundary": function(node, filter) {
|
||||||
filter.lowerBoundary = OpenLayers.String.numericIf(
|
filter.lowerBoundary = OpenLayers.String.numericIf(
|
||||||
this.readers.ogc._expression.call(this, node));
|
this.readers.ogc._expression.call(this, node), true);
|
||||||
},
|
},
|
||||||
"UpperBoundary": function(node, filter) {
|
"UpperBoundary": function(node, filter) {
|
||||||
filter.upperBoundary = OpenLayers.String.numericIf(
|
filter.upperBoundary = OpenLayers.String.numericIf(
|
||||||
this.readers.ogc._expression.call(this, node));
|
this.readers.ogc._expression.call(this, node), true);
|
||||||
},
|
},
|
||||||
"Intersects": function(node, obj) {
|
"Intersects": function(node, obj) {
|
||||||
this.readSpatial(node, obj, OpenLayers.Filter.Spatial.INTERSECTS);
|
this.readSpatial(node, obj, OpenLayers.Filter.Spatial.INTERSECTS);
|
||||||
|
@ -212,6 +213,13 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
"Function": function(node, obj) {
|
"Function": function(node, obj) {
|
||||||
//TODO write decoder for it
|
//TODO write decoder for it
|
||||||
return;
|
return;
|
||||||
|
},
|
||||||
|
"PropertyIsNull": function(node, obj) {
|
||||||
|
var filter = new OpenLayers.Filter.Comparison({
|
||||||
|
type: OpenLayers.Filter.Comparison.IS_NULL
|
||||||
|
});
|
||||||
|
this.readChildNodes(node, filter);
|
||||||
|
obj.filters.push(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -239,6 +247,25 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
obj.filters.push(filter);
|
obj.filters.push(filter);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APIMethod: encodeLiteral
|
||||||
|
* Generates the string representation of a value for use in <Literal>
|
||||||
|
* elements. The default encoder writes Date values as ISO 8601
|
||||||
|
* strings.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* value - {Object} Literal value to encode
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* {String} String representation of the provided value.
|
||||||
|
*/
|
||||||
|
encodeLiteral: function(value) {
|
||||||
|
if (value instanceof Date) {
|
||||||
|
value = OpenLayers.Date.toISOString(value);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: writeOgcExpression
|
* Method: writeOgcExpression
|
||||||
* Limited support for writing OGC expressions. Currently it supports
|
* Limited support for writing OGC expressions. Currently it supports
|
||||||
|
@ -252,9 +279,8 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
* {DOMElement} Updated node element.
|
* {DOMElement} Updated node element.
|
||||||
*/
|
*/
|
||||||
writeOgcExpression: function(value, node) {
|
writeOgcExpression: function(value, node) {
|
||||||
if(value instanceof OpenLayers.Filter.Function){
|
if (value instanceof OpenLayers.Filter.Function){
|
||||||
var child = this.writeNode("Function", value, node);
|
this.writeNode("Function", value, node);
|
||||||
node.appendChild(child);
|
|
||||||
} else {
|
} else {
|
||||||
this.writeNode("Literal", value, node);
|
this.writeNode("Literal", value, node);
|
||||||
}
|
}
|
||||||
|
@ -274,19 +300,6 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
return this.writers.ogc["Filter"].apply(this, [filter]);
|
return this.writers.ogc["Filter"].apply(this, [filter]);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Method: writeFeatureIdNodes
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* filter - {<OpenLayers.Filter.FeatureId}
|
|
||||||
* node - {DOMElement}
|
|
||||||
*/
|
|
||||||
writeFeatureIdNodes: function(filter, node) {
|
|
||||||
for (var i=0, ii=filter.fids.length; i<ii; ++i) {
|
|
||||||
this.writeNode("FeatureId", filter.fids[i], node);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: writers
|
* Property: writers
|
||||||
* As a compliment to the readers property, this structure contains public
|
* As a compliment to the readers property, this structure contains public
|
||||||
|
@ -297,10 +310,13 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
"ogc": {
|
"ogc": {
|
||||||
"Filter": function(filter) {
|
"Filter": function(filter) {
|
||||||
var node = this.createElementNSPlus("ogc:Filter");
|
var node = this.createElementNSPlus("ogc:Filter");
|
||||||
if (filter.type === "FID") {
|
this.writeNode(this.getFilterType(filter), filter, node);
|
||||||
OpenLayers.Format.Filter.v1.prototype.writeFeatureIdNodes.call(this, filter, node);
|
return node;
|
||||||
} else {
|
},
|
||||||
this.writeNode(this.getFilterType(filter), filter, node);
|
"_featureIds": function(filter) {
|
||||||
|
var node = this.createDocumentFragment();
|
||||||
|
for (var i=0, ii=filter.fids.length; i<ii; ++i) {
|
||||||
|
this.writeNode("ogc:FeatureId", filter.fids[i], node);
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
|
@ -314,14 +330,10 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
var childFilter;
|
var childFilter;
|
||||||
for (var i=0, ii=filter.filters.length; i<ii; ++i) {
|
for (var i=0, ii=filter.filters.length; i<ii; ++i) {
|
||||||
childFilter = filter.filters[i];
|
childFilter = filter.filters[i];
|
||||||
if (childFilter.type === "FID") {
|
|
||||||
OpenLayers.Format.Filter.v1.prototype.writeFeatureIdNodes.call(this, childFilter, node);
|
|
||||||
} else {
|
|
||||||
this.writeNode(
|
this.writeNode(
|
||||||
this.getFilterType(childFilter), childFilter, node
|
this.getFilterType(childFilter), childFilter, node
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
"Or": function(filter) {
|
"Or": function(filter) {
|
||||||
|
@ -329,26 +341,18 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
var childFilter;
|
var childFilter;
|
||||||
for (var i=0, ii=filter.filters.length; i<ii; ++i) {
|
for (var i=0, ii=filter.filters.length; i<ii; ++i) {
|
||||||
childFilter = filter.filters[i];
|
childFilter = filter.filters[i];
|
||||||
if (childFilter.type === "FID") {
|
|
||||||
OpenLayers.Format.Filter.v1.prototype.writeFeatureIdNodes.call(this, childFilter, node);
|
|
||||||
} else {
|
|
||||||
this.writeNode(
|
this.writeNode(
|
||||||
this.getFilterType(childFilter), childFilter, node
|
this.getFilterType(childFilter), childFilter, node
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
"Not": function(filter) {
|
"Not": function(filter) {
|
||||||
var node = this.createElementNSPlus("ogc:Not");
|
var node = this.createElementNSPlus("ogc:Not");
|
||||||
var childFilter = filter.filters[0];
|
var childFilter = filter.filters[0];
|
||||||
if (childFilter.type === "FID") {
|
|
||||||
OpenLayers.Format.Filter.v1.prototype.writeFeatureIdNodes.call(this, childFilter, node);
|
|
||||||
} else {
|
|
||||||
this.writeNode(
|
this.writeNode(
|
||||||
this.getFilterType(childFilter), childFilter, node
|
this.getFilterType(childFilter), childFilter, node
|
||||||
);
|
);
|
||||||
}
|
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
"PropertyIsLessThan": function(filter) {
|
"PropertyIsLessThan": function(filter) {
|
||||||
|
@ -398,9 +402,10 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
"Literal": function(value) {
|
"Literal": function(value) {
|
||||||
// no ogc:expression handling for now
|
var encode = this.encodeLiteral ||
|
||||||
|
OpenLayers.Format.Filter.v1.prototype.encodeLiteral;
|
||||||
return this.createElementNSPlus("ogc:Literal", {
|
return this.createElementNSPlus("ogc:Literal", {
|
||||||
value: value
|
value: encode(value)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
"LowerBoundary": function(filter) {
|
"LowerBoundary": function(filter) {
|
||||||
|
@ -448,6 +453,11 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
this.writeOgcExpression(params[i], node);
|
this.writeOgcExpression(params[i], node);
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
|
},
|
||||||
|
"PropertyIsNull": function(filter) {
|
||||||
|
var node = this.createElementNSPlus("ogc:PropertyIsNull");
|
||||||
|
this.writeNode("PropertyName", filter, node);
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -480,12 +490,13 @@ OpenLayers.Format.Filter.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
">=": "PropertyIsGreaterThanOrEqualTo",
|
">=": "PropertyIsGreaterThanOrEqualTo",
|
||||||
"..": "PropertyIsBetween",
|
"..": "PropertyIsBetween",
|
||||||
"~": "PropertyIsLike",
|
"~": "PropertyIsLike",
|
||||||
|
"NULL": "PropertyIsNull",
|
||||||
"BBOX": "BBOX",
|
"BBOX": "BBOX",
|
||||||
"DWITHIN": "DWITHIN",
|
"DWITHIN": "DWITHIN",
|
||||||
"WITHIN": "WITHIN",
|
"WITHIN": "WITHIN",
|
||||||
"CONTAINS": "CONTAINS",
|
"CONTAINS": "CONTAINS",
|
||||||
"INTERSECTS": "INTERSECTS",
|
"INTERSECTS": "INTERSECTS",
|
||||||
"FID": "FeatureId"
|
"FID": "_featureIds"
|
||||||
},
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Format.Filter.v1"
|
CLASS_NAME: "OpenLayers.Format.Filter.v1"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class: OpenLayers.Format.GML
|
* Class: OpenLayers.Format.GML
|
||||||
* Read/Wite GML. Create a new instance with the <OpenLayers.Format.GML>
|
* Read/Write GML. Create a new instance with the <OpenLayers.Format.GML>
|
||||||
* constructor. Supports the GML simple features profile.
|
* constructor. Supports the GML simple features profile.
|
||||||
*
|
*
|
||||||
* Inherits from:
|
* Inherits from:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -230,7 +230,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
}
|
}
|
||||||
return OpenLayers.Format.XML.prototype.readNode.apply(this, [node, obj]);
|
return OpenLayers.Format.XML.prototype.readNode.apply(this, [node, obj]);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: readers
|
* Property: readers
|
||||||
* Contains public functions, grouped by namespace prefix, that will
|
* Contains public functions, grouped by namespace prefix, that will
|
||||||
|
@ -241,6 +241,9 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
*/
|
*/
|
||||||
readers: {
|
readers: {
|
||||||
"gml": {
|
"gml": {
|
||||||
|
"_inherit": function(node, obj, container) {
|
||||||
|
// To be implemented by version specific parsers
|
||||||
|
},
|
||||||
"featureMember": function(node, obj) {
|
"featureMember": function(node, obj) {
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
},
|
},
|
||||||
|
@ -309,6 +312,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
},
|
},
|
||||||
"MultiPoint": function(node, container) {
|
"MultiPoint": function(node, container) {
|
||||||
var obj = {components: []};
|
var obj = {components: []};
|
||||||
|
this.readers.gml._inherit.apply(this, [node, obj, container]);
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
container.components = [
|
container.components = [
|
||||||
new OpenLayers.Geometry.MultiPoint(obj.components)
|
new OpenLayers.Geometry.MultiPoint(obj.components)
|
||||||
|
@ -319,6 +323,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
},
|
},
|
||||||
"LineString": function(node, container) {
|
"LineString": function(node, container) {
|
||||||
var obj = {};
|
var obj = {};
|
||||||
|
this.readers.gml._inherit.apply(this, [node, obj, container]);
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
if(!container.components) {
|
if(!container.components) {
|
||||||
container.components = [];
|
container.components = [];
|
||||||
|
@ -329,6 +334,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
},
|
},
|
||||||
"MultiLineString": function(node, container) {
|
"MultiLineString": function(node, container) {
|
||||||
var obj = {components: []};
|
var obj = {components: []};
|
||||||
|
this.readers.gml._inherit.apply(this, [node, obj, container]);
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
container.components = [
|
container.components = [
|
||||||
new OpenLayers.Geometry.MultiLineString(obj.components)
|
new OpenLayers.Geometry.MultiLineString(obj.components)
|
||||||
|
@ -339,6 +345,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
},
|
},
|
||||||
"Polygon": function(node, container) {
|
"Polygon": function(node, container) {
|
||||||
var obj = {outer: null, inner: []};
|
var obj = {outer: null, inner: []};
|
||||||
|
this.readers.gml._inherit.apply(this, [node, obj, container]);
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
obj.inner.unshift(obj.outer);
|
obj.inner.unshift(obj.outer);
|
||||||
if(!container.components) {
|
if(!container.components) {
|
||||||
|
@ -350,6 +357,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
},
|
},
|
||||||
"LinearRing": function(node, obj) {
|
"LinearRing": function(node, obj) {
|
||||||
var container = {};
|
var container = {};
|
||||||
|
this.readers.gml._inherit.apply(this, [node, container]);
|
||||||
this.readChildNodes(node, container);
|
this.readChildNodes(node, container);
|
||||||
obj.components = [new OpenLayers.Geometry.LinearRing(
|
obj.components = [new OpenLayers.Geometry.LinearRing(
|
||||||
container.points
|
container.points
|
||||||
|
@ -357,6 +365,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
},
|
},
|
||||||
"MultiPolygon": function(node, container) {
|
"MultiPolygon": function(node, container) {
|
||||||
var obj = {components: []};
|
var obj = {components: []};
|
||||||
|
this.readers.gml._inherit.apply(this, [node, obj, container]);
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
container.components = [
|
container.components = [
|
||||||
new OpenLayers.Geometry.MultiPolygon(obj.components)
|
new OpenLayers.Geometry.MultiPolygon(obj.components)
|
||||||
|
@ -367,6 +376,7 @@ OpenLayers.Format.GML.Base = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
},
|
},
|
||||||
"GeometryCollection": function(node, container) {
|
"GeometryCollection": function(node, container) {
|
||||||
var obj = {components: []};
|
var obj = {components: []};
|
||||||
|
this.readers.gml._inherit.apply(this, [node, obj, container]);
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
container.components = [
|
container.components = [
|
||||||
new OpenLayers.Geometry.Collection(obj.components)
|
new OpenLayers.Geometry.Collection(obj.components)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -90,11 +90,20 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
|
||||||
*/
|
*/
|
||||||
readers: {
|
readers: {
|
||||||
"gml": OpenLayers.Util.applyDefaults({
|
"gml": OpenLayers.Util.applyDefaults({
|
||||||
|
"_inherit": function(node, obj, container) {
|
||||||
|
// SRSReferenceGroup attributes
|
||||||
|
var dim = parseInt(node.getAttribute("srsDimension"), 10) ||
|
||||||
|
(container && container.srsDimension);
|
||||||
|
if (dim) {
|
||||||
|
obj.srsDimension = dim;
|
||||||
|
}
|
||||||
|
},
|
||||||
"featureMembers": function(node, obj) {
|
"featureMembers": function(node, obj) {
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
},
|
},
|
||||||
"Curve": function(node, container) {
|
"Curve": function(node, container) {
|
||||||
var obj = {points: []};
|
var obj = {points: []};
|
||||||
|
this.readers.gml._inherit.apply(this, [node, obj, container]);
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
if(!container.components) {
|
if(!container.components) {
|
||||||
container.components = [];
|
container.components = [];
|
||||||
|
@ -135,7 +144,9 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
|
||||||
this.regExes.trimSpace, ""
|
this.regExes.trimSpace, ""
|
||||||
);
|
);
|
||||||
var coords = str.split(this.regExes.splitSpace);
|
var coords = str.split(this.regExes.splitSpace);
|
||||||
var dim = parseInt(node.getAttribute("dimension")) || 2;
|
// The "dimension" attribute is from the GML 3.0.1 spec.
|
||||||
|
var dim = obj.srsDimension ||
|
||||||
|
parseInt(node.getAttribute("srsDimension") || node.getAttribute("dimension"), 10) || 2;
|
||||||
var j, x, y, z;
|
var j, x, y, z;
|
||||||
var numPoints = coords.length / dim;
|
var numPoints = coords.length / dim;
|
||||||
var points = new Array(numPoints);
|
var points = new Array(numPoints);
|
||||||
|
@ -172,6 +183,7 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
|
||||||
},
|
},
|
||||||
"MultiCurve": function(node, container) {
|
"MultiCurve": function(node, container) {
|
||||||
var obj = {components: []};
|
var obj = {components: []};
|
||||||
|
this.readers.gml._inherit.apply(this, [node, obj, container]);
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
if(obj.components.length > 0) {
|
if(obj.components.length > 0) {
|
||||||
container.components = [
|
container.components = [
|
||||||
|
@ -184,6 +196,7 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
|
||||||
},
|
},
|
||||||
"MultiSurface": function(node, container) {
|
"MultiSurface": function(node, container) {
|
||||||
var obj = {components: []};
|
var obj = {components: []};
|
||||||
|
this.readers.gml._inherit.apply(this, [node, obj, container]);
|
||||||
this.readChildNodes(node, obj);
|
this.readChildNodes(node, obj);
|
||||||
if(obj.components.length > 0) {
|
if(obj.components.length > 0) {
|
||||||
container.components = [
|
container.components = [
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -250,11 +250,11 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
*/
|
*/
|
||||||
buildMetadataNode: function(metadata) {
|
buildMetadataNode: function(metadata) {
|
||||||
var types = ['name', 'desc', 'author'],
|
var types = ['name', 'desc', 'author'],
|
||||||
node = this.createElementNSPlus('gpx:metadata');
|
node = this.createElementNS(this.namespaces.gpx, 'metadata');
|
||||||
for (var i=0; i < types.length; i++) {
|
for (var i=0; i < types.length; i++) {
|
||||||
var type = types[i];
|
var type = types[i];
|
||||||
if (metadata[type]) {
|
if (metadata[type]) {
|
||||||
var n = this.createElementNSPlus("gpx:" + type);
|
var n = this.createElementNS(this.namespaces.gpx, type);
|
||||||
n.appendChild(this.createTextNode(metadata[type]));
|
n.appendChild(this.createTextNode(metadata[type]));
|
||||||
node.appendChild(n);
|
node.appendChild(n);
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
this.appendAttributesNode(wpt, feature);
|
this.appendAttributesNode(wpt, feature);
|
||||||
return wpt;
|
return wpt;
|
||||||
} else {
|
} else {
|
||||||
var trkNode = this.createElementNSPlus("gpx:trk");
|
var trkNode = this.createElementNS(this.namespaces.gpx, "trk");
|
||||||
this.appendAttributesNode(trkNode, feature);
|
this.appendAttributesNode(trkNode, feature);
|
||||||
var trkSegNodes = this.buildTrkSegNode(geometry);
|
var trkSegNodes = this.buildTrkSegNode(geometry);
|
||||||
trkSegNodes = OpenLayers.Util.isArray(trkSegNodes) ?
|
trkSegNodes = OpenLayers.Util.isArray(trkSegNodes) ?
|
||||||
|
@ -312,7 +312,7 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
nodes;
|
nodes;
|
||||||
if (geometry.CLASS_NAME == "OpenLayers.Geometry.LineString" ||
|
if (geometry.CLASS_NAME == "OpenLayers.Geometry.LineString" ||
|
||||||
geometry.CLASS_NAME == "OpenLayers.Geometry.LinearRing") {
|
geometry.CLASS_NAME == "OpenLayers.Geometry.LinearRing") {
|
||||||
node = this.createElementNSPlus("gpx:trkseg");
|
node = this.createElementNS(this.namespaces.gpx, "trkseg");
|
||||||
for (i = 0, len=geometry.components.length; i < len; i++) {
|
for (i = 0, len=geometry.components.length; i < len; i++) {
|
||||||
point = geometry.components[i];
|
point = geometry.components[i];
|
||||||
node.appendChild(this.buildTrkPtNode(point));
|
node.appendChild(this.buildTrkPtNode(point));
|
||||||
|
@ -338,7 +338,7 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
* {DOMElement} A trkpt node
|
* {DOMElement} A trkpt node
|
||||||
*/
|
*/
|
||||||
buildTrkPtNode: function(point) {
|
buildTrkPtNode: function(point) {
|
||||||
var node = this.createElementNSPlus("gpx:trkpt");
|
var node = this.createElementNS(this.namespaces.gpx, "trkpt");
|
||||||
node.setAttribute("lon", point.x);
|
node.setAttribute("lon", point.x);
|
||||||
node.setAttribute("lat", point.y);
|
node.setAttribute("lat", point.y);
|
||||||
return node;
|
return node;
|
||||||
|
@ -355,7 +355,7 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
* {DOMElement} A wpt node
|
* {DOMElement} A wpt node
|
||||||
*/
|
*/
|
||||||
buildWptNode: function(geometry) {
|
buildWptNode: function(geometry) {
|
||||||
var node = this.createElementNSPlus("gpx:wpt");
|
var node = this.createElementNS(this.namespaces.gpx, "wpt");
|
||||||
node.setAttribute("lon", geometry.x);
|
node.setAttribute("lon", geometry.x);
|
||||||
node.setAttribute("lat", geometry.y);
|
node.setAttribute("lat", geometry.y);
|
||||||
return node;
|
return node;
|
||||||
|
@ -370,11 +370,11 @@ OpenLayers.Format.GPX = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
* feature - {<OpenLayers.Feature.Vector>}
|
* feature - {<OpenLayers.Feature.Vector>}
|
||||||
*/
|
*/
|
||||||
appendAttributesNode: function(node, feature) {
|
appendAttributesNode: function(node, feature) {
|
||||||
var name = this.createElementNSPlus('gpx:name');
|
var name = this.createElementNS(this.namespaces.gpx, 'name');
|
||||||
name.appendChild(this.createTextNode(
|
name.appendChild(this.createTextNode(
|
||||||
feature.attributes.name || feature.id));
|
feature.attributes.name || feature.id));
|
||||||
node.appendChild(name);
|
node.appendChild(name);
|
||||||
var desc = this.createElementNSPlus('gpx:desc');
|
var desc = this.createElementNS(this.namespaces.gpx, 'desc');
|
||||||
desc.appendChild(this.createTextNode(
|
desc.appendChild(this.createTextNode(
|
||||||
feature.attributes.description || this.defaultDesc));
|
feature.attributes.description || this.defaultDesc));
|
||||||
node.appendChild(desc);
|
node.appendChild(desc);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -311,8 +311,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: parseStyles
|
* Method: parseStyles
|
||||||
* Looks for <Style> nodes in the data and parses them
|
* Parses <Style> nodes
|
||||||
* Also parses <StyleMap> nodes, but only uses the 'normal' key
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* nodes - {Array} of {DOMElement} data to read/parse.
|
* nodes - {Array} of {DOMElement} data to read/parse.
|
||||||
|
@ -558,8 +557,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: parseStyleMaps
|
* Method: parseStyleMaps
|
||||||
* Looks for <Style> nodes in the data and parses them
|
* Parses <StyleMap> nodes, but only uses the 'normal' key
|
||||||
* Also parses <StyleMap> nodes, but only uses the 'normal' key
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* nodes - {Array} of {DOMElement} data to read/parse.
|
* nodes - {Array} of {DOMElement} data to read/parse.
|
||||||
|
@ -733,7 +731,8 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
}
|
}
|
||||||
if (this.trackAttributes) {
|
if (this.trackAttributes) {
|
||||||
for (var j=0, jj=this.trackAttributes.length; j<jj; ++j) {
|
for (var j=0, jj=this.trackAttributes.length; j<jj; ++j) {
|
||||||
feature.attributes[name] = obj.attributes[this.trackAttributes[j]][i];
|
var name = this.trackAttributes[j];
|
||||||
|
feature.attributes[name] = obj.attributes[name][i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
feature.attributes.when = obj.whens[i];
|
feature.attributes.when = obj.whens[i];
|
||||||
|
@ -1212,8 +1211,8 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
createPlacemarkXML: function(feature) {
|
createPlacemarkXML: function(feature) {
|
||||||
// Placemark name
|
// Placemark name
|
||||||
var placemarkName = this.createElementNS(this.kmlns, "name");
|
var placemarkName = this.createElementNS(this.kmlns, "name");
|
||||||
var name = feature.style && feature.style.label ? feature.style.label :
|
var label = (feature.style && feature.style.label) ? feature.style.label : feature.id;
|
||||||
feature.attributes.name || feature.id;
|
var name = feature.attributes.name || label;
|
||||||
placemarkName.appendChild(this.createTextNode(name));
|
placemarkName.appendChild(this.createTextNode(name));
|
||||||
|
|
||||||
// Placemark description
|
// Placemark description
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
|
||||||
* full list of contributors). Published under the 2-clause BSD license.
|
* full list of contributors). Published under the 2-clause BSD license.
|
||||||
* See license.txt in the OpenLayers distribution or repository for the
|
* See license.txt in the OpenLayers distribution or repository for the
|
||||||
* full text of the license. */
|
* full text of the license. */
|
||||||
|
@ -270,8 +270,8 @@ OpenLayers.Format.OWSCommon.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||||
*/
|
*/
|
||||||
writers: {
|
writers: {
|
||||||
"ows": {
|
"ows": {
|
||||||
"BoundingBox": function(options) {
|
"BoundingBox": function(options, nodeName) {
|
||||||
var node = this.createElementNSPlus("ows:BoundingBox", {
|
var node = this.createElementNSPlus(nodeName || "ows:BoundingBox", {
|
||||||
attributes: {
|
attributes: {
|
||||||
crs: options.projection
|
crs: options.projection
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue