Recent study cesium 3D engine, an example of the relevant switching layer is relatively small, the official website to see some examples to their own understanding. Speculative an effect similar to the switching layer.
When this layer switches each button clicks, and other data will entity to delete. Then create or load a new
Much gossip that we directly on the code
Sandcastle.addToolbarButton('Basic styling', function() { viewer.dataSources.add(Cesium.GeoJsonDataSource.load(URL, { stroke: Cesium.Color.HOTPINK, fill: Cesium.Color.PINK.withAlpha(0.5), strokeWidth: 3 })); }); Sandcastle.addToolbarButton('按钮',function() { var position = Cesium.Cartesian3.fromDegrees(116.39053344726561,39.89604077881996, 0.0); var hpr = new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(135), 0.0, 0.0); var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr); Model viewer.entities.add = var ({ ID: '01 ', position: position, Orientation: Orientation, Model: { URI: the URL, minimumPixelSize: 128, maximumScale: 20000 } }); }, "Toolbar"); Sandcastle = function .reset () { viewer.dataSources.removeAll (); viewer.entities.removeById ('01 ') The id // remove Entity // camera is set as a starting point for the home viewer.camera.lookAt(Cesium.Cartesian3.fromDegrees(116.39053344726561,39.89604077881996, 2631.082799425431), new Cesium.Cartesian3(0.0, -4790.0, 3930.0)); viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY); }; //Sandcastle_End Sandcastle.finishedLoading();