Project

General

Profile

Revision d2a8c3fd

Added by Marc Nicolas almost 9 years ago

Ajout des src de la 3.0 avec les modif pour Flarecast

View differences:

flarecast/BonnePratiquesIHM.md
1
# Bonnes pratiques de développement IHM sitools2 #
2

  
3
### Ouverture d'un composant : ###
4

  
5
	//On récupère le sitoolsController
6
	var sitoolsController = Desktop.getApplication().getController	('core.SitoolsController');
7
	//On ouvre le composant
8
	sitoolsController.openComponent(jsObject, componentsConfig, windowConfig);
9

  
10

  
11
### DatasetView ###
12

  
13
#### Definition d'un sorter :
14

  
15
	{
16
		property : columnAlias
17
		direction : ASC ou DESC
18
	}
19

  
20
Résultat dans la requête :
21

  
22
	sort:[{"field":"dataset","direction":"ASC"}]
23

  
24
#### Definition d'un filtre de formulaire (formFilter):
25

  
26
	{
27
		type : this.type,
28
		code : this.code,
29
		value : value1 | value2...,
30
		userDimension : this.userDimension,
31
		userUnit : this.userUnit
32
	}
33

  
34
Résultat dans la requête :
35

  
36
	p[0]=type|code|value|userDimension|userUnit
37

  
38
#### Definition d'un filtre de formulaire concept (formFilterConcept):
39

  
40
	{
41
		type : this.type,
42
		code : this.code, // concept name
43
		dictionary : this.dictionary,
44
		value : value1 | value2...,
45
		userDimension : this.userDimension,
46
		userUnit : this.userUnit,
47
	}
48

  
49
Résultat dans la requête :
50

  
51
	c[0]=type|dictionary, concept|value|userDimension|userUnit
52

  
53

  
54
#### Definition d'un filtre dans la dataview (gridFilter):
55

  
56
La définition se décompose en 2 parties :
57

  
58
Configuration du filtre (nécessaire pour ouvrir le FilterService avec la configuration sauvegardé)
59

  
60
	[{
61
		"columnAlias" : "dateobs",
62
		"data" : {
63
			"comparison" : "gte",
64
			"value" : "2000-11-13T00:00:00.000",
65
			"type" : "date"
66
		}
67
	}, {
68
		"columnAlias" : "dateobs",
69
		"data" : {
70
			"comparison" : "lte",
71
			"value" : "2014-11-13T00:00:00.000",
72
			"type" : "date"
73
		}
74
	}]
75

  
76

  
77
Definition du filtre (nécessaire pour produire la requête)
78

  
79
	{
80
		"columnAlias" : "dateobs",
81
		"value" : {
82
			"from" : "2000-11-13T00:00:00",
83
			"to" : "2014-11-13T00:00:00"
84
		},
85
		"type" : "date"
86
	}
87

  
88
Résultat dans la requête :
89

  
90
	filter[0][columnAlias]=dateobs&filter[0][data][comparison]=gte&filter[0][data][value]=2000-11-13T00:00:00.000&filter[0][data][type]=date&filter[1][columnAlias]=dateobs&filter[1][data][comparison]=lte&filter[1][data][value]=2014-11-13T00:00:00.000&filter[1][data][type]=date
91

  
92
Définition d'une sélection
93

  
94
*Une sélection est toujours relative à une liste de tri et une liste de sorters*
95

  
96
	{
97
		ranges : [[0,10], [15,25]],
98
		nbRecordsSelection : 10,
99
		startIndex : 25
100
	}
101

  
102

  
103
Liste des parametres nécessaires pour ouverture d'une dataview :
104

  
105
	{
106
		dataset =>  dataset {
107
			id
108
			name
109
			sitoolsAttachementForUsers
110
			columnModel
111
			dictionaryMappings
112
			datasetViewConfig
113
		}
114
		formParams => Liste de filtres de type formulaire
115
		gridFilters => Liste de filtres de type grid
116
		gridFiltersCfg => Liste de configuration de filtres de type grid
117
		sortInfo => Liste des tris,
118
		ranges => Liste de ranges,
119
		formConceptParams => List de filtres de type formulaire concept
120
	}
121

  
122

  
123
### Panier ###
124

  
125
	{
126
		"selections" : [{
127
				"selectionName" : "headers",
128
				"selectionId" : "headers",
129
				"datasetId" : "1b5185b9-422b-4d1b-8ceb-aa265bf8c271",
130
				"dataUrl" : "/headers",
131
				"datasetName" : "headers",
132
				"selections" : "ranges=%5B%5B0%2C16%5D%5D&p%5B0%5D=TEXTFIELD%7Cdataset%7CA00%25&filter%5B0%5D%5BcolumnAlias%5D=dataset&filter%5B0%5D%5Bdata%5D%5Bcomparison%5D=LIKE&filter%5B0%5D%5Bdata%5D%5Bvalue%5D=A00%25&filter%5B0%5D%5Bdata%5D%5Btype%5D=string&sort=%5B%5D",
133
				"ranges" : "[[0,16]]",
134
				"dataToExport" : [],
135
				"startIndex" : 0,
136
				"nbRecords" : 17,
137
				"orderDate" : "2014-12-01T11:48:20.169",
138
				"colModel" : [{
139
						"columnAlias" : "dataset",
140
						"header" : "dataset"
141
					}, {
142
						"columnAlias" : "targname",
143
						"header" : "targname"
144
					}, {
145
						"columnAlias" : "ra_targ",
146
						"header" : "ra_targ"
147
					}, {
148
						"columnAlias" : "dec_targ",
149
						"header" : "dec_targ"
150
					}, {
151
						"columnAlias" : "dateobs",
152
						"header" : "dateobs"
153
					}
154
				],
155
				"gridFilters" : [{
156
						"columnAlias" : "dataset",
157
						"data" : {
158
							"comparison" : "LIKE",
159
							"value" : "A00%",
160
							"type" : "string"
161
						}
162
					}
163
				],
164
				"gridFiltersCfg" : [{
165
						"columnAlias" : "dataset",
166
						"value" : "A00%",
167
						"type" : "string"
168
					}
169
				],
170
				"sortInfo" : "[]",
171
				"formFilters" : [{
172
						"type" : "TEXTFIELD",
173
						"code" : "dataset",
174
						"value" : "A00%"
175
					}
176
				]
177
			}
178
		]
179
	}
flarecast/README.md
1
![](workspace/client-public/res/images/logo_01_petiteTaille.png)
2
# SITools2
3
## Description
4
SITools2 is a new CNES generic tool performed by a joint effort between CNES and scientific laboratories. The aim of SITools is to provide a self-manageable data access layer deployed on already existing scientific laboratory databases.
5

  
6
For more information : [http://sourceforge.net/projects/sitools2/](http://sourceforge.net/projects/sitools2/ "SITools2 Web Site")
7

  
8
Release notes : [README.txt](workspace/sitools-build/files/README.txt)
9

  
10
## Building SITools2
11

  
12
### Getting the sources
13

  
14
	$ git clone https://github.com/SITools2/core-v2.git sitools2-v2
15
	
16
### Pre-build configuration
17

  
18
	$ cd sitools2-v2/workspace/fr.cnes.sitools.core
19

  
20
Edit `build.properties` and change the value of the `HOST` property (for example HOST = new-dev)
21

  
22
Make a copy of `conf/build/properties/build-example.properties` to `conf/build/properties/build-new-dev.properties`
23

  
24
	$ cp conf/build/properties/build-example.properties conf/build/properties/build-new-dev.properties
25

  
26

  
27
Edit the newly created file and set the `ROOT_DIRECTORY` property to the sitools2-v2 folder
28

  
29
### Build the sources
30

  
31
Build the sources using ant
32

  
33
	$ ant
34

  
35
## Building the installer from the sources
36
### Build the core
37

  
38
Build the sitools core using the instructions above
39

  
40
### Build the extensions
41

  
42
	$ cd sitools2-v2/workspace/fr.cnes.sitools.extensions
43
	$ ant
44

  
45
### Build the installer
46

  
47
	$ cd sitools2-v2/workspace/sitools-install-izpack	
48

  
49
Edit the `build.properties` file and update the `ROOT_DIRECTORY_LOCAL` with the value of the `sitools2-v2` folder path.
50

  
51
Build the installer using ant
52

  
53
	$ ant
54

  
55
## Installing from the installer
56
	$ java -jar SITools2-<version>-install.jar
57

  
58
## Starting SITools2
59

  
60
	$ sh sitools.sh start
61
or 
62

  
63
	$ ./sitools2-v2/workspace/fr.cnes.sitools.core/sitools start
64
if `source` is not installed on your computer.
65

  
66
## First step in SITools2
67

  
68
### Administration UI
69

  
70
Go to : http://{publicHostDomain}/sitools/client-admin/index.html
71

  
72
- user : **admin** 
73
- password : **admin**
74

  
75
### Portal UI
76

  
77
Go to : http://{publicHostDomain}/sitools/client-portal/index.html
78

  
79
## Features
80
- Client/server application
81
- REST architecture
82
- User management
83
- Data sources management
84
- Datasets management (SQL builder as WYSIWYG Editor, ...)
85
- Projects management
86
- Security management
87
- Conversions capabilities such as units, ...
88
- Query form builder as WYSIWYG editor
89
- Extensible Framework (plug-ins, ...) at the server level
90
- Application module management on the client side
91
- Internationalization
92
- RSS management
93
- Open search management
flarecast/cots/OpenLayers-2.13.1/.gitignore
1
/build/OpenLayers.js
2
/tools/closure-compiler.jar
3
/tools/*.pyc
4
/apidoc_config/Data/
5
/doc/apidocs/
6
/examples/example-list.js
7
/examples/example-list.xml
flarecast/cots/OpenLayers-2.13.1/OpenLayers.debug.js
1
/*
2

  
3
  OpenLayers.js -- OpenLayers Map Viewer Library
4

  
5
  Copyright (c) 2006-2013 by OpenLayers Contributors
6
  Published under the 2-clause BSD license.
7
  See http://openlayers.org/dev/license.txt for the full text of the license, and http://openlayers.org/dev/authors.txt for full list of contributors.
8

  
9
  Includes compressed code under the following licenses:
10

  
11
  (For uncompressed versions of the code used, please see the
12
  OpenLayers Github repository: <https://github.com/openlayers/openlayers>)
13

  
14
*/
15

  
16
/**
17
 * Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/>
18
 * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)
19
 *
20
 * Licensed under the Apache License, Version 2.0 (the "License");
21
 * you may not use this file except in compliance with the License.
22
 * You may obtain a copy of the License at
23
 * http://www.apache.org/licenses/LICENSE-2.0
24
 */
25

  
26
/**
27
 * OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is
28
 * Copyright (c) 2006, Yahoo! Inc.
29
 * All rights reserved.
30
 * 
31
 * Redistribution and use of this software in source and binary forms, with or
32
 * without modification, are permitted provided that the following conditions
33
 * are met:
34
 * 
35
 * * Redistributions of source code must retain the above copyright notice,
36
 *   this list of conditions and the following disclaimer.
37
 * 
38
 * * Redistributions in binary form must reproduce the above copyright notice,
39
 *   this list of conditions and the following disclaimer in the documentation
40
 *   and/or other materials provided with the distribution.
41
 * 
42
 * * Neither the name of Yahoo! Inc. nor the names of its contributors may be
43
 *   used to endorse or promote products derived from this software without
44
 *   specific prior written permission of Yahoo! Inc.
45
 * 
46
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
47
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
50
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
51
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
52
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
53
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
54
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
55
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
56
 * POSSIBILITY OF SUCH DAMAGE.
57
 */
58
/* ======================================================================
59
    OpenLayers/SingleFile.js
60
   ====================================================================== */
61

  
62
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
63
 * full list of contributors). Published under the 2-clause BSD license.
64
 * See license.txt in the OpenLayers distribution or repository for the
65
 * full text of the license. */
66

  
67
var OpenLayers = {
68
    /**
69
     * Constant: VERSION_NUMBER
70
     */
71
    VERSION_NUMBER: "Release 2.13.1",
72

  
73
    /**
74
     * Constant: singleFile
75
     * TODO: remove this in 3.0 when we stop supporting build profiles that
76
     * include OpenLayers.js
77
     */
78
    singleFile: true,
79

  
80
    /**
81
     * Method: _getScriptLocation
82
     * Return the path to this script. This is also implemented in
83
     * OpenLayers.js
84
     *
85
     * Returns:
86
     * {String} Path to this script
87
     */
88
    _getScriptLocation: (function() {
89
        var r = new RegExp("(^|(.*?\\/))(OpenLayers[^\\/]*?\\.js)(\\?|$)"),
90
            s = document.getElementsByTagName('script'),
91
            src, m, l = "";
92
        for(var i=0, len=s.length; i<len; i++) {
93
            src = s[i].getAttribute('src');
94
            if(src) {
95
                m = src.match(r);
96
                if(m) {
97
                    l = m[1];
98
                    break;
99
                }
100
            }
101
        }
102
        return (function() { return l; });
103
    })(),
104
    
105
    /**
106
     * Property: ImgPath
107
     * {String} Set this to the path where control images are stored, a path  
108
     * given here must end with a slash. If set to '' (which is the default) 
109
     * OpenLayers will use its script location + "img/".
110
     * 
111
     * You will need to set this property when you have a singlefile build of 
112
     * OpenLayers that either is not named "OpenLayers.js" or if you move
113
     * the file in a way such that the image directory cannot be derived from 
114
     * the script location.
115
     * 
116
     * If your custom OpenLayers build is named "my-custom-ol.js" and the images
117
     * of OpenLayers are in a folder "/resources/external/images/ol" a correct
118
     * way of including OpenLayers in your HTML would be:
119
     * 
120
     * (code)
121
     *   <script src="/path/to/my-custom-ol.js" type="text/javascript"></script>
122
     *   <script type="text/javascript">
123
     *      // tell OpenLayers where the control images are
124
     *      // remember the trailing slash
125
     *      OpenLayers.ImgPath = "/resources/external/images/ol/";
126
     *   </script>
127
     * (end code)
128
     * 
129
     * Please remember that when your OpenLayers script is not named 
130
     * "OpenLayers.js" you will have to make sure that the default theme is 
131
     * loaded into the page by including an appropriate <link>-tag, 
132
     * e.g.:
133
     * 
134
     * (code)
135
     *   <link rel="stylesheet" href="/path/to/default/style.css"  type="text/css">
136
     * (end code)
137
     */
138
    ImgPath : ''
139
};
140
/* ======================================================================
141
    OpenLayers/BaseTypes/Class.js
142
   ====================================================================== */
143

  
144
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
145
 * full list of contributors). Published under the 2-clause BSD license.
146
 * See license.txt in the OpenLayers distribution or repository for the
147
 * full text of the license. */
148

  
149
/**
150
 * @requires OpenLayers/SingleFile.js
151
 */
152

  
153
/**
154
 * Constructor: OpenLayers.Class
155
 * Base class used to construct all other classes. Includes support for 
156
 *     multiple inheritance. 
157
 *     
158
 * This constructor is new in OpenLayers 2.5.  At OpenLayers 3.0, the old 
159
 *     syntax for creating classes and dealing with inheritance 
160
 *     will be removed.
161
 * 
162
 * To create a new OpenLayers-style class, use the following syntax:
163
 * (code)
164
 *     var MyClass = OpenLayers.Class(prototype);
165
 * (end)
166
 *
167
 * To create a new OpenLayers-style class with multiple inheritance, use the
168
 *     following syntax:
169
 * (code)
170
 *     var MyClass = OpenLayers.Class(Class1, Class2, prototype);
171
 * (end)
172
 * 
173
 * Note that instanceof reflection will only reveal Class1 as superclass.
174
 *
175
 */
176
OpenLayers.Class = function() {
177
    var len = arguments.length;
178
    var P = arguments[0];
179
    var F = arguments[len-1];
180

  
181
    var C = typeof F.initialize == "function" ?
182
        F.initialize :
183
        function(){ P.prototype.initialize.apply(this, arguments); };
184

  
185
    if (len > 1) {
186
        var newArgs = [C, P].concat(
187
                Array.prototype.slice.call(arguments).slice(1, len-1), F);
188
        OpenLayers.inherit.apply(null, newArgs);
189
    } else {
190
        C.prototype = F;
191
    }
192
    return C;
193
};
194

  
195
/**
196
 * Function: OpenLayers.inherit
197
 *
198
 * Parameters:
199
 * C - {Object} the class that inherits
200
 * P - {Object} the superclass to inherit from
201
 *
202
 * In addition to the mandatory C and P parameters, an arbitrary number of
203
 * objects can be passed, which will extend C.
204
 */
205
OpenLayers.inherit = function(C, P) {
206
   var F = function() {};
207
   F.prototype = P.prototype;
208
   C.prototype = new F;
209
   var i, l, o;
210
   for(i=2, l=arguments.length; i<l; i++) {
211
       o = arguments[i];
212
       if(typeof o === "function") {
213
           o = o.prototype;
214
       }
215
       OpenLayers.Util.extend(C.prototype, o);
216
   }
217
};
218

  
219
/**
220
 * APIFunction: extend
221
 * Copy all properties of a source object to a destination object.  Modifies
222
 *     the passed in destination object.  Any properties on the source object
223
 *     that are set to undefined will not be (re)set on the destination object.
224
 *
225
 * Parameters:
226
 * destination - {Object} The object that will be modified
227
 * source - {Object} The object with properties to be set on the destination
228
 *
229
 * Returns:
230
 * {Object} The destination object.
231
 */
232
OpenLayers.Util = OpenLayers.Util || {};
233
OpenLayers.Util.extend = function(destination, source) {
234
    destination = destination || {};
235
    if (source) {
236
        for (var property in source) {
237
            var value = source[property];
238
            if (value !== undefined) {
239
                destination[property] = value;
240
            }
241
        }
242

  
243
        /**
244
         * IE doesn't include the toString property when iterating over an object's
245
         * properties with the for(property in object) syntax.  Explicitly check if
246
         * the source has its own toString property.
247
         */
248

  
249
        /*
250
         * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
251
         * prototype object" when calling hawOwnProperty if the source object
252
         * is an instance of window.Event.
253
         */
254

  
255
        var sourceIsEvt = typeof window.Event == "function"
256
                          && source instanceof window.Event;
257

  
258
        if (!sourceIsEvt
259
           && source.hasOwnProperty && source.hasOwnProperty("toString")) {
260
            destination.toString = source.toString;
261
        }
262
    }
263
    return destination;
264
};
265
/* ======================================================================
266
    OpenLayers/BaseTypes.js
267
   ====================================================================== */
268

  
269
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
270
 * full list of contributors). Published under the 2-clause BSD license.
271
 * See license.txt in the OpenLayers distribution or repository for the
272
 * full text of the license. */
273

  
274
/**
275
 * @requires OpenLayers/SingleFile.js
276
 */
277

  
278
/** 
279
 * Header: OpenLayers Base Types
280
 * OpenLayers custom string, number and function functions are described here.
281
 */
282

  
283
/**
284
 * Namespace: OpenLayers.String
285
 * Contains convenience functions for string manipulation.
286
 */
287
OpenLayers.String = {
288

  
289
    /**
290
     * APIFunction: startsWith
291
     * Test whether a string starts with another string. 
292
     * 
293
     * Parameters:
294
     * str - {String} The string to test.
295
     * sub - {String} The substring to look for.
296
     *  
297
     * Returns:
298
     * {Boolean} The first string starts with the second.
299
     */
300
    startsWith: function(str, sub) {
301
        return (str.indexOf(sub) == 0);
302
    },
303

  
304
    /**
305
     * APIFunction: contains
306
     * Test whether a string contains another string.
307
     * 
308
     * Parameters:
309
     * str - {String} The string to test.
310
     * sub - {String} The substring to look for.
311
     * 
312
     * Returns:
313
     * {Boolean} The first string contains the second.
314
     */
315
    contains: function(str, sub) {
316
        return (str.indexOf(sub) != -1);
317
    },
318
    
319
    /**
320
     * APIFunction: trim
321
     * Removes leading and trailing whitespace characters from a string.
322
     * 
323
     * Parameters:
324
     * str - {String} The (potentially) space padded string.  This string is not
325
     *     modified.
326
     * 
327
     * Returns:
328
     * {String} A trimmed version of the string with all leading and 
329
     *     trailing spaces removed.
330
     */
331
    trim: function(str) {
332
        return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
333
    },
334
    
335
    /**
336
     * APIFunction: camelize
337
     * Camel-case a hyphenated string. 
338
     *     Ex. "chicken-head" becomes "chickenHead", and
339
     *     "-chicken-head" becomes "ChickenHead".
340
     *
341
     * Parameters:
342
     * str - {String} The string to be camelized.  The original is not modified.
343
     * 
344
     * Returns:
345
     * {String} The string, camelized
346
     */
347
    camelize: function(str) {
348
        var oStringList = str.split('-');
349
        var camelizedString = oStringList[0];
350
        for (var i=1, len=oStringList.length; i<len; i++) {
351
            var s = oStringList[i];
352
            camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
353
        }
354
        return camelizedString;
355
    },
356
    
357
    /**
358
     * APIFunction: format
359
     * Given a string with tokens in the form ${token}, return a string
360
     *     with tokens replaced with properties from the given context
361
     *     object.  Represent a literal "${" by doubling it, e.g. "${${".
362
     *
363
     * Parameters:
364
     * template - {String} A string with tokens to be replaced.  A template
365
     *     has the form "literal ${token}" where the token will be replaced
366
     *     by the value of context["token"].
367
     * context - {Object} An optional object with properties corresponding
368
     *     to the tokens in the format string.  If no context is sent, the
369
     *     window object will be used.
370
     * args - {Array} Optional arguments to pass to any functions found in
371
     *     the context.  If a context property is a function, the token
372
     *     will be replaced by the return from the function called with
373
     *     these arguments.
374
     *
375
     * Returns:
376
     * {String} A string with tokens replaced from the context object.
377
     */
378
    format: function(template, context, args) {
379
        if(!context) {
380
            context = window;
381
        }
382

  
383
        // Example matching: 
384
        // str   = ${foo.bar}
385
        // match = foo.bar
386
        var replacer = function(str, match) {
387
            var replacement;
388

  
389
            // Loop through all subs. Example: ${a.b.c}
390
            // 0 -> replacement = context[a];
391
            // 1 -> replacement = context[a][b];
392
            // 2 -> replacement = context[a][b][c];
393
            var subs = match.split(/\.+/);
394
            for (var i=0; i< subs.length; i++) {
395
                if (i == 0) {
396
                    replacement = context;
397
                }
398
                if (replacement === undefined) {
399
                    break;
400
                }
401
                replacement = replacement[subs[i]];
402
            }
403

  
404
            if(typeof replacement == "function") {
405
                replacement = args ?
406
                    replacement.apply(null, args) :
407
                    replacement();
408
            }
409

  
410
            // If replacement is undefined, return the string 'undefined'.
411
            // This is a workaround for a bugs in browsers not properly 
412
            // dealing with non-participating groups in regular expressions:
413
            // http://blog.stevenlevithan.com/archives/npcg-javascript
414
            if (typeof replacement == 'undefined') {
415
                return 'undefined';
416
            } else {
417
                return replacement; 
418
            }
419
        };
420

  
421
        return template.replace(OpenLayers.String.tokenRegEx, replacer);
422
    },
423

  
424
    /**
425
     * Property: tokenRegEx
426
     * Used to find tokens in a string.
427
     * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
428
     */
429
    tokenRegEx:  /\$\{([\w.]+?)\}/g,
430
    
431
    /**
432
     * Property: numberRegEx
433
     * Used to test strings as numbers.
434
     */
435
    numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
436
    
437
    /**
438
     * APIFunction: isNumeric
439
     * Determine whether a string contains only a numeric value.
440
     *
441
     * Examples:
442
     * (code)
443
     * OpenLayers.String.isNumeric("6.02e23") // true
444
     * OpenLayers.String.isNumeric("12 dozen") // false
445
     * OpenLayers.String.isNumeric("4") // true
446
     * OpenLayers.String.isNumeric(" 4 ") // false
447
     * (end)
448
     *
449
     * Returns:
450
     * {Boolean} String contains only a number.
451
     */
452
    isNumeric: function(value) {
453
        return OpenLayers.String.numberRegEx.test(value);
454
    },
455
    
456
    /**
457
     * APIFunction: numericIf
458
     * Converts a string that appears to be a numeric value into a number.
459
     * 
460
     * Parameters:
461
     * value - {String}
462
     * trimWhitespace - {Boolean}
463
     *
464
     * Returns:
465
     * {Number|String} a Number if the passed value is a number, a String
466
     *     otherwise. 
467
     */
468
    numericIf: function(value, trimWhitespace) {
469
        var originalValue = value;
470
        if (trimWhitespace === true && value != null && value.replace) {
471
            value = value.replace(/^\s*|\s*$/g, "");
472
        }
473
        return OpenLayers.String.isNumeric(value) ? parseFloat(value) : originalValue;
474
    }
475

  
476
};
477

  
478
/**
479
 * Namespace: OpenLayers.Number
480
 * Contains convenience functions for manipulating numbers.
481
 */
482
OpenLayers.Number = {
483

  
484
    /**
485
     * Property: decimalSeparator
486
     * Decimal separator to use when formatting numbers.
487
     */
488
    decimalSeparator: ".",
489
    
490
    /**
491
     * Property: thousandsSeparator
492
     * Thousands separator to use when formatting numbers.
493
     */
494
    thousandsSeparator: ",",
495
    
496
    /**
497
     * APIFunction: limitSigDigs
498
     * Limit the number of significant digits on a float.
499
     * 
500
     * Parameters:
501
     * num - {Float}
502
     * sig - {Integer}
503
     * 
504
     * Returns:
505
     * {Float} The number, rounded to the specified number of significant
506
     *     digits.
507
     */
508
    limitSigDigs: function(num, sig) {
509
        var fig = 0;
510
        if (sig > 0) {
511
            fig = parseFloat(num.toPrecision(sig));
512
        }
513
        return fig;
514
    },
515
    
516
    /**
517
     * APIFunction: format
518
     * Formats a number for output.
519
     * 
520
     * Parameters:
521
     * num  - {Float}
522
     * dec  - {Integer} Number of decimal places to round to.
523
     *        Defaults to 0. Set to null to leave decimal places unchanged.
524
     * tsep - {String} Thousands separator.
525
     *        Default is ",".
526
     * dsep - {String} Decimal separator.
527
     *        Default is ".".
528
     *
529
     * Returns:
530
     * {String} A string representing the formatted number.
531
     */
532
    format: function(num, dec, tsep, dsep) {
533
        dec = (typeof dec != "undefined") ? dec : 0; 
534
        tsep = (typeof tsep != "undefined") ? tsep :
535
            OpenLayers.Number.thousandsSeparator; 
536
        dsep = (typeof dsep != "undefined") ? dsep :
537
            OpenLayers.Number.decimalSeparator;
538

  
539
        if (dec != null) {
540
            num = parseFloat(num.toFixed(dec));
541
        }
542

  
543
        var parts = num.toString().split(".");
544
        if (parts.length == 1 && dec == null) {
545
            // integer where we do not want to touch the decimals
546
            dec = 0;
547
        }
548
        
549
        var integer = parts[0];
550
        if (tsep) {
551
            var thousands = /(-?[0-9]+)([0-9]{3})/; 
552
            while(thousands.test(integer)) { 
553
                integer = integer.replace(thousands, "$1" + tsep + "$2"); 
554
            }
555
        }
556
        
557
        var str;
558
        if (dec == 0) {
559
            str = integer;
560
        } else {
561
            var rem = parts.length > 1 ? parts[1] : "0";
562
            if (dec != null) {
563
                rem = rem + new Array(dec - rem.length + 1).join("0");
564
            }
565
            str = integer + dsep + rem;
566
        }
567
        return str;
568
    },
569

  
570
    /**
571
     * Method: zeroPad
572
     * Create a zero padded string optionally with a radix for casting numbers.
573
     *
574
     * Parameters:
575
     * num - {Number} The number to be zero padded.
576
     * len - {Number} The length of the string to be returned.
577
     * radix - {Number} An integer between 2 and 36 specifying the base to use
578
     *     for representing numeric values.
579
     */
580
    zeroPad: function(num, len, radix) {
581
        var str = num.toString(radix || 10);
582
        while (str.length < len) {
583
            str = "0" + str;
584
        }
585
        return str;
586
    }    
587
};
588

  
589
/**
590
 * Namespace: OpenLayers.Function
591
 * Contains convenience functions for function manipulation.
592
 */
593
OpenLayers.Function = {
594
    /**
595
     * APIFunction: bind
596
     * Bind a function to an object.  Method to easily create closures with
597
     *     'this' altered.
598
     * 
599
     * Parameters:
600
     * func - {Function} Input function.
601
     * object - {Object} The object to bind to the input function (as this).
602
     * 
603
     * Returns:
604
     * {Function} A closure with 'this' set to the passed in object.
605
     */
606
    bind: function(func, object) {
607
        // create a reference to all arguments past the second one
608
        var args = Array.prototype.slice.apply(arguments, [2]);
609
        return function() {
610
            // Push on any additional arguments from the actual function call.
611
            // These will come after those sent to the bind call.
612
            var newArgs = args.concat(
613
                Array.prototype.slice.apply(arguments, [0])
614
            );
615
            return func.apply(object, newArgs);
616
        };
617
    },
618
    
619
    /**
620
     * APIFunction: bindAsEventListener
621
     * Bind a function to an object, and configure it to receive the event
622
     *     object as first parameter when called. 
623
     * 
624
     * Parameters:
625
     * func - {Function} Input function to serve as an event listener.
626
     * object - {Object} A reference to this.
627
     * 
628
     * Returns:
629
     * {Function}
630
     */
631
    bindAsEventListener: function(func, object) {
632
        return function(event) {
633
            return func.call(object, event || window.event);
634
        };
635
    },
636
    
637
    /**
638
     * APIFunction: False
639
     * A simple function to that just does "return false". We use this to 
640
     * avoid attaching anonymous functions to DOM event handlers, which 
641
     * causes "issues" on IE<8.
642
     * 
643
     * Usage:
644
     * document.onclick = OpenLayers.Function.False;
645
     * 
646
     * Returns:
647
     * {Boolean}
648
     */
649
    False : function() {
650
        return false;
651
    },
652

  
653
    /**
654
     * APIFunction: True
655
     * A simple function to that just does "return true". We use this to 
656
     * avoid attaching anonymous functions to DOM event handlers, which 
657
     * causes "issues" on IE<8.
658
     * 
659
     * Usage:
660
     * document.onclick = OpenLayers.Function.True;
661
     * 
662
     * Returns:
663
     * {Boolean}
664
     */
665
    True : function() {
666
        return true;
667
    },
668
    
669
    /**
670
     * APIFunction: Void
671
     * A reusable function that returns ``undefined``.
672
     *
673
     * Returns:
674
     * {undefined}
675
     */
676
    Void: function() {}
677

  
678
};
679

  
680
/**
681
 * Namespace: OpenLayers.Array
682
 * Contains convenience functions for array manipulation.
683
 */
684
OpenLayers.Array = {
685

  
686
    /**
687
     * APIMethod: filter
688
     * Filter an array.  Provides the functionality of the
689
     *     Array.prototype.filter extension to the ECMA-262 standard.  Where
690
     *     available, Array.prototype.filter will be used.
691
     *
692
     * Based on well known example from http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter
693
     *
694
     * Parameters:
695
     * array - {Array} The array to be filtered.  This array is not mutated.
696
     *     Elements added to this array by the callback will not be visited.
697
     * callback - {Function} A function that is called for each element in
698
     *     the array.  If this function returns true, the element will be
699
     *     included in the return.  The function will be called with three
700
     *     arguments: the element in the array, the index of that element, and
701
     *     the array itself.  If the optional caller parameter is specified
702
     *     the callback will be called with this set to caller.
703
     * caller - {Object} Optional object to be set as this when the callback
704
     *     is called.
705
     *
706
     * Returns:
707
     * {Array} An array of elements from the passed in array for which the
708
     *     callback returns true.
709
     */
710
    filter: function(array, callback, caller) {
711
        var selected = [];
712
        if (Array.prototype.filter) {
713
            selected = array.filter(callback, caller);
714
        } else {
715
            var len = array.length;
716
            if (typeof callback != "function") {
717
                throw new TypeError();
718
            }
719
            for(var i=0; i<len; i++) {
720
                if (i in array) {
721
                    var val = array[i];
722
                    if (callback.call(caller, val, i, array)) {
723
                        selected.push(val);
724
                    }
725
                }
726
            }        
727
        }
728
        return selected;
729
    }
730
    
731
};
732
/* ======================================================================
733
    OpenLayers/BaseTypes/Bounds.js
734
   ====================================================================== */
735

  
736
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
737
 * full list of contributors). Published under the 2-clause BSD license.
738
 * See license.txt in the OpenLayers distribution or repository for the
739
 * full text of the license. */
740

  
741
/**
742
 * @requires OpenLayers/BaseTypes/Class.js
743
 */
744

  
745
/**
746
 * Class: OpenLayers.Bounds
747
 * Instances of this class represent bounding boxes.  Data stored as left,
748
 * bottom, right, top floats. All values are initialized to null, however,
749
 * you should make sure you set them before using the bounds for anything.
750
 * 
751
 * Possible use case:
752
 * (code)
753
 *     bounds = new OpenLayers.Bounds();
754
 *     bounds.extend(new OpenLayers.LonLat(4,5));
755
 *     bounds.extend(new OpenLayers.LonLat(5,6));
756
 *     bounds.toBBOX(); // returns 4,5,5,6
757
 * (end)
758
 */
759
OpenLayers.Bounds = OpenLayers.Class({
760

  
761
    /**
762
     * Property: left
763
     * {Number} Minimum horizontal coordinate.
764
     */
765
    left: null,
766

  
767
    /**
768
     * Property: bottom
769
     * {Number} Minimum vertical coordinate.
770
     */
771
    bottom: null,
772

  
773
    /**
774
     * Property: right
775
     * {Number} Maximum horizontal coordinate.
776
     */
777
    right: null,
778

  
779
    /**
780
     * Property: top
781
     * {Number} Maximum vertical coordinate.
782
     */
783
    top: null,
784
    
785
    /**
786
     * Property: centerLonLat
787
     * {<OpenLayers.LonLat>} A cached center location.  This should not be
788
     *     accessed directly.  Use <getCenterLonLat> instead.
789
     */
790
    centerLonLat: null,
791

  
792
    /**
793
     * Constructor: OpenLayers.Bounds
794
     * Construct a new bounds object. Coordinates can either be passed as four
795
     * arguments, or as a single argument.
796
     *
797
     * Parameters (four arguments):
798
     * left - {Number} The left bounds of the box.  Note that for width
799
     *        calculations, this is assumed to be less than the right value.
800
     * bottom - {Number} The bottom bounds of the box.  Note that for height
801
     *          calculations, this is assumed to be less than the top value.
802
     * right - {Number} The right bounds.
803
     * top - {Number} The top bounds.
804
     *
805
     * Parameters (single argument):
806
     * bounds - {Array(Number)} [left, bottom, right, top]
807
     */
808
    initialize: function(left, bottom, right, top) {
809
        if (OpenLayers.Util.isArray(left)) {
810
            top = left[3];
811
            right = left[2];
812
            bottom = left[1];
813
            left = left[0];
814
        }
815
        if (left != null) {
816
            this.left = OpenLayers.Util.toFloat(left);
817
        }
818
        if (bottom != null) {
819
            this.bottom = OpenLayers.Util.toFloat(bottom);
820
        }
821
        if (right != null) {
822
            this.right = OpenLayers.Util.toFloat(right);
823
        }
824
        if (top != null) {
825
            this.top = OpenLayers.Util.toFloat(top);
826
        }
827
    },
828

  
829
    /**
830
     * Method: clone
831
     * Create a cloned instance of this bounds.
832
     *
833
     * Returns:
834
     * {<OpenLayers.Bounds>} A fresh copy of the bounds
835
     */
836
    clone:function() {
837
        return new OpenLayers.Bounds(this.left, this.bottom, 
838
                                     this.right, this.top);
839
    },
840

  
841
    /**
842
     * Method: equals
843
     * Test a two bounds for equivalence.
844
     *
845
     * Parameters:
846
     * bounds - {<OpenLayers.Bounds>}
847
     *
848
     * Returns:
849
     * {Boolean} The passed-in bounds object has the same left,
850
     *           right, top, bottom components as this.  Note that if bounds 
851
     *           passed in is null, returns false.
852
     */
853
    equals:function(bounds) {
854
        var equals = false;
855
        if (bounds != null) {
856
            equals = ((this.left == bounds.left) && 
857
                      (this.right == bounds.right) &&
858
                      (this.top == bounds.top) && 
859
                      (this.bottom == bounds.bottom));
860
        }
861
        return equals;
862
    },
863

  
864
    /** 
865
     * APIMethod: toString
866
     * Returns a string representation of the bounds object.
867
     * 
868
     * Returns:
869
     * {String} String representation of bounds object. 
870
     */
871
    toString:function() {
872
        return [this.left, this.bottom, this.right, this.top].join(",");
873
    },
874

  
875
    /**
876
     * APIMethod: toArray
877
     * Returns an array representation of the bounds object.
878
     *
879
     * Returns an array of left, bottom, right, top properties, or -- when the
880
     *     optional parameter is true -- an array of the  bottom, left, top,
881
     *     right properties.
882
     *
883
     * Parameters:
884
     * reverseAxisOrder - {Boolean} Should we reverse the axis order?
885
     *
886
     * Returns:
887
     * {Array} array of left, bottom, right, top
888
     */
889
    toArray: function(reverseAxisOrder) {
890
        if (reverseAxisOrder === true) {
891
            return [this.bottom, this.left, this.top, this.right];
892
        } else {
893
            return [this.left, this.bottom, this.right, this.top];
894
        }
895
    },    
896

  
897
    /** 
898
     * APIMethod: toBBOX
899
     * Returns a boundingbox-string representation of the bounds object.
900
     * 
901
     * Parameters:
902
     * decimal - {Integer} How many significant digits in the bbox coords?
903
     *                     Default is 6
904
     * reverseAxisOrder - {Boolean} Should we reverse the axis order?
905
     * 
906
     * Returns:
907
     * {String} Simple String representation of bounds object.
908
     *          (e.g. "5,42,10,45")
909
     */
910
    toBBOX:function(decimal, reverseAxisOrder) {
911
        if (decimal== null) {
912
            decimal = 6; 
913
        }
914
        var mult = Math.pow(10, decimal);
915
        var xmin = Math.round(this.left * mult) / mult;
916
        var ymin = Math.round(this.bottom * mult) / mult;
917
        var xmax = Math.round(this.right * mult) / mult;
918
        var ymax = Math.round(this.top * mult) / mult;
919
        if (reverseAxisOrder === true) {
920
            return ymin + "," + xmin + "," + ymax + "," + xmax;
921
        } else {
922
            return xmin + "," + ymin + "," + xmax + "," + ymax;
923
        }
924
    },
925
 
926
    /**
927
     * APIMethod: toGeometry
928
     * Create a new polygon geometry based on this bounds.
929
     *
930
     * Returns:
931
     * {<OpenLayers.Geometry.Polygon>} A new polygon with the coordinates
932
     *     of this bounds.
933
     */
934
    toGeometry: function() {
935
        return new OpenLayers.Geometry.Polygon([
936
            new OpenLayers.Geometry.LinearRing([
937
                new OpenLayers.Geometry.Point(this.left, this.bottom),
938
                new OpenLayers.Geometry.Point(this.right, this.bottom),
939
                new OpenLayers.Geometry.Point(this.right, this.top),
940
                new OpenLayers.Geometry.Point(this.left, this.top)
941
            ])
942
        ]);
943
    },
944
    
945
    /**
946
     * APIMethod: getWidth
947
     * Returns the width of the bounds.
948
     * 
949
     * Returns:
950
     * {Float} The width of the bounds (right minus left).
951
     */
952
    getWidth:function() {
953
        return (this.right - this.left);
954
    },
955

  
956
    /**
957
     * APIMethod: getHeight
958
     * Returns the height of the bounds.
959
     * 
960
     * Returns:
961
     * {Float} The height of the bounds (top minus bottom).
962
     */
963
    getHeight:function() {
964
        return (this.top - this.bottom);
965
    },
966

  
967
    /**
968
     * APIMethod: getSize
969
     * Returns an <OpenLayers.Size> object of the bounds.
970
     * 
971
     * Returns:
972
     * {<OpenLayers.Size>} The size of the bounds.
973
     */
974
    getSize:function() {
975
        return new OpenLayers.Size(this.getWidth(), this.getHeight());
976
    },
977

  
978
    /**
979
     * APIMethod: getCenterPixel
980
     * Returns the <OpenLayers.Pixel> object which represents the center of the
981
     *     bounds.
982
     * 
983
     * Returns:
984
     * {<OpenLayers.Pixel>} The center of the bounds in pixel space.
985
     */
986
    getCenterPixel:function() {
987
        return new OpenLayers.Pixel( (this.left + this.right) / 2,
988
                                     (this.bottom + this.top) / 2);
989
    },
990

  
991
    /**
992
     * APIMethod: getCenterLonLat
993
     * Returns the <OpenLayers.LonLat> object which represents the center of the
994
     *     bounds.
995
     *
996
     * Returns:
997
     * {<OpenLayers.LonLat>} The center of the bounds in map space.
998
     */
999
    getCenterLonLat:function() {
1000
        if(!this.centerLonLat) {
1001
            this.centerLonLat = new OpenLayers.LonLat(
1002
                (this.left + this.right) / 2, (this.bottom + this.top) / 2
1003
            );
1004
        }
1005
        return this.centerLonLat;
1006
    },
1007

  
1008
    /**
1009
     * APIMethod: scale
1010
     * Scales the bounds around a pixel or lonlat. Note that the new 
1011
     *     bounds may return non-integer properties, even if a pixel
1012
     *     is passed. 
1013
     * 
1014
     * Parameters:
1015
     * ratio - {Float} 
1016
     * origin - {<OpenLayers.Pixel> or <OpenLayers.LonLat>}
1017
     *          Default is center.
1018
     *
1019
     * Returns:
1020
     * {<OpenLayers.Bounds>} A new bounds that is scaled by ratio
1021
     *                      from origin.
1022
     */
1023
    scale: function(ratio, origin){
1024
        if(origin == null){
1025
            origin = this.getCenterLonLat();
1026
        }
1027
        
1028
        var origx,origy;
1029

  
1030
        // get origin coordinates
1031
        if(origin.CLASS_NAME == "OpenLayers.LonLat"){
1032
            origx = origin.lon;
1033
            origy = origin.lat;
1034
        } else {
1035
            origx = origin.x;
1036
            origy = origin.y;
1037
        }
1038

  
1039
        var left = (this.left - origx) * ratio + origx;
1040
        var bottom = (this.bottom - origy) * ratio + origy;
1041
        var right = (this.right - origx) * ratio + origx;
1042
        var top = (this.top - origy) * ratio + origy;
1043
        
1044
        return new OpenLayers.Bounds(left, bottom, right, top);
1045
    },
1046

  
1047
    /**
1048
     * APIMethod: add
1049
     * Shifts the coordinates of the bound by the given horizontal and vertical
1050
     *     deltas.
1051
     *
1052
     * (start code)
1053
     * var bounds = new OpenLayers.Bounds(0, 0, 10, 10);
1054
     * bounds.toString();
1055
     * // => "0,0,10,10"
1056
     *
1057
     * bounds.add(-1.5, 4).toString();
1058
     * // => "-1.5,4,8.5,14"
1059
     * (end)
1060
     *
1061
     * This method will throw a TypeError if it is passed null as an argument.
1062
     *
1063
     * Parameters:
1064
     * x - {Float} horizontal delta
1065
     * y - {Float} vertical delta
1066
     *
1067
     * Returns:
1068
     * {<OpenLayers.Bounds>} A new bounds whose coordinates are the same as
1069
     *     this, but shifted by the passed-in x and y values.
1070
     */
1071
    add:function(x, y) {
1072
        if ( (x == null) || (y == null) ) {
1073
            throw new TypeError('Bounds.add cannot receive null values');
1074
        }
1075
        return new OpenLayers.Bounds(this.left + x, this.bottom + y,
1076
                                     this.right + x, this.top + y);
1077
    },
1078
    
1079
    /**
1080
     * APIMethod: extend
1081
     * Extend the bounds to include the <OpenLayers.LonLat>,
1082
     *     <OpenLayers.Geometry.Point> or <OpenLayers.Bounds> specified.
1083
     *
1084
     * Please note that this function assumes that left < right and
1085
     *     bottom < top.
1086
     *
1087
     * Parameters:
1088
     * object - {<OpenLayers.LonLat>, <OpenLayers.Geometry.Point> or
1089
     *     <OpenLayers.Bounds>} The object to be included in the new bounds
1090
     *     object.
1091
     */
1092
    extend:function(object) {
1093
        if (object) {
1094
            switch(object.CLASS_NAME) {
1095
                case "OpenLayers.LonLat":
1096
                    this.extendXY(object.lon, object.lat);
1097
                    break;
1098
                case "OpenLayers.Geometry.Point":
1099
                    this.extendXY(object.x, object.y);
1100
                    break;
1101

  
1102
                case "OpenLayers.Bounds":
1103
                    // clear cached center location
1104
                    this.centerLonLat = null;
1105

  
1106
                    if ( (this.left == null) || (object.left < this.left)) {
1107
                        this.left = object.left;
1108
                    }
1109
                    if ( (this.bottom == null) || (object.bottom < this.bottom) ) {
1110
                        this.bottom = object.bottom;
1111
                    }
1112
                    if ( (this.right == null) || (object.right > this.right) ) {
1113
                        this.right = object.right;
1114
                    }
1115
                    if ( (this.top == null) || (object.top > this.top) ) {
1116
                        this.top = object.top;
1117
                    }
1118
                    break;
1119
            }
1120
        }
1121
    },
1122

  
1123
    /**
1124
     * APIMethod: extendXY
1125
     * Extend the bounds to include the XY coordinate specified.
1126
     *
1127
     * Parameters:
1128
     * x - {number} The X part of the the coordinate.
1129
     * y - {number} The Y part of the the coordinate.
1130
     */
1131
    extendXY:function(x, y) {
1132
        // clear cached center location
1133
        this.centerLonLat = null;
1134

  
1135
        if ((this.left == null) || (x < this.left)) {
1136
            this.left = x;
1137
        }
1138
        if ((this.bottom == null) || (y < this.bottom)) {
1139
            this.bottom = y;
1140
        }
1141
        if ((this.right == null) || (x > this.right)) {
1142
            this.right = x;
1143
        }
1144
        if ((this.top == null) || (y > this.top)) {
1145
            this.top = y;
1146
        }
1147
    },
1148

  
1149
    /**
1150
     * APIMethod: containsLonLat
1151
     * Returns whether the bounds object contains the given <OpenLayers.LonLat>.
1152
     * 
1153
     * Parameters:
1154
     * ll - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
1155
     *     object with a 'lon' and 'lat' properties.
1156
     * options - {Object} Optional parameters
1157
     *
1158
     * Acceptable options:
1159
     * inclusive - {Boolean} Whether or not to include the border.
1160
     *     Default is true.
1161
     * worldBounds - {<OpenLayers.Bounds>} If a worldBounds is provided, the
1162
     *     ll will be considered as contained if it exceeds the world bounds,
1163
     *     but can be wrapped around the dateline so it is contained by this
1164
     *     bounds.
1165
     *
1166
     * Returns:
1167
     * {Boolean} The passed-in lonlat is within this bounds.
1168
     */
1169
    containsLonLat: function(ll, options) {
1170
        if (typeof options === "boolean") {
1171
            options =  {inclusive: options};
1172
        }
1173
        options = options || {};
1174
        var contains = this.contains(ll.lon, ll.lat, options.inclusive),
1175
            worldBounds = options.worldBounds;
1176
        if (worldBounds && !contains) {
1177
            var worldWidth = worldBounds.getWidth();
1178
            var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
1179
            var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
1180
            contains = this.containsLonLat({
1181
                lon: ll.lon - worldsAway * worldWidth,
1182
                lat: ll.lat
1183
            }, {inclusive: options.inclusive});
1184
        }
1185
        return contains;
1186
    },
1187

  
1188
    /**
1189
     * APIMethod: containsPixel
1190
     * Returns whether the bounds object contains the given <OpenLayers.Pixel>.
1191
     * 
1192
     * Parameters:
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff