Skip to content

Commit 030a258

Browse files
author
Hannah
authored
Merge pull request #8841 from jrafidi/jr/czml-polyline-volume
Add support for PolylineVolume in CZML
2 parents e74fa23 + 64e1051 commit 030a258

File tree

6 files changed

+429
-0
lines changed

6 files changed

+429
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta
7+
name="viewport"
8+
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
9+
/>
10+
<meta name="description" content="CZML Polyline Volume" />
11+
<meta name="cesium-sandcastle-labels" content="CZML" />
12+
<title>Cesium Demo</title>
13+
<script type="text/javascript" src="../Sandcastle-header.js"></script>
14+
<script
15+
type="text/javascript"
16+
src="../../../Build/CesiumUnminified/Cesium.js"
17+
nomodule
18+
></script>
19+
<script type="module" src="../load-cesium-es6.js"></script>
20+
</head>
21+
<body
22+
class="sandcastle-loading"
23+
data-sandcastle-bucket="bucket-requirejs.html"
24+
>
25+
<style>
26+
@import url(../templates/bucket.css);
27+
</style>
28+
<div id="cesiumContainer" class="fullSize"></div>
29+
<div id="loadingOverlay"><h1>Loading...</h1></div>
30+
<div id="toolbar"></div>
31+
32+
<script id="cesium_sandcastle_script">
33+
function startup(Cesium) {
34+
"use strict";
35+
//Sandcastle_Begin
36+
var czml = [
37+
{
38+
id: "document",
39+
name: "CZML Geometries: Polyline Volume",
40+
version: "1.0",
41+
},
42+
{
43+
id: "greenBox",
44+
name: "Green box with beveled corners and outline",
45+
polylineVolume: {
46+
positions: {
47+
cartographicDegrees: [
48+
-90.0,
49+
32.0,
50+
0,
51+
-90.0,
52+
36.0,
53+
100000,
54+
-94.0,
55+
36.0,
56+
0,
57+
],
58+
},
59+
shape: {
60+
cartesian: [
61+
-50000,
62+
-50000,
63+
50000,
64+
-50000,
65+
50000,
66+
50000,
67+
-50000,
68+
50000,
69+
],
70+
},
71+
cornerType: "BEVELED",
72+
material: {
73+
solidColor: {
74+
color: {
75+
rgba: [0, 255, 0, 128],
76+
},
77+
},
78+
},
79+
outline: true,
80+
outlineColor: {
81+
rgba: [0, 0, 0, 255],
82+
},
83+
},
84+
},
85+
{
86+
id: "blueStar",
87+
name: "Blue star with mitered corners and outline",
88+
polylineVolume: {
89+
positions: {
90+
cartographicDegrees: [
91+
-95.0,
92+
32.0,
93+
0,
94+
-95.0,
95+
36.0,
96+
100000,
97+
-99.0,
98+
36.0,
99+
200000,
100+
],
101+
},
102+
shape: {
103+
cartesian: [
104+
70000,
105+
0,
106+
45048.44339512096,
107+
21694.186955877907,
108+
43644.28613011135,
109+
54728.203772762085,
110+
11126.046697815722,
111+
48746.39560909118,
112+
-15576.465376942004,
113+
68244.95385272766,
114+
-31174.490092936674,
115+
39091.57412340149,
116+
-63067.82075316933,
117+
30371.861738229076,
118+
-50000,
119+
6.123233995736766e-12,
120+
-63067.82075316934,
121+
-30371.86173822906,
122+
-31174.490092936685,
123+
-39091.574123401486,
124+
-15576.465376942022,
125+
-68244.95385272766,
126+
11126.046697815711,
127+
-48746.39560909118,
128+
43644.28613011134,
129+
-54728.20377276209,
130+
45048.44339512095,
131+
-21694.186955877918,
132+
],
133+
},
134+
cornerType: "MITERED",
135+
material: {
136+
solidColor: {
137+
color: {
138+
rgba: [0, 0, 255, 255],
139+
},
140+
},
141+
},
142+
},
143+
},
144+
];
145+
146+
var viewer = new Cesium.Viewer("cesiumContainer");
147+
var dataSourcePromise = Cesium.CzmlDataSource.load(czml);
148+
viewer.dataSources.add(dataSourcePromise);
149+
viewer.zoomTo(dataSourcePromise);
150+
151+
//Sandcastle_End
152+
Sandcastle.finishedLoading();
153+
}
154+
if (typeof Cesium !== "undefined") {
155+
window.startupCalled = true;
156+
startup(Cesium);
157+
}
158+
</script>
159+
</body>
160+
</html>
17.1 KB
Loading

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
- Updated `WallGeometry` to respect the order of positions passed in, instead of making the positions respect a counter clockwise winding order. This will only effect the look of walls with an image material. If this changed the way your wall is drawing, reverse the order of the positions.
88

9+
##### Additions :tada:
10+
11+
- Added support for PolylineVolume in CZML [#8841](https://github.com/CesiumGS/cesium/pull/8841)
12+
913
##### Fixes :wrench:
1014

1115
- Fixed error with `WallGeoemtry` when there were adjacent positions with very close values [#8952](https://github.com/CesiumGS/cesium/pull/8952)

CONTRIBUTORS.md

+2
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
150150
- [Daniel Santillan](https://github.com/santilland)
151151
- [Navagis, Inc.](https://navagis.com/)
152152
- [Jonathan Nogueira](https://github.com/LuminousPath)
153+
- [Palantir Technologies, Inc.](https://palantir.com)
154+
- [Joey Rafidi](https://github.com/jrafidi)
153155

154156
## [Individual CLA](Documentation/Contributors/CLAs/individual-contributor-license-agreement-v1.0.pdf)
155157

Source/DataSources/CzmlDataSource.js

+171
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import PolylineDashMaterialProperty from "./PolylineDashMaterialProperty.js";
7373
import PolylineGlowMaterialProperty from "./PolylineGlowMaterialProperty.js";
7474
import PolylineGraphics from "./PolylineGraphics.js";
7575
import PolylineOutlineMaterialProperty from "./PolylineOutlineMaterialProperty.js";
76+
import PolylineVolumeGraphics from "./PolylineVolumeGraphics.js";
7677
import PositionPropertyArray from "./PositionPropertyArray.js";
7778
import Property from "./Property.js";
7879
import PropertyArray from "./PropertyArray.js";
@@ -1166,6 +1167,41 @@ function processPositionPacketData(
11661167
}
11671168
}
11681169

1170+
function processShapePacketData(
1171+
object,
1172+
propertyName,
1173+
packetData,
1174+
entityCollection
1175+
) {
1176+
if (defined(packetData.references)) {
1177+
processReferencesArrayPacketData(
1178+
object,
1179+
propertyName,
1180+
packetData.references,
1181+
packetData.interval,
1182+
entityCollection,
1183+
PropertyArray,
1184+
CompositeProperty
1185+
);
1186+
} else {
1187+
if (defined(packetData.cartesian)) {
1188+
packetData.array = Cartesian2.unpackArray(packetData.cartesian);
1189+
}
1190+
1191+
if (defined(packetData.array)) {
1192+
processPacketData(
1193+
Array,
1194+
object,
1195+
propertyName,
1196+
packetData,
1197+
undefined,
1198+
undefined,
1199+
entityCollection
1200+
);
1201+
}
1202+
}
1203+
}
1204+
11691205
function processMaterialProperty(
11701206
object,
11711207
propertyName,
@@ -1924,6 +1960,25 @@ function processPositionArrayOfArrays(
19241960
}
19251961
}
19261962

1963+
function processShape(object, propertyName, packetData, entityCollection) {
1964+
if (!defined(packetData)) {
1965+
return;
1966+
}
1967+
1968+
if (Array.isArray(packetData)) {
1969+
for (var i = 0, length = packetData.length; i < length; i++) {
1970+
processShapePacketData(
1971+
object,
1972+
propertyName,
1973+
packetData[i],
1974+
entityCollection
1975+
);
1976+
}
1977+
} else {
1978+
processShapePacketData(object, propertyName, packetData, entityCollection);
1979+
}
1980+
}
1981+
19271982
function processAvailability(entity, packet, entityCollection, sourceUri) {
19281983
var packetData = packet.availability;
19291984
if (!defined(packetData)) {
@@ -4119,6 +4174,121 @@ function processPolyline(entity, packet, entityCollection, sourceUri) {
41194174
}
41204175
}
41214176

4177+
function processPolylineVolume(entity, packet, entityCollection, sourceUri) {
4178+
var polylineVolumeData = packet.polylineVolume;
4179+
if (!defined(polylineVolumeData)) {
4180+
return;
4181+
}
4182+
4183+
var interval = intervalFromString(polylineVolumeData.interval);
4184+
var polylineVolume = entity.polylineVolume;
4185+
if (!defined(polylineVolume)) {
4186+
entity.polylineVolume = polylineVolume = new PolylineVolumeGraphics();
4187+
}
4188+
4189+
processPositionArray(
4190+
polylineVolume,
4191+
"positions",
4192+
polylineVolumeData.positions,
4193+
entityCollection
4194+
);
4195+
processShape(
4196+
polylineVolume,
4197+
"shape",
4198+
polylineVolumeData.shape,
4199+
entityCollection
4200+
);
4201+
processPacketData(
4202+
Boolean,
4203+
polylineVolume,
4204+
"show",
4205+
polylineVolumeData.show,
4206+
interval,
4207+
sourceUri,
4208+
entityCollection
4209+
);
4210+
processPacketData(
4211+
CornerType,
4212+
polylineVolume,
4213+
"cornerType",
4214+
polylineVolumeData.cornerType,
4215+
interval,
4216+
sourceUri,
4217+
entityCollection
4218+
);
4219+
processPacketData(
4220+
Boolean,
4221+
polylineVolume,
4222+
"fill",
4223+
polylineVolumeData.fill,
4224+
interval,
4225+
sourceUri,
4226+
entityCollection
4227+
);
4228+
processMaterialPacketData(
4229+
polylineVolume,
4230+
"material",
4231+
polylineVolumeData.material,
4232+
interval,
4233+
sourceUri,
4234+
entityCollection
4235+
);
4236+
processPacketData(
4237+
Boolean,
4238+
polylineVolume,
4239+
"outline",
4240+
polylineVolumeData.outline,
4241+
interval,
4242+
sourceUri,
4243+
entityCollection
4244+
);
4245+
processPacketData(
4246+
Color,
4247+
polylineVolume,
4248+
"outlineColor",
4249+
polylineVolumeData.outlineColor,
4250+
interval,
4251+
sourceUri,
4252+
entityCollection
4253+
);
4254+
processPacketData(
4255+
Number,
4256+
polylineVolume,
4257+
"outlineWidth",
4258+
polylineVolumeData.outlineWidth,
4259+
interval,
4260+
sourceUri,
4261+
entityCollection
4262+
);
4263+
processPacketData(
4264+
Number,
4265+
polylineVolume,
4266+
"granularity",
4267+
polylineVolumeData.granularity,
4268+
interval,
4269+
sourceUri,
4270+
entityCollection
4271+
);
4272+
processPacketData(
4273+
ShadowMode,
4274+
polylineVolume,
4275+
"shadows",
4276+
polylineVolumeData.shadows,
4277+
interval,
4278+
sourceUri,
4279+
entityCollection
4280+
);
4281+
processPacketData(
4282+
DistanceDisplayCondition,
4283+
polylineVolume,
4284+
"distanceDisplayCondition",
4285+
polylineVolumeData.distanceDisplayCondition,
4286+
interval,
4287+
sourceUri,
4288+
entityCollection
4289+
);
4290+
}
4291+
41224292
function processRectangle(entity, packet, entityCollection, sourceUri) {
41234293
var rectangleData = packet.rectangle;
41244294
if (!defined(rectangleData)) {
@@ -4831,6 +5001,7 @@ CzmlDataSource.updaters = [
48315001
processPoint, //
48325002
processPolygon, //
48335003
processPolyline, //
5004+
processPolylineVolume, //
48345005
processProperties, //
48355006
processRectangle, //
48365007
processPosition, //

0 commit comments

Comments
 (0)