How to use the @here/harp-mapview.MapViewUtils.extractSphericalCoordinatesFromLocation function in @here/harp-mapview

To help you get started, we’ve selected a few @here/harp-mapview examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heremaps / harp.gl / @here / harp-map-controls / lib / MapControls.ts View on Github external
this.camera.position.length() + zOnVertical
                    )
                )
            );
        }

        // In sphere, we may have to also orbit the camera around the position located at the
        // center of the screen, in order to limit the tilt to `maxTiltAngle`, as we change
        // this tilt by changing the camera's height above.
        if (
            this.mapView.projection.type === geoUtils.ProjectionType.Spherical &&
            this.m_maxTiltAngle !== undefined
        ) {
            const centerScreenTarget = MapViewUtils.rayCastWorldCoordinates(this.mapView, 0, 0);
            if (centerScreenTarget !== null) {
                const tilt = MapViewUtils.extractSphericalCoordinatesFromLocation(
                    this.mapView,
                    this.camera,
                    this.mapView.projection.unprojectPoint(centerScreenTarget)
                ).tilt;
                const deltaTilt = tilt - this.m_maxTiltAngle;
                if (deltaTilt > 0) {
                    MapViewUtils.orbitFocusPoint(this.mapView, 0, deltaTilt, this.m_maxTiltAngle);
                }
            }
        }

        this.updateMapView();
        this.mapView.addEventListener(
            MapViewEventNames.AfterRender,
            this.assignZoomAfterTouchZoomRender
        );
github heremaps / harp.gl / @here / harp-map-controls / lib / MapControls.ts View on Github external
pointToNorth() {
        const target = MapViewUtils.rayCastWorldCoordinates(this.mapView, 0, 0);
        if (target === null) {
            throw new Error("MapView does not support a view pointing in the void.");
        }
        this.m_startAzimuth =
            Math.PI +
            MapViewUtils.extractSphericalCoordinatesFromLocation(
                this.mapView,
                this.camera,
                this.mapView.projection.unprojectPoint(target)
            ).azimuth;
        // Wrap between -PI and PI.
        this.m_startAzimuth = Math.atan2(
            Math.sin(this.m_startAzimuth),
            Math.cos(this.m_startAzimuth)
        );
        if (this.m_startAzimuth === 0) {
            return;
        }
        this.stopExistingAnimations();
        this.m_resetNorthAnimationDuration = this.northResetAnimationDuration;
        this.m_currentAzimuth = this.m_startAzimuth;
        this.m_resetNorthStartTime = performance.now();
github heremaps / harp.gl / @here / harp-map-controls / lib / MapControls.ts View on Github external
private get currentTilt(): number {
        const target = MapViewUtils.rayCastWorldCoordinates(this.mapView, 0, 0);
        if (target === null) {
            throw new Error("MapView does not support a view pointing in the void.");
        }
        return MapViewUtils.extractSphericalCoordinatesFromLocation(
            this.mapView,
            this.camera,
            this.mapView.projection.unprojectPoint(target)
        ).tilt;
    }