How to find out the boundaries of the current view?

Hello all,

The data (lat/lon points) I want to render on the globe is huge, so considering the performance issue, I’d like to render the data based on level of zooming. Only the data within the current view is going to be rendered, but I couldn’t figure out how to find the boundaries of the current view. I think Cesium has the capacity of doing this, because it is similar to how Cesium updating imagery tiles within the current view.

Can someone give me some pointers on how to find the boundaries of the current view? A simple example would be perfect.

Thanks in advance,

Steven

Please help.

在 2014年10月13日星期一UTC-7下午5时01分57秒,Steven写道:

Cesium doesn’t expose such functionality, and it won’t really provide the benefit that you think it does. See this thread for some more info: https://groups.google.com/d/msg/cesium-dev/ZLxOyMuA3vo/F9FgI7-1DZ4J

The QuadtreePrimitive was implemented to solve the use case you’re describing, but it’s currently a private interface that is not publicly documented (which I didn’t realize until I went to look for it just now). Perhaps Kevin can chime in with some guidance, since he was the original implementor.

Thanks for the reply, Matt.
I am now able to find the coordinates of the four boundaries of the current view.

Tamy posted his solution in this thread (https://groups.google.com/forum/?fromgroups#!topic/cesium-dev/jYlLEnyv7lM).

I rewrite Tamy’s code using Cesium 1.0, and it works for 3D, 2.5D, and 2D.

var c2 = new Cartesian2(0,0);

var leftTop = widget.scene.camera.pickEllipsoid(c2, widget.scene.globe.ellipsoid);

c2 = new Cartesian2(widget.scene.canvas.width, widget.scene.canvas.height, 0);

var rightDown = widget.scene.camera.pickEllipsoid(c2, widget.scene.globe.ellipsoid);

if(leftTop != undefined && rightDown != undefined){

leftTop = widget.scene.globe.ellipsoid.cartesianToCartographic(leftTop);

rightDown = widget.scene.globe.ellipsoid.cartesianToCartographic(rightDown);

alert('left: ’ + CesiumMath.toDegrees(leftTop.longitude));

alert('right: ’ + CesiumMath.toDegrees(rightDown.longitude));

alert('top: ’ + CesiumMath.toDegrees(leftTop.latitude));

alert('bottom: ’ + CesiumMath.toDegrees(rightDown.latitude));

}else{

alert(‘sky’);

}

在 2014年10月13日星期一UTC-7下午5时01分57秒,Steven写道: