Skip to content

Commit 1ad860c

Browse files
committed
Reorder code in entity layer to have consistent order of properties.
Previously the list of properties for each type of Graphics in the entity layer was different everywhere. This made it quite difficult to compare the set of properties in the code vs the set of properties in CZML. I went through and reordered all these locations to have properties in the same order in each. * The documentation for the constructor for each graphics type * The content of the constructor (initializing `_property` and `_propertySubscription` to `undefined`) * The public get/set properties * The contents of the `clone` function for each graphics type * The contents of the `merge` function for each graphics type * The code assigning the values of properties in `CzmlDataSource`. Also add some missing functionality to `CzmlDataSource`: `box.heightReference` `cylinder.heightReference` `ellipsoid.heightReference` `corridor.classificationType` `ellipse.classificationType` `polygon.classificationType` `polyline.classificationType` `rectangle.classificationType`
1 parent 0c0307a commit 1ad860c

29 files changed

+768
-720
lines changed

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Change Log
33

44
### 1.59 - 2019-07-01
55

6+
##### Additions :tada:
7+
* Added CZML support for `heightReference` to `box`, `cylinder`, and `ellipsoid`, and added CZML support for `classificationType` to `corridor`, `ellipse`, `polygon`, `polyline`, and `rectangle`. [#7899](https://github.com/AnalyticalGraphicsInc/cesium/pull/7899)
8+
69
##### Fixes :wrench:
710
* Fixed a bug that caused missing segments for ground polylines with coplanar points over large distances and problems with polylines containing duplicate points. [#7885](https://github.com/AnalyticalGraphicsInc/cesium//pull/7885)
811
* Fixed a bug where billboards were not pickable when zoomed out completely in 2D View. [#7908](https://github.com/AnalyticalGraphicsInc/cesium/pull/7908)

Source/DataSources/BillboardGraphics.js

+108-108
Large diffs are not rendered by default.

Source/DataSources/BoxGraphics.js

+25-24
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ define([
2323
* @constructor
2424
*
2525
* @param {Object} [options] Object with the following properties:
26-
* @param {Property} [options.heightReference] A Property specifying what the height from the entity position is relative to.
27-
* @param {Property} [options.dimensions] A {@link Cartesian3} Property specifying the length, width, and height of the box.
2826
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the box.
27+
* @param {Property} [options.dimensions] A {@link Cartesian3} Property specifying the length, width, and height of the box.
28+
* @param {Property} [options.heightReference] A Property specifying what the height from the entity position is relative to.
2929
* @param {Property} [options.fill=true] A boolean Property specifying whether the box is filled with the provided material.
3030
* @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the box.
3131
* @param {Property} [options.outline=false] A boolean Property specifying whether the box is outlined.
@@ -37,11 +37,13 @@ define([
3737
* @demo {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Box.html|Cesium Sandcastle Box Demo}
3838
*/
3939
function BoxGraphics(options) {
40-
this._heightReference = undefined;
41-
this._dimensions = undefined;
42-
this._dimensionsSubscription = undefined;
40+
this._definitionChanged = new Event();
4341
this._show = undefined;
4442
this._showSubscription = undefined;
43+
this._dimensions = undefined;
44+
this._dimensionsSubscription = undefined;
45+
this._heightReference = undefined;
46+
this._heightReferenceSubscription = undefined;
4547
this._fill = undefined;
4648
this._fillSubscription = undefined;
4749
this._material = undefined;
@@ -56,7 +58,6 @@ define([
5658
this._shadowsSubscription = undefined;
5759
this._distanceDisplayCondition = undefined;
5860
this._distanceDisplayConditionSubscription = undefined;
59-
this._definitionChanged = new Event();
6061

6162
this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT));
6263
}
@@ -74,14 +75,6 @@ define([
7475
}
7576
},
7677

77-
/**
78-
* Gets or sets the Property specifying the {@link HeightReference}.
79-
* @memberof BoxGraphics.prototype
80-
* @type {Property}
81-
* @default HeightReference.NONE
82-
*/
83-
heightReference : createPropertyDescriptor('heightReference'),
84-
8578
/**
8679
* Gets or sets the boolean Property specifying the visibility of the box.
8780
* @memberof BoxGraphics.prototype
@@ -98,12 +91,12 @@ define([
9891
dimensions : createPropertyDescriptor('dimensions'),
9992

10093
/**
101-
* Gets or sets the material used to fill the box.
94+
* Gets or sets the Property specifying the {@link HeightReference}.
10295
* @memberof BoxGraphics.prototype
103-
* @type {MaterialProperty}
104-
* @default Color.WHITE
96+
* @type {Property}
97+
* @default HeightReference.NONE
10598
*/
106-
material : createMaterialPropertyDescriptor('material'),
99+
heightReference : createPropertyDescriptor('heightReference'),
107100

108101
/**
109102
* Gets or sets the boolean Property specifying whether the box is filled with the provided material.
@@ -113,6 +106,14 @@ define([
113106
*/
114107
fill : createPropertyDescriptor('fill'),
115108

109+
/**
110+
* Gets or sets the material used to fill the box.
111+
* @memberof BoxGraphics.prototype
112+
* @type {MaterialProperty}
113+
* @default Color.WHITE
114+
*/
115+
material : createMaterialPropertyDescriptor('material'),
116+
116117
/**
117118
* Gets or sets the Property specifying whether the box is outlined.
118119
* @memberof BoxGraphics.prototype
@@ -164,11 +165,11 @@ define([
164165
if (!defined(result)) {
165166
return new BoxGraphics(this);
166167
}
167-
result.heightReference = this.heightReference;
168-
result.dimensions = this.dimensions;
169168
result.show = this.show;
170-
result.material = this.material;
169+
result.dimensions = this.dimensions;
170+
result.heightReference = this.heightReference;
171171
result.fill = this.fill;
172+
result.material = this.material;
172173
result.outline = this.outline;
173174
result.outlineColor = this.outlineColor;
174175
result.outlineWidth = this.outlineWidth;
@@ -190,11 +191,11 @@ define([
190191
}
191192
//>>includeEnd('debug');
192193

193-
this.heightReference = defaultValue(this.heightReference, source.heightReference);
194-
this.dimensions = defaultValue(this.dimensions, source.dimensions);
195194
this.show = defaultValue(this.show, source.show);
196-
this.material = defaultValue(this.material, source.material);
195+
this.dimensions = defaultValue(this.dimensions, source.dimensions);
196+
this.heightReference = defaultValue(this.heightReference, source.heightReference);
197197
this.fill = defaultValue(this.fill, source.fill);
198+
this.material = defaultValue(this.material, source.material);
198199
this.outline = defaultValue(this.outline, source.outline);
199200
this.outlineColor = defaultValue(this.outlineColor, source.outlineColor);
200201
this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth);

Source/DataSources/CheckerboardMaterialProperty.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,10 @@ define([
3636
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
3737

3838
this._definitionChanged = new Event();
39-
4039
this._evenColor = undefined;
4140
this._evenColorSubscription = undefined;
42-
4341
this._oddColor = undefined;
4442
this._oddColorSubscription = undefined;
45-
4643
this._repeat = undefined;
4744
this._repeatSubscription = undefined;
4845

@@ -67,6 +64,7 @@ define([
6764
Property.isConstant(this._repeat);
6865
}
6966
},
67+
7068
/**
7169
* Gets the event that is raised whenever the definition of this property changes.
7270
* The definition is considered to have changed if a call to getValue would return
@@ -81,20 +79,23 @@ define([
8179
return this._definitionChanged;
8280
}
8381
},
82+
8483
/**
8584
* Gets or sets the Property specifying the first {@link Color}.
8685
* @memberof CheckerboardMaterialProperty.prototype
8786
* @type {Property}
8887
* @default Color.WHITE
8988
*/
9089
evenColor : createPropertyDescriptor('evenColor'),
90+
9191
/**
9292
* Gets or sets the Property specifying the second {@link Color}.
9393
* @memberof CheckerboardMaterialProperty.prototype
9494
* @type {Property}
9595
* @default Color.BLACK
9696
*/
9797
oddColor : createPropertyDescriptor('oddColor'),
98+
9899
/**
99100
* Gets or sets the {@link Cartesian2} Property specifying how many times the tiles repeat in each direction.
100101
* @memberof CheckerboardMaterialProperty.prototype

Source/DataSources/ColorMaterialProperty.js

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ define([
2626
this._definitionChanged = new Event();
2727
this._color = undefined;
2828
this._colorSubscription = undefined;
29+
2930
this.color = color;
3031
}
3132

@@ -43,6 +44,7 @@ define([
4344
return Property.isConstant(this._color);
4445
}
4546
},
47+
4648
/**
4749
* Gets the event that is raised whenever the definition of this property changes.
4850
* The definition is considered to have changed if a call to getValue would return
@@ -57,6 +59,7 @@ define([
5759
return this._definitionChanged;
5860
}
5961
},
62+
6063
/**
6164
* Gets or sets the {@link Color} {@link Property}.
6265
* @memberof ColorMaterialProperty.prototype

Source/DataSources/CorridorGraphics.js

+35-35
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ define([
2525
* @constructor
2626
*
2727
* @param {Object} [options] Object with the following properties:
28+
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the corridor.
2829
* @param {Property} [options.positions] A Property specifying the array of {@link Cartesian3} positions that define the centerline of the corridor.
2930
* @param {Property} [options.width] A numeric Property specifying the distance between the edges of the corridor.
30-
* @param {Property} [options.cornerType=CornerType.ROUNDED] A {@link CornerType} Property specifying the style of the corners.
3131
* @param {Property} [options.height=0] A numeric Property specifying the altitude of the corridor relative to the ellipsoid surface.
3232
* @param {Property} [options.heightReference] A Property specifying what the height is relative to.
3333
* @param {Property} [options.extrudedHeight] A numeric Property specifying the altitude of the corridor's extruded face relative to the ellipsoid surface.
3434
* @param {Property} [options.extrudedHeightReference] A Property specifying what the extrudedHeight is relative to.
35-
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the corridor.
35+
* @param {Property} [options.cornerType=CornerType.ROUNDED] A {@link CornerType} Property specifying the style of the corners.
36+
* @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the distance between each latitude and longitude.
3637
* @param {Property} [options.fill=true] A boolean Property specifying whether the corridor is filled with the provided material.
3738
* @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the corridor.
3839
* @param {Property} [options.outline=false] A boolean Property specifying whether the corridor is outlined.
3940
* @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline.
4041
* @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline.
41-
* @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the distance between each latitude and longitude.
4242
* @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the corridor casts or receives shadows from each light source.
4343
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this corridor will be displayed.
4444
* @param {Property} [options.classificationType=ClassificationType.BOTH] An enum Property specifying whether this corridor will classify terrain, 3D Tiles, or both when on the ground.
@@ -48,12 +48,13 @@ define([
4848
* @demo {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Corridor.html|Cesium Sandcastle Corridor Demo}
4949
*/
5050
function CorridorGraphics(options) {
51+
this._definitionChanged = new Event();
5152
this._show = undefined;
5253
this._showSubscription = undefined;
53-
this._material = undefined;
54-
this._materialSubscription = undefined;
5554
this._positions = undefined;
5655
this._positionsSubscription = undefined;
56+
this._width = undefined;
57+
this._widthSubscription = undefined;
5758
this._height = undefined;
5859
this._heightSubscription = undefined;
5960
this._heightReference = undefined;
@@ -62,14 +63,14 @@ define([
6263
this._extrudedHeightSubscription = undefined;
6364
this._extrudedHeightReference = undefined;
6465
this._extrudedHeightReferenceSubscription = undefined;
65-
this._granularity = undefined;
66-
this._granularitySubscription = undefined;
67-
this._width = undefined;
68-
this._widthSubscription = undefined;
6966
this._cornerType = undefined;
7067
this._cornerTypeSubscription = undefined;
68+
this._granularity = undefined;
69+
this._granularitySubscription = undefined;
7170
this._fill = undefined;
7271
this._fillSubscription = undefined;
72+
this._material = undefined;
73+
this._materialSubscription = undefined;
7374
this._outline = undefined;
7475
this._outlineSubscription = undefined;
7576
this._outlineColor = undefined;
@@ -84,7 +85,6 @@ define([
8485
this._classificationTypeSubscription = undefined;
8586
this._zIndex = undefined;
8687
this._zIndexSubscription = undefined;
87-
this._definitionChanged = new Event();
8888

8989
this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT));
9090
}
@@ -111,19 +111,18 @@ define([
111111
show : createPropertyDescriptor('show'),
112112

113113
/**
114-
* Gets or sets the Property specifying the material used to fill the corridor.
114+
* Gets or sets a Property specifying the array of {@link Cartesian3} positions that define the centerline of the corridor.
115115
* @memberof CorridorGraphics.prototype
116-
* @type {MaterialProperty}
117-
* @default Color.WHITE
116+
* @type {Property}
118117
*/
119-
material : createMaterialPropertyDescriptor('material'),
118+
positions : createPropertyDescriptor('positions'),
120119

121120
/**
122-
* Gets or sets a Property specifying the array of {@link Cartesian3} positions that define the centerline of the corridor.
121+
* Gets or sets the numeric Property specifying the width of the corridor.
123122
* @memberof CorridorGraphics.prototype
124123
* @type {Property}
125124
*/
126-
positions : createPropertyDescriptor('positions'),
125+
width : createPropertyDescriptor('width'),
127126

128127
/**
129128
* Gets or sets the numeric Property specifying the altitude of the corridor.
@@ -159,19 +158,20 @@ define([
159158
extrudedHeightReference : createPropertyDescriptor('extrudedHeightReference'),
160159

161160
/**
162-
* Gets or sets the numeric Property specifying the sampling distance between each latitude and longitude point.
161+
* Gets or sets the {@link CornerType} Property specifying how corners are styled.
163162
* @memberof CorridorGraphics.prototype
164163
* @type {Property}
165-
* @default {CesiumMath.RADIANS_PER_DEGREE}
164+
* @default CornerType.ROUNDED
166165
*/
167-
granularity : createPropertyDescriptor('granularity'),
166+
cornerType : createPropertyDescriptor('cornerType'),
168167

169168
/**
170-
* Gets or sets the numeric Property specifying the width of the corridor.
169+
* Gets or sets the numeric Property specifying the sampling distance between each latitude and longitude point.
171170
* @memberof CorridorGraphics.prototype
172171
* @type {Property}
172+
* @default {CesiumMath.RADIANS_PER_DEGREE}
173173
*/
174-
width : createPropertyDescriptor('width'),
174+
granularity : createPropertyDescriptor('granularity'),
175175

176176
/**
177177
* Gets or sets the boolean Property specifying whether the corridor is filled with the provided material.
@@ -181,6 +181,14 @@ define([
181181
*/
182182
fill : createPropertyDescriptor('fill'),
183183

184+
/**
185+
* Gets or sets the Property specifying the material used to fill the corridor.
186+
* @memberof CorridorGraphics.prototype
187+
* @type {MaterialProperty}
188+
* @default Color.WHITE
189+
*/
190+
material : createMaterialPropertyDescriptor('material'),
191+
184192
/**
185193
* Gets or sets the Property specifying whether the corridor is outlined.
186194
* @memberof CorridorGraphics.prototype
@@ -205,14 +213,6 @@ define([
205213
*/
206214
outlineWidth : createPropertyDescriptor('outlineWidth'),
207215

208-
/**
209-
* Gets or sets the {@link CornerType} Property specifying how corners are styled.
210-
* @memberof CorridorGraphics.prototype
211-
* @type {Property}
212-
* @default CornerType.ROUNDED
213-
*/
214-
cornerType : createPropertyDescriptor('cornerType'),
215-
216216
/**
217217
* Get or sets the enum Property specifying whether the corridor
218218
* casts or receives shadows from each light source.
@@ -257,19 +257,19 @@ define([
257257
return new CorridorGraphics(this);
258258
}
259259
result.show = this.show;
260-
result.material = this.material;
261260
result.positions = this.positions;
261+
result.width = this.width;
262262
result.height = this.height;
263263
result.heightReference = this.heightReference;
264264
result.extrudedHeight = this.extrudedHeight;
265265
result.extrudedHeightReference = this.extrudedHeightReference;
266+
result.cornerType = this.cornerType;
266267
result.granularity = this.granularity;
267-
result.width = this.width;
268268
result.fill = this.fill;
269+
result.material = this.material;
269270
result.outline = this.outline;
270271
result.outlineColor = this.outlineColor;
271272
result.outlineWidth = this.outlineWidth;
272-
result.cornerType = this.cornerType;
273273
result.shadows = this.shadows;
274274
result.distanceDisplayCondition = this.distanceDisplayCondition;
275275
result.classificationType = this.classificationType;
@@ -291,19 +291,19 @@ define([
291291
//>>includeEnd('debug');
292292

293293
this.show = defaultValue(this.show, source.show);
294-
this.material = defaultValue(this.material, source.material);
295294
this.positions = defaultValue(this.positions, source.positions);
295+
this.width = defaultValue(this.width, source.width);
296296
this.height = defaultValue(this.height, source.height);
297297
this.heightReference = defaultValue(this.heightReference, source.heightReference);
298298
this.extrudedHeight = defaultValue(this.extrudedHeight, source.extrudedHeight);
299299
this.extrudedHeightReference = defaultValue(this.extrudedHeightReference, source.extrudedHeightReference);
300+
this.cornerType = defaultValue(this.cornerType, source.cornerType);
300301
this.granularity = defaultValue(this.granularity, source.granularity);
301-
this.width = defaultValue(this.width, source.width);
302302
this.fill = defaultValue(this.fill, source.fill);
303+
this.material = defaultValue(this.material, source.material);
303304
this.outline = defaultValue(this.outline, source.outline);
304305
this.outlineColor = defaultValue(this.outlineColor, source.outlineColor);
305306
this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth);
306-
this.cornerType = defaultValue(this.cornerType, source.cornerType);
307307
this.shadows = defaultValue(this.shadows, source.shadows);
308308
this.distanceDisplayCondition = defaultValue(this.distanceDisplayCondition, source.distanceDisplayCondition);
309309
this.classificationType = defaultValue(this.classificationType, source.classificationType);

0 commit comments

Comments
 (0)