|
32 | 32 | var viewer = new Cesium.Viewer('cesiumContainer');
|
33 | 33 |
|
34 | 34 | viewer.entities.add({
|
| 35 | + id : 'Red rectangle, zIndex 1', |
35 | 36 | rectangle : {
|
36 | 37 | coordinates : Cesium.Rectangle.fromDegrees(-110.0, 20.0, -100.5, 30.0),
|
37 | 38 | material : Cesium.Color.RED,
|
|
40 | 41 | });
|
41 | 42 |
|
42 | 43 | viewer.entities.add({
|
| 44 | + id : 'Textured rectangle, zIndex 2', |
43 | 45 | rectangle : {
|
44 | 46 | coordinates : Cesium.Rectangle.fromDegrees(-112.0, 25.0, -102.5, 35.0),
|
45 | 47 | material : '../images/Cesium_Logo_Color.jpg',
|
|
48 | 50 | });
|
49 | 51 |
|
50 | 52 | viewer.entities.add({
|
| 53 | + id : 'Blue rectangle, zIndex 3', |
51 | 54 | rectangle : {
|
52 | 55 | coordinates : Cesium.Rectangle.fromDegrees(-110.0, 31.0, -100.5, 41.0),
|
53 | 56 | material : Cesium.Color.BLUE,
|
|
56 | 59 | });
|
57 | 60 |
|
58 | 61 | viewer.entities.add({
|
| 62 | + id : 'Textured rectangle, zIndex 3', |
59 | 63 | rectangle : {
|
60 | 64 | coordinates : Cesium.Rectangle.fromDegrees(-99.5, 20.0, -90.0, 30.0),
|
61 | 65 | material : '../images/Cesium_Logo_Color.jpg',
|
|
64 | 68 | });
|
65 | 69 |
|
66 | 70 | viewer.entities.add({
|
| 71 | + id : 'Green rectangle, zIndex 2', |
67 | 72 | rectangle : {
|
68 | 73 | coordinates : Cesium.Rectangle.fromDegrees(-97.5, 25.0, -88.0, 35.0),
|
69 | 74 | material : Cesium.Color.GREEN,
|
|
72 | 77 | });
|
73 | 78 |
|
74 | 79 | viewer.entities.add({
|
| 80 | + id : 'Blue rectangle, zIndex 1', |
75 | 81 | rectangle : {
|
76 | 82 | coordinates : Cesium.Rectangle.fromDegrees(-99.5, 31.0, -90.0, 41.0),
|
77 | 83 | material : Cesium.Color.BLUE,
|
78 | 84 | zIndex: 1
|
79 | 85 | }
|
80 | 86 | });
|
81 | 87 |
|
| 88 | +if (!Cesium.Entity.supportsPolylinesOnTerrain(viewer.scene)) { |
| 89 | + console.log('Polylines on terrain is not supported on this platform, Z-index will be ignored'); |
| 90 | +} |
| 91 | + |
| 92 | +if (!Cesium.Entity.supportsMaterialsforEntitiesOnTerrain(viewer.scene)) { |
| 93 | + console.log('Textured materials on terrain polygons is not supported on this platform, Z-index will be ignored'); |
| 94 | +} |
| 95 | + |
| 96 | +viewer.entities.add({ |
| 97 | + id : 'Polyline, zIndex 2', |
| 98 | + polyline : { |
| 99 | + positions : Cesium.Cartesian3.fromDegreesArray([ |
| 100 | + -120.0, 22.0, |
| 101 | + -80.0, 22.0 |
| 102 | + ]), |
| 103 | + width : 8.0, |
| 104 | + material : new Cesium.PolylineGlowMaterialProperty({ |
| 105 | + glowPower : 0.2, |
| 106 | + color : Cesium.Color.BLUE |
| 107 | + }), |
| 108 | + zIndex: 2, |
| 109 | + clampToGround : true |
| 110 | + } |
| 111 | +}); |
| 112 | + |
82 | 113 | viewer.zoomTo(viewer.entities);
|
83 | 114 | //Sandcastle_End
|
84 | 115 | Sandcastle.finishedLoading();
|
|
0 commit comments