-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathWebTiles.js
53 lines (45 loc) · 1.21 KB
/
WebTiles.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
define([
"dojo/_base/declare", // declare
"dojo/_base/lang", // mixin
"./_base"
], function(declare, lang, djeo) {
var dependency = "WebTiles";
djeo.registerDependency(dependency);
return declare(null, {
yFirst: false,
// this attribute is used by ArcGIS API for JavaScript
dependency: dependency,
constructor: function(kwArgs) {
lang.mixin(this, kwArgs);
// paramStr is actually url
var url = kwArgs.paramStr ? kwArgs.paramStr : this.url;
if (lang.isString(url)) {
// check if url contains the left square bracket
var lBracket = url.indexOf("[");
if (lBracket > -1) {
// we have a template in the url
// the right square bracket is supposed to close the left square bracket
var rBracket = url.indexOf("]")
parts = url.substring(lBracket+1, rBracket).split(",")
;
this.url = [];
for (var i=0; i<parts.length; i++) {
this.url[i] = url.substring(0, lBracket) + parts[i] + url.substring(rBracket+1);
}
}
else {
this.url = [url];
}
}
this.numUrls = this.url.length;
},
startup: function(map) {
this.map = map;
var factory = this.map.engine.getFactory(dependency);
if (factory) {
lang.mixin(this, factory);
this.init();
}
}
});
});