You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.6 KiB

9 months ago
define([
'exports',
'./Matrix2-f2da41d4',
'./when-229515d6',
'./RuntimeError-ffe03243',
'./ComponentDatatype-17b06483',
], function (t, e, i, o, a) {
'use strict';
function r(t) {
(this._ellipsoid = i.defaultValue(t, e.Ellipsoid.WGS84)),
(this._semimajorAxis = this._ellipsoid.maximumRadius),
(this._oneOverSemimajorAxis = 1 / this._semimajorAxis);
}
Object.defineProperties(r.prototype, {
ellipsoid: {
get: function () {
return this._ellipsoid;
},
},
}),
(r.mercatorAngleToGeodeticLatitude = function (t) {
return a.CesiumMath.PI_OVER_TWO - 2 * Math.atan(Math.exp(-t));
}),
(r.geodeticLatitudeToMercatorAngle = function (t) {
t > r.MaximumLatitude
? (t = r.MaximumLatitude)
: t < -r.MaximumLatitude && (t = -r.MaximumLatitude);
var e = Math.sin(t);
return 0.5 * Math.log((1 + e) / (1 - e));
}),
(r.MaximumLatitude = r.mercatorAngleToGeodeticLatitude(Math.PI)),
(r.prototype.project = function (t, o) {
var a = this._semimajorAxis,
n = t.longitude * a,
u = r.geodeticLatitudeToMercatorAngle(t.latitude) * a,
d = t.height;
return i.defined(o) ? ((o.x = n), (o.y = u), (o.z = d), o) : new e.Cartesian3(n, u, d);
}),
(r.prototype.unproject = function (t, o) {
var a = this._oneOverSemimajorAxis,
n = t.x * a,
u = r.mercatorAngleToGeodeticLatitude(t.y * a),
d = t.z;
return i.defined(o)
? ((o.longitude = n), (o.latitude = u), (o.height = d), o)
: new e.Cartographic(n, u, d);
}),
(t.WebMercatorProjection = r);
});