MCPcopy Create free account
hub / github.com/microsoft/SandDance / WebMercatorViewport1

Function WebMercatorViewport1

docs/app/js/sanddance-app.js:81983–82041  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81981 (0, _inheritsDefault.default)(WebMercatorViewport1, _Viewport);
81982 var _super = _createSuper(WebMercatorViewport1);
81983 function WebMercatorViewport1() {
81984 var _this;
81985 var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
81986 (0, _classCallCheckDefault.default)(this, WebMercatorViewport1);
81987 var _opts$latitude = opts.latitude, latitude = _opts$latitude === void 0 ? 0 : _opts$latitude, _opts$longitude = opts.longitude, longitude = _opts$longitude === void 0 ? 0 : _opts$longitude, _opts$zoom = opts.zoom, zoom = _opts$zoom === void 0 ? 11 : _opts$zoom, _opts$pitch = opts.pitch, pitch = _opts$pitch === void 0 ? 0 : _opts$pitch, _opts$bearing = opts.bearing, bearing = _opts$bearing === void 0 ? 0 : _opts$bearing, _opts$nearZMultiplier = opts.nearZMultiplier, nearZMultiplier = _opts$nearZMultiplier === void 0 ? 0.1 : _opts$nearZMultiplier, _opts$farZMultiplier = opts.farZMultiplier, farZMultiplier = _opts$farZMultiplier === void 0 ? 1.01 : _opts$farZMultiplier, _opts$orthographic = opts.orthographic, orthographic = _opts$orthographic === void 0 ? false : _opts$orthographic, _opts$repeat = opts.repeat, repeat = _opts$repeat === void 0 ? false : _opts$repeat, _opts$worldOffset = opts.worldOffset, worldOffset = _opts$worldOffset === void 0 ? 0 : _opts$worldOffset;
81988 var width = opts.width, height = opts.height, _opts$altitude = opts.altitude, altitude = _opts$altitude === void 0 ? 1.5 : _opts$altitude;
81989 var scale = Math.pow(2, zoom);
81990 width = width || 1;
81991 height = height || 1;
81992 altitude = Math.max(0.75, altitude);
81993 var _getProjectionParamet = (0, _webMercator.getProjectionParameters)({
81994 width: width,
81995 height: height,
81996 pitch: pitch,
81997 altitude: altitude,
81998 nearZMultiplier: nearZMultiplier,
81999 farZMultiplier: farZMultiplier
82000 }), fov = _getProjectionParamet.fov, aspect = _getProjectionParamet.aspect, focalDistance = _getProjectionParamet.focalDistance, near = _getProjectionParamet.near, far = _getProjectionParamet.far;
82001 var viewMatrixUncentered = (0, _webMercator.getViewMatrix)({
82002 height: height,
82003 pitch: pitch,
82004 bearing: bearing,
82005 scale: scale,
82006 altitude: altitude
82007 });
82008 if (worldOffset) {
82009 var viewOffset = new (0, _mathGl.Matrix4)().translate([
82010 512 * worldOffset,
82011 0,
82012 0
82013 ]);
82014 viewMatrixUncentered = viewOffset.multiplyLeft(viewMatrixUncentered);
82015 }
82016 var viewportOpts = Object.assign({}, opts, {
82017 width: width,
82018 height: height,
82019 viewMatrix: viewMatrixUncentered,
82020 longitude: longitude,
82021 latitude: latitude,
82022 zoom: zoom,
82023 orthographic: orthographic,
82024 fovyRadians: fov,
82025 aspect: aspect,
82026 focalDistance: orthographic ? focalDistance : 1,
82027 near: near,
82028 far: far
82029 });
82030 _this = _super.call(this, viewportOpts);
82031 _this.latitude = latitude;
82032 _this.longitude = longitude;
82033 _this.zoom = zoom;
82034 _this.pitch = pitch;
82035 _this.bearing = bearing;
82036 _this.altitude = altitude;
82037 _this.orthographic = orthographic;
82038 _this._subViewports = repeat ? [] : null;
82039 Object.freeze((0, _assertThisInitializedDefault.default)(_this));
82040 return _this;

Callers

nothing calls this directly

Calls 3

maxMethod · 0.45
translateMethod · 0.45
multiplyLeftMethod · 0.45

Tested by

no test coverage detected