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

flyToRectangle doesn't work with rectangles that cross the IDL #2093

Closed
shunter opened this issue Aug 27, 2014 · 6 comments
Closed

flyToRectangle doesn't work with rectangles that cross the IDL #2093

shunter opened this issue Aug 27, 2014 · 6 comments
Assignees

Comments

@shunter
Copy link
Contributor

shunter commented Aug 27, 2014

Sandcastle example. Behavior is different (wrong in all cases) for 3D / CV / 2D.

var viewer = new Cesium.Viewer('cesiumContainer');

var scene = viewer.scene;

var primitives = scene.primitives;

var s = 12.361967086791992;
var w = 158.82334899902344;
var n = 81.638031005859375;
var e = -36.823356628417969;

var rect1 = Cesium.Rectangle.fromDegrees(w,s,e,n);

s = -8.4206666946411133;
w = 16.297948837280273;
n = 81.260665893554688;
e = -163.37794494628906;

var rect2 = Cesium.Rectangle.fromDegrees(w,s,e,n);

primitives.add(new Cesium.RectanglePrimitive({
    rectangle : rect1,
    material : Cesium.Material.fromType(Cesium.Material.ColorType, {
        color : new Cesium.Color(1.0, 0.0, 0.0, 0.75)
    })
}));

primitives.add(new Cesium.RectanglePrimitive({
    rectangle : rect2,
    material : Cesium.Material.fromType(Cesium.Material.ColorType, {
        color : new Cesium.Color(0.0, 1.0, 0.0, 0.75)
    })
}));

Sandcastle.addToolbarButton('fly red', function() {
    scene.camera.flyToRectangle({
        destination : rect1
    });
});

Sandcastle.addToolbarButton('fly green', function() {
    scene.camera.flyToRectangle({
        destination : rect2
    });
});
@pjcozzi
Copy link
Contributor

pjcozzi commented Nov 24, 2014

CC #2195

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 9, 2014

Not fixed by #2313. Not important now.

@bagnell
Copy link
Contributor

bagnell commented Jun 22, 2015

This works in 3D. What is the expected behavior in 2D/CV? View the whole map?

@shunter
Copy link
Contributor Author

shunter commented Jun 22, 2015

which branch are you testing in? master is fixed in 3D but in 2D the destination is inverted.

e.g. this is supposed to be flyTo the green rect:

image

@shunter
Copy link
Contributor Author

shunter commented Jun 22, 2015

I guess what you are asking is which green rect to flyTo, since there are two rects after the IDL split. I think your suggestion of showing the whole map is reasonable.

@bagnell bagnell mentioned this issue Jun 22, 2015
4 tasks
@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 23, 2015

Updated code:

var viewer = new Cesium.Viewer('cesiumContainer');

var scene = viewer.scene;

var primitives = scene.primitives;

var s = 12.361967086791992;
var w = 158.82334899902344;
var n = 81.638031005859375;
var e = -36.823356628417969;

var rect1 = Cesium.Rectangle.fromDegrees(w,s,e,n);

s = -8.4206666946411133;
w = 16.297948837280273;
n = 81.260665893554688;
e = -163.37794494628906;

var rect2 = Cesium.Rectangle.fromDegrees(w,s,e,n);

primitives.add(new Cesium.RectanglePrimitive({
    rectangle : rect1,
    material : Cesium.Material.fromType(Cesium.Material.ColorType, {
        color : new Cesium.Color(1.0, 0.0, 0.0, 0.75)
    })
}));

primitives.add(new Cesium.RectanglePrimitive({
    rectangle : rect2,
    material : Cesium.Material.fromType(Cesium.Material.ColorType, {
        color : new Cesium.Color(0.0, 1.0, 0.0, 0.75)
    })
}));

Sandcastle.addToolbarButton('fly red', function() {
    scene.camera.flyTo({
        destination : rect1
    });
});

Sandcastle.addToolbarButton('fly green', function() {
    scene.camera.flyTo({
        destination : rect2
    });
});

@pjcozzi pjcozzi closed this as completed Jun 30, 2015
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

3 participants