var requirejs, require, define;
|
(function (undef) {
|
var main, req, makeMap, handlers,
|
defined = {},
|
waiting = {},
|
config = {},
|
defining = {},
|
hasOwn = Object.prototype.hasOwnProperty,
|
aps = [].slice;
|
|
function hasProp(obj, prop) {
|
return hasOwn.call(obj, prop);
|
}
|
|
/**
|
* Given a relative module name, like ./something, normalize it to
|
* a real name that can be mapped to a path.
|
* @param {String} name the relative name
|
* @param {String} baseName a real name that the name arg is relative
|
* to.
|
* @returns {String} normalized name
|
*/
|
function normalize(name, baseName) {
|
var nameParts, nameSegment, mapValue, foundMap,
|
foundI, foundStarMap, starI, i, j, part,
|
baseParts = baseName && baseName.split("/"),
|
map = config.map,
|
starMap = (map && map['*']) || {};
|
|
//Adjust any relative paths.
|
if (name && name.charAt(0) === ".") {
|
//If have a base name, try to normalize against it,
|
//otherwise, assume it is a top-level require that will
|
//be relative to baseUrl in the end.
|
if (baseName) {
|
//Convert baseName to array, and lop off the last part,
|
//so that . matches that "directory" and not name of the baseName's
|
//module. For instance, baseName of "one/two/three", maps to
|
//"one/two/three.js", but we want the directory, "one/two" for
|
//this normalization.
|
baseParts = baseParts.slice(0, baseParts.length - 1);
|
|
name = baseParts.concat(name.split("/"));
|
|
//start trimDots
|
for (i = 0; i < name.length; i += 1) {
|
part = name[i];
|
if (part === ".") {
|
name.splice(i, 1);
|
i -= 1;
|
} else if (part === "..") {
|
if (i === 1 && (name[2] === '..' || name[0] === '..')) {
|
//End of the line. Keep at least one non-dot
|
//path segment at the front so it can be mapped
|
//correctly to disk. Otherwise, there is likely
|
//no path mapping for a path starting with '..'.
|
//This can still fail, but catches the most reasonable
|
//uses of ..
|
break;
|
} else if (i > 0) {
|
name.splice(i - 1, 2);
|
i -= 2;
|
}
|
}
|
}
|
//end trimDots
|
|
name = name.join("/");
|
} else if (name.indexOf('./') === 0) {
|
// No baseName, so this is ID is resolved relative
|
// to baseUrl, pull off the leading dot.
|
name = name.substring(2);
|
}
|
}
|
|
//Apply map config if available.
|
if ((baseParts || starMap) && map) {
|
nameParts = name.split('/');
|
|
for (i = nameParts.length; i > 0; i -= 1) {
|
nameSegment = nameParts.slice(0, i).join("/");
|
|
if (baseParts) {
|
//Find the longest baseName segment match in the config.
|
//So, do joins on the biggest to smallest lengths of baseParts.
|
for (j = baseParts.length; j > 0; j -= 1) {
|
mapValue = map[baseParts.slice(0, j).join('/')];
|
|
//baseName segment has config, find if it has one for
|
//this name.
|
if (mapValue) {
|
mapValue = mapValue[nameSegment];
|
if (mapValue) {
|
//Match, update name to the new value.
|
foundMap = mapValue;
|
foundI = i;
|
break;
|
}
|
}
|
}
|
}
|
|
if (foundMap) {
|
break;
|
}
|
|
//Check for a star map match, but just hold on to it,
|
//if there is a shorter segment match later in a matching
|
//config, then favor over this star map.
|
if (!foundStarMap && starMap && starMap[nameSegment]) {
|
foundStarMap = starMap[nameSegment];
|
starI = i;
|
}
|
}
|
|
if (!foundMap && foundStarMap) {
|
foundMap = foundStarMap;
|
foundI = starI;
|
}
|
|
if (foundMap) {
|
nameParts.splice(0, foundI, foundMap);
|
name = nameParts.join('/');
|
}
|
}
|
|
return name;
|
}
|
|
function makeRequire(relName, forceSync) {
|
return function () {
|
//A version of a require function that passes a moduleName
|
//value for items that may need to
|
//look up paths relative to the moduleName
|
return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
|
};
|
}
|
|
function makeNormalize(relName) {
|
return function (name) {
|
return normalize(name, relName);
|
};
|
}
|
|
function makeLoad(depName) {
|
return function (value) {
|
defined[depName] = value;
|
};
|
}
|
|
function callDep(name) {
|
if (hasProp(waiting, name)) {
|
var args = waiting[name];
|
delete waiting[name];
|
defining[name] = true;
|
main.apply(undef, args);
|
}
|
|
if (!hasProp(defined, name) && !hasProp(defining, name)) {
|
throw new Error('No ' + name);
|
}
|
return defined[name];
|
}
|
|
//Turns a plugin!resource to [plugin, resource]
|
//with the plugin being undefined if the name
|
//did not have a plugin prefix.
|
function splitPrefix(name) {
|
var prefix,
|
index = name ? name.indexOf('!') : -1;
|
if (index > -1) {
|
prefix = name.substring(0, index);
|
name = name.substring(index + 1, name.length);
|
}
|
return [prefix, name];
|
}
|
|
/**
|
* Makes a name map, normalizing the name, and using a plugin
|
* for normalization if necessary. Grabs a ref to plugin
|
* too, as an optimization.
|
*/
|
makeMap = function (name, relName) {
|
var plugin,
|
parts = splitPrefix(name),
|
prefix = parts[0];
|
|
name = parts[1];
|
|
if (prefix) {
|
prefix = normalize(prefix, relName);
|
plugin = callDep(prefix);
|
}
|
|
//Normalize according
|
if (prefix) {
|
if (plugin && plugin.normalize) {
|
name = plugin.normalize(name, makeNormalize(relName));
|
} else {
|
name = normalize(name, relName);
|
}
|
} else {
|
name = normalize(name, relName);
|
parts = splitPrefix(name);
|
prefix = parts[0];
|
name = parts[1];
|
if (prefix) {
|
plugin = callDep(prefix);
|
}
|
}
|
|
//Using ridiculous property names for space reasons
|
return {
|
f: prefix ? prefix + '!' + name : name, //fullName
|
n: name,
|
pr: prefix,
|
p: plugin
|
};
|
};
|
|
function makeConfig(name) {
|
return function () {
|
return (config && config.config && config.config[name]) || {};
|
};
|
}
|
|
handlers = {
|
require: function (name) {
|
return makeRequire(name);
|
},
|
exports: function (name) {
|
var e = defined[name];
|
if (typeof e !== 'undefined') {
|
return e;
|
} else {
|
return (defined[name] = {});
|
}
|
},
|
module: function (name) {
|
return {
|
id: name,
|
uri: '',
|
exports: defined[name],
|
config: makeConfig(name)
|
};
|
}
|
};
|
|
main = function (name, deps, callback, relName) {
|
var cjsModule, depName, ret, map, i,
|
args = [],
|
usingExports;
|
|
//Use name if no relName
|
relName = relName || name;
|
|
//Call the callback to define the module, if necessary.
|
if (typeof callback === 'function') {
|
|
//Pull out the defined dependencies and pass the ordered
|
//values to the callback.
|
//Default to [require, exports, module] if no deps
|
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
|
for (i = 0; i < deps.length; i += 1) {
|
map = makeMap(deps[i], relName);
|
depName = map.f;
|
|
//Fast path CommonJS standard dependencies.
|
if (depName === "require") {
|
args[i] = handlers.require(name);
|
} else if (depName === "exports") {
|
//CommonJS module spec 1.1
|
args[i] = handlers.exports(name);
|
usingExports = true;
|
} else if (depName === "module") {
|
//CommonJS module spec 1.1
|
cjsModule = args[i] = handlers.module(name);
|
} else if (hasProp(defined, depName) ||
|
hasProp(waiting, depName) ||
|
hasProp(defining, depName)) {
|
args[i] = callDep(depName);
|
} else if (map.p) {
|
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
|
args[i] = defined[depName];
|
} else {
|
throw new Error(name + ' missing ' + depName);
|
}
|
}
|
|
ret = callback.apply(defined[name], args);
|
|
if (name) {
|
//If setting exports via "module" is in play,
|
//favor that over return value and exports. After that,
|
//favor a non-undefined return value over exports use.
|
if (cjsModule && cjsModule.exports !== undef &&
|
cjsModule.exports !== defined[name]) {
|
defined[name] = cjsModule.exports;
|
} else if (ret !== undef || !usingExports) {
|
//Use the return value from the function.
|
defined[name] = ret;
|
}
|
}
|
} else if (name) {
|
//May just be an object definition for the module. Only
|
//worry about defining if have a module name.
|
defined[name] = callback;
|
}
|
};
|
|
requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
|
if (typeof deps === "string") {
|
if (handlers[deps]) {
|
//callback in this case is really relName
|
return handlers[deps](callback);
|
}
|
//Just return the module wanted. In this scenario, the
|
//deps arg is the module name, and second arg (if passed)
|
//is just the relName.
|
//Normalize module name, if it contains . or ..
|
return callDep(makeMap(deps, callback).f);
|
} else if (!deps.splice) {
|
//deps is a config object, not an array.
|
config = deps;
|
if (callback.splice) {
|
//callback is an array, which means it is a dependency list.
|
//Adjust args if there are dependencies
|
deps = callback;
|
callback = relName;
|
relName = null;
|
} else {
|
deps = undef;
|
}
|
}
|
|
//Support require(['a'])
|
callback = callback || function () { };
|
|
//If relName is a function, it is an errback handler,
|
//so remove it.
|
if (typeof relName === 'function') {
|
relName = forceSync;
|
forceSync = alt;
|
}
|
|
//Simulate async callback;
|
if (forceSync) {
|
main(undef, deps, callback, relName);
|
} else {
|
//Using a non-zero value because of concern for what old browsers
|
//do, and latest browsers "upgrade" to 4 if lower value is used:
|
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
|
//If want a value immediately, use require('id') instead -- something
|
//that works in almond on the global level, but not guaranteed and
|
//unlikely to work in other AMD implementations.
|
setTimeout(function () {
|
main(undef, deps, callback, relName);
|
}, 4);
|
}
|
|
return req;
|
};
|
|
/**
|
* Just drops the config on the floor, but returns req in case
|
* the config return value is used.
|
*/
|
req.config = function (cfg) {
|
config = cfg;
|
if (config.deps) {
|
req(config.deps, config.callback);
|
}
|
return req;
|
};
|
|
/**
|
* Expose module registry for debugging and tooling
|
*/
|
requirejs._defined = defined;
|
|
define = function (name, deps, callback) {
|
|
//This module may not have dependencies
|
if (!deps.splice) {
|
//deps is not an array, so probably means
|
//an object literal or factory function for
|
//the value. Adjust args.
|
callback = deps;
|
deps = [];
|
}
|
|
if (!hasProp(defined, name) && !hasProp(waiting, name)) {
|
waiting[name] = [name, deps, callback];
|
}
|
};
|
|
define.amd = {
|
jQuery: true
|
};
|
}());
|
|
define("WorkerPool", [], function () {
|
"use strict";
|
|
function t(e, t) {
|
for (var n = 0; n < e.length; n++) if (t(e[n])) return n
|
}
|
var e = function (e) {
|
e = e || [];
|
if (!Cesium.defined(e.workerPath)) throw new Cesium.DeveloperError("workerPath is required.");
|
this._workerPath = e.workerPath, this._poolSize = Cesium.defaultValue(e.poolSize, 16), this._workers = [], this._defered = []
|
};
|
return Object.defineProperties(e.prototype, {
|
errorEvent: {
|
get: function () {
|
return this.errorEvent
|
}
|
},
|
poolSize: {
|
get: function () {
|
return this._poolSize
|
}
|
}
|
}), e.prototype.queueWorkItem = function (e, t) {
|
var n = Cesium.when.defer(),
|
r = null,
|
i = 999999;
|
for (var s = 0; s < this._workers.length; s++) {
|
var r = this._workers[s];
|
this._workers[s].jobQueueSize < i && (r = this._workers[s], i = this._workers[s].jobQueueSize)
|
}
|
if (i > 0 && this._workers.length < this.poolSize) {
|
r = new Worker(this._workerPath);
|
var o = this;
|
r.addEventListener("message", function (e) {
|
o.onWorkerMessage(e)
|
}, !1), r.addEventListener("error", function (e) {
|
o.onWorkerError(e)
|
}, !1), r.jobQueueSize = 0, this._workers.push(r), r.id = Cesium.createGuid()
|
}
|
e.workerId = r.id;
|
var u = Cesium.createGuid();
|
return e.deferedId = u, this._defered[u] = n, r.jobQueueSize++, r.postMessage(e, t), n
|
}, e.prototype.trimPool = function (e) {
|
var t = this;
|
if (e == undefined) {
|
this.timerId != null && clearTimeout(this.timerId), this.timerId = setTimeout(function () {
|
t.trimPool(!0)
|
}, 5e3);
|
return
|
}
|
for (var n = 0; n < this._workers.length; n++) this._workers[n].jobQueueSize == 0 && (this._workers[n].terminate(), this._workers.splice(n, 1), n--);
|
this._workers.length ? this.timerId = setTimeout(function () {
|
t.trimPool(!0)
|
}, 5e3) : this.timerId = null
|
}, e.prototype.onWorkerMessage = function (e) {
|
var n = e.data,
|
r = t(this._workers, function (e) {
|
return e.id === n.workerId
|
});
|
if (r != undefined) {
|
var i = this._workers[r];
|
i.jobQueueSize--, this.trimPool()
|
}
|
var s = this._defered[n.deferedId];
|
delete this._defered[n.deferedId], s.resolve(n)
|
}, e.prototype.onWorkerError = function (e) {
|
console.log(e)
|
}, e
|
});
|
|
define("sfsterrainprovider/SFSTerrainProvider", ["WorkerPool"], function (e) {
|
"use strict";
|
|
function r(e, t) {
|
return Math.floor(Math.random() * (t - e + 1)) + e
|
}
|
var t = !1,
|
n = function (t) {
|
if (!Cesium.defined(t)) throw new Cesium.DeveloperError("options is required.");
|
this._errorEvent = new Cesium.Event, this._credit = t.credit, typeof this._credit == "string" && (this._credit = new Cesium.Credit(this._credit)), t.heightMapWidth = Cesium.defaultValue(t.heightMapWidth, 32), t.heightMapHeight = Cesium.defaultValue(t.heightMapHeight, 32), this._options = t, this._subdomains = t.subdomains, t.url = t.url.replace("{s}", this.sTag(0, 0, 0)), this._firstRequest = t.url + "?" + "request=GetMap&Version=1.3.0&Service=WMS&CRS=EPSG:4326&bbox=-90,-180,90,180&height=32&width=32&optimizedOnly=0&layers=" + t.layerName + "&Styles=&Format=image/mpt";
|
var n = this;
|
$.ajax({
|
url: this._firstRequest,
|
success: function (e) {
|
var t = Cesium.defined(e.childNodes) && e.childNodes.length > 0 ? !0 : !1;
|
if (!!t) return n._isMPT = !1, n._format = "png", null;
|
n._isMPT = !0, n._format = "mpt"
|
},
|
error: function () {
|
return n._isMPT = !1, n._format = "png", null
|
},
|
async: !1
|
}), this._urlTemplate = t.url + "?" + "request=GetMap&Version=1.3.0&Service=WMS&CRS=EPSG:4326&bbox={south},{west},{north},{east}&height={height}&width={width}&optimizedOnly={optimizedOnly}&layers=" + t.layerName + "&Styles=&Format=image/" + this._format, this._tilingScheme = new Cesium.GeographicTilingScheme, this._levelZeroMaximumGeometricError = Cesium.TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid, t.heightMapWidth * 4, this._tilingScheme.getNumberOfXTilesAtLevel(0)), this._workerPool = new e({
|
workerPath: "./2d/js/sfsterrainprovider/ParseElevationWorker.js"
|
}), this._pendingRequests = 0, this._requestGridSize = 8, this._requestsCache = {}, this._requestsCacheKeys = [], this.errorEvent.addEventListener(function (e) { }, this)
|
};
|
return n._geometricErrorFactor = 2, Object.defineProperties(n.prototype, {
|
errorEvent: {
|
get: function () {
|
return this._errorEvent
|
}
|
},
|
credit: {
|
get: function () {
|
return this._credit
|
}
|
},
|
hasVertexNormals: {
|
get: function () {
|
return !1
|
}
|
},
|
tilingScheme: {
|
get: function () {
|
return this._tilingScheme
|
}
|
},
|
ready: {
|
get: function () {
|
return !0
|
}
|
},
|
hasWaterMask: {
|
get: function () {
|
return !1
|
}
|
},
|
heightMapHeight: {
|
get: function () {
|
return this._options.heightMapHeight
|
}
|
},
|
heightMapWidth: {
|
get: function () {
|
return this._options.heightMapWidth
|
}
|
},
|
pendingRequests: {
|
get: function () {
|
return this._pendingRequests
|
}
|
}
|
}), n.prototype.getLevelMaximumGeometricError = function (e) {
|
return this._levelZeroMaximumGeometricError / (1 << e) * n._geometricErrorFactor
|
}, n.prototype.createKeyFromTile = function (e, t, n) {
|
return e + "_" + t + "_" + n
|
}, n.prototype.getTileDataAvailable = function (e, t, n) {
|
return this._isMPT ? undefined : n < 18 ? !0 : !1
|
}, n.prototype.requestFactorForLevel = function (e) {
|
var t = Math.log(this._requestGridSize) / Math.log(2);
|
return t = Math.min(t, e), Math.pow(2, t)
|
}, n.prototype.getRequestUrl = function (e, t, n, r) {
|
var i = this.requestFactorForLevel(n);
|
e = (e - e % i) / i, t = (t - t % i) / i, n -= Math.log(i) / Math.log(2);
|
var s = this.tilingScheme.tileXYToNativeRectangle(e, t, n),
|
o = this.heightMapWidth * i === 256 && r ? 1 : 0,
|
u = this._urlTemplate.replace("{south}", s.south).replace("{north}", s.north).replace("{west}", s.west).replace("{east}", s.east).replace("{optimizedOnly}", o).replace("{width}", this.heightMapWidth * i).replace("{height}", this.heightMapHeight * i).replace("{s}", this.sTag(e, t, n));
|
return u
|
}, n.prototype.sTag = function (e, t, n) {
|
if (this._subdomains == undefined) return "";
|
var r = (e + t + n) % this._subdomains.length;
|
return this._subdomains[r]
|
}, n.prototype.findDirectParent = function (e) {
|
var t = function (e, n) {
|
if (e._rectangle.width <= n.width * 2.1 && Cesium.Rectangle.contains(e._rectangle, Cesium.Rectangle.center(n))) return e;
|
var r = e.children.length;
|
for (var i = 0; i < r; i++) {
|
var s = e.children[i];
|
if (Cesium.Rectangle.contains(s._rectangle, Cesium.Rectangle.center(n))) return t(s, n)
|
}
|
return null
|
};
|
if (e.width == Math.PI) return null;
|
for (var n = 0; n < viewer.scene.globe._surface._levelZeroTiles.length; n++) {
|
var r = t(viewer.scene.globe._surface._levelZeroTiles[n], e);
|
if (r) return r
|
}
|
return null
|
}, n.prototype.isTileAvailable = function (e, t, n) {
|
var r = this._tilingScheme.tileXYToRectangle(e, t, n, new Cesium.Rectangle),
|
i = this.findDirectParent(r);
|
if (i && i.data && i.data.terrainData) {
|
if (!(i.data.terrainData._childTileMask > 0)) return !1;
|
var s = i.children.length;
|
for (var o = 0; o < s; o++) {
|
var u = i.children[o];
|
if (Cesium.Rectangle.equals(u._rectangle, r)) return i.data.terrainData._childTileMask & 1 << o
|
}
|
}
|
return !0
|
}, n.prototype.markTileAsUnavailable = function (e, t, n) {
|
var r = this._tilingScheme.tileXYToRectangle(e, t, n, new Cesium.Rectangle),
|
i = this.findDirectParent(r);
|
i && i.data && i.data.terrainData && i.data.terrainData._childTileMask > 0 && $.each(i.children, function (e, t) {
|
if (Cesium.Rectangle.equals(t._rectangle, r)) {
|
switch (e) {
|
case 0:
|
i.data.terrainData._childTileMask &= -5;
|
break;
|
case 1:
|
i.data.terrainData._childTileMask &= -9;
|
break;
|
case 2:
|
i.data.terrainData._childTileMask &= -2;
|
break;
|
case 3:
|
i.data.terrainData._childTileMask &= -3;
|
break;
|
default:
|
}
|
return !1
|
}
|
return !0
|
})
|
}, n.prototype.requestTileGeometry = function (e, n, r, i) {
|
var s = this.requestTileHeightBuffer(e, n, r, i);
|
if (s === undefined) return undefined;
|
var o = this,
|
u = 15,
|
a = this.requestTileHeightBuffer(e + 1, n, r, i, !0),
|
f = this.requestTileHeightBuffer(e, n + 1, r, i, !0),
|
l = this.requestTileHeightBuffer(e + 1, n + 1, r, i, !0),
|
c = Cesium.when.defer();
|
return Cesium.when.all([s, a, f, l], function (i) {
|
if (t == 0) {
|
if (i[0].myReject != undefined && i[0].myReject) {
|
o.markTileAsUnavailable(e, n, r), c.reject();
|
return
|
}
|
var s = o.heightMapWidth + 1,
|
a = o.heightMapHeight + 1,
|
f = new Float32Array(s * a);
|
for (var l = 0; l < s; l++) for (var h = 0; h < a; h++) {
|
var p = l,
|
d = h,
|
v = 0;
|
h === s - 1 && (d = 0, v = 1), l === a - 1 && (p = 0, v = 2);
|
var m = l * s + h,
|
g = p * o.heightMapWidth + d;
|
i[v] !== null && (i[v].myReject == undefined || !i[v].myReject) && (f[m] = i[v][g])
|
}
|
if (i[3].myReject == undefined || !i[3].myReject) f[s * a - 1] = i[3][0];
|
var b = o.arrayToHeightmapTerrainData(f, s, a, u);
|
c.resolve(b)
|
} else {
|
var b = o.arrayToHeightmapTerrainData(i[0], o.heightMapWidth, o.heightMapHeight);
|
c.resolve(b)
|
}
|
}).otherwise(function () {
|
c.reject()
|
}), c
|
}, n.prototype.requestTileHeightBuffer = function (e, n, i, s, o) {
|
if (isNaN(e + n + i)) return;
|
if (!Cesium.defined(s) || s === !1) s = new Cesium.Request({
|
defer: !0
|
});
|
var u = s.defer == 0;
|
o = Cesium.defaultValue(u, !1);
|
var a = Cesium.when.defer();
|
if (t == 0) {
|
var f = this.getRequestUrl(e, n, i, u || o);
|
if (this._requestsCache.hasOwnProperty(f) === !1) {
|
this._requestsCache[f] = {}, this._requestsCacheKeys.push(f);
|
if (this._requestsCacheKeys.length > 100) {
|
for (var l = 0; l < 50; l++) delete this._requestsCache[this._requestsCacheKeys[l]];
|
this._requestsCacheKeys.splice(0, 50)
|
}
|
} else {
|
var c = this._requestsCacheKeys.indexOf(f);
|
this._requestsCacheKeys.splice(c, 1), this._requestsCacheKeys.push(f)
|
}
|
var h = {
|
headers: {
|
withCredentials: !0
|
}
|
},
|
p = this._requestsCache[f];
|
if (p.dataLoaded === undefined) {
|
u ? p.dataLoaded = Cesium.RequestScheduler.request(f, Cesium.loadArrayBuffer) : p.dataLoaded = Cesium.loadArrayBuffer(f);
|
if (!Cesium.defined(p.dataLoaded)) return undefined
|
}
|
var d = this;
|
this._pendingRequests++, Cesium.when(p.dataLoaded, function (t) {
|
p.workerFinished === undefined && (p.workerFinished = d._workerPool.queueWorkItem({
|
buffer: t
|
})), Cesium.when(p.workerFinished, function (t) {
|
if (!!t.rejected) {
|
var s = d.heightMapWidth * d.heightMapHeight,
|
o = new Int16Array(s),
|
u = 0;
|
for (var f = 0; f < s; f++) o[f] = 300;
|
return i > 2 && (d.markTileAsUnavailable(e, n, i), o.myReject = !0), a.resolve(o), a
|
}
|
var r = d.extractTileHeightBuffer(t.buffer, e, n, i);
|
d._pendingRequests--, a.resolve(r)
|
})
|
}).otherwise(function () {
|
d._pendingRequests--, a.reject()
|
})
|
} else {
|
var v = this.heightMapWidth * this.heightMapHeight,
|
m = new Int16Array(v),
|
g = r(0, 1500);
|
for (var l = 0; l < v; l++) m[l] = g;
|
a.resolve(m)
|
}
|
return a
|
}, n.prototype.extractTileHeightBuffer = function (e, t, n, r) {
|
try {
|
var i = this.requestFactorForLevel(r),
|
s = t % i,
|
o = n % i,
|
u = new Int16Array(this.heightMapWidth * this.heightMapHeight),
|
a = 1e6,
|
f = -1e5;
|
for (var l = 0; l < this.heightMapHeight; l++) for (var c = 0; c < this.heightMapWidth; c++) {
|
var h = l + o * this.heightMapHeight,
|
p = c + s * this.heightMapWidth,
|
d = l * this.heightMapWidth + c,
|
v = h * this.heightMapWidth * i + p;
|
e[v] > f && (f = e[v]), e[v] < a && (a = e[v]), u[d] = e[v]
|
}
|
} catch (m) {
|
console.log(m.message)
|
}
|
return u
|
}, n.prototype.arrayToHeightmapTerrainData = function (e, t, n, r) {
|
Cesium.defined(e) === !1 && (e = new Int16Array(t * n));
|
var i = {
|
buffer: e,
|
width: t,
|
height: n,
|
childTileMask: r
|
};
|
return new Cesium.HeightmapTerrainData(i)
|
}, n
|
});
|
|
require([
|
'sfsterrainprovider/SFSTerrainProvider'
|
], function (
|
SFSTerrainProvider) {
|
"use strict";
|
/*global self*/
|
var scope = typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {};
|
scope.SFSTerrainProvider = SFSTerrainProvider;
|
}, undefined, true);
|
define("RequireTE", function () { });
|