Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera.computeViewRectangle is wrong for view that crosses the IDL #3717

Closed
hpinkos opened this issue Mar 17, 2016 · 1 comment
Closed

Camera.computeViewRectangle is wrong for view that crosses the IDL #3717

hpinkos opened this issue Mar 17, 2016 · 1 comment

Comments

@hpinkos
Copy link
Contributor

hpinkos commented Mar 17, 2016

Reported on the forum: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/8UgBBcmEM_U

The rectangle spans the opposite side of the globe. East and west need to be switched.

In this example, zoom to the IDL and click to visualize the rectangle.

var viewer = new Cesium.Viewer('cesiumContainer', {
    selectionIndicator : false,
    infoBox : false
});

viewer.entities.add({
    name : 'IDL',
    polyline : {
        positions : Cesium.Cartesian3.fromDegreesArray([-179.9, 80,
                                                        -179.9, -80]),
        width : 2,
        material : Cesium.Color.WHITE
    }
});

var entity;
var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function() {
    viewer.entities.remove(entity);
    var rectangle = viewer.scene.camera.computeViewRectangle(viewer.scene.globe.ellipsoid);
    entity = viewer.entities.add({
        rectangle : {
            coordinates : rectangle,
            material : Cesium.Color.RED.withAlpha(0.5),
            outline : true,
            outlineColor : Cesium.Color.RED
        }
    });
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
@hpinkos
Copy link
Contributor Author

hpinkos commented Mar 17, 2016

@tfili

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant