var czmlDocument = [{ "id" : "document", "name" : "CZML Point", "version" : "1.0"}];
var czml = [ { "id" : "point1", "name": "point", "position" : { "cartesian" : [1864828.93,3364932.93,5070208.06] }, "label" : { "fillColor" : { "rgba" : [255, 255, 255, 255] }, "font" : "12pt Lucida Console", "horizontalOrigin" : "LEFT", "pixelOffset" : { "cartesian2" : [8, 0] }, "style" : "FILL", "text" : "point1", "showBackground" : true, "backgroundColor" : { "rgba" : [112, 89, 57, 200] } }, "point": { "color": { "rgba": [255, 255, 255, 255] }, "outlineColor": { "rgba": [255, 0, 0, 255] }, "outlineWidth" : 4, "pixelSize": 20 } }];
var czmlDelete = [ { "id":"point1", "delete":true }];
var inView = function(_position, _viewer) { try { var camera = _viewer.scene.camera; var frustum = camera.frustum; var cullingVolume = frustum.computeCullingVolume(camera.position, camera.direction, camera.up); return cullingVolume.computeVisibility(new Cesium.BoundingSphere(_position, 0.0)) === Cesium.Intersect.INSIDE; } catch (e) { console.log(e); return false; }};
var viewRectangle = function(_viewer) { var ellipsoid = _viewer.scene.globe.ellipsoid; return _viewer.scene.camera.computeViewRectangle(ellipsoid);};
var viewer = new Cesium.Viewer('cesiumContainer');var dataSource = new Cesium.CzmlDataSource('test');viewer.dataSources.add(dataSource);dataSource.load(czmlDocument);
Sandcastle.addToolbarButton('Process Point', function() { dataSource.process(czml).then(function(ds) { var rect = viewRectangle(viewer); console.log('Entities (processed): ' + ds.entities.values.length + ' viewRect: [w:' + rect.west + ' s:' + rect.south + ' e:' + rect.east + ' n:' + rect.north + ']'); for(var i = 0; i < ds.entities.values.length; i++) { var e = ds.entities.values[i]; var position = e.position.getValue(viewer.clock.currentTime); var screen = Cesium.SceneTransforms.wgs84ToWindowCoordinates(viewer.scene, position); console.log(e.id + ' ' + position + ' screen:' + screen + ', visible: ' + inView(position, viewer)); } });});
Sandcastle.addToolbarButton('Delete Point', function() { dataSource.process(czmlDelete).then(function(ds) { console.log('Entities (processed): ' + ds.entities.values.length); });});p.s.
EllipsoidalOccluder is not available in https://cesiumjs.org/Cesium/Build/Documentation/
only at
https://cesiumjs.org/releases/b30/Build/Documentation/index.html