Skip to content

Commit

Permalink
Reorder code in entity layer to have consistent order of properties.
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
shunter committed Jun 3, 2019
1 parent c2362b8 commit 2b4d9b3
Show file tree
Hide file tree
Showing 29 changed files with 771 additions and 721 deletions.
7 changes: 6 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Change Log
==========

### 1.59 - 2019-07-01

##### Additions :tada:
* 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)

### 1.58 - 2019-06-03

##### Additions :tada:
Expand All @@ -14,7 +19,7 @@ Change Log
##### Fixes :wrench:
* Fixed an edge case where Cesium would provide ion access token credentials to non-ion servers if the actual asset entrypoint was being hosted by ion. [#7839](https://github.com/AnalyticalGraphicsInc/cesium/pull/7839)
* Fixed a bug that caused Cesium to request non-existent tiles for terrain tilesets lacking tile availability, i.e. a `layer.json` file.
* Fixed memory leak when removing entities that had a `HeightReference` of `CLAMP_TO_GROUND` or `RELATIVE_TO_GROUND`. This includes when removing a `DataSource`.
* Fixed memory leak when removing entities that had a `HeightReference` of `CLAMP_TO_GROUND` or `RELATIVE_TO_GROUND`. This includes when removing a `DataSource`.
* Fixed 3D Tiles credits not being shown in the data attribution box. [#7877](https://github.com/AnalyticalGraphicsInc/cesium/pull/7877)

### 1.57 - 2019-05-01
Expand Down
216 changes: 108 additions & 108 deletions Source/DataSources/BillboardGraphics.js

Large diffs are not rendered by default.

49 changes: 25 additions & 24 deletions Source/DataSources/BoxGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ define([
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.heightReference] A Property specifying what the height from the entity position is relative to.
* @param {Property} [options.dimensions] A {@link Cartesian3} Property specifying the length, width, and height of the box.
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the box.
* @param {Property} [options.dimensions] A {@link Cartesian3} Property specifying the length, width, and height of the box.
* @param {Property} [options.heightReference] A Property specifying what the height from the entity position is relative to.
* @param {Property} [options.fill=true] A boolean Property specifying whether the box is filled with the provided material.
* @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the box.
* @param {Property} [options.outline=false] A boolean Property specifying whether the box is outlined.
Expand All @@ -37,11 +37,13 @@ define([
* @demo {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Box.html|Cesium Sandcastle Box Demo}
*/
function BoxGraphics(options) {
this._heightReference = undefined;
this._dimensions = undefined;
this._dimensionsSubscription = undefined;
this._definitionChanged = new Event();
this._show = undefined;
this._showSubscription = undefined;
this._dimensions = undefined;
this._dimensionsSubscription = undefined;
this._heightReference = undefined;
this._heightReferenceSubscription = undefined;
this._fill = undefined;
this._fillSubscription = undefined;
this._material = undefined;
Expand All @@ -56,7 +58,6 @@ define([
this._shadowsSubscription = undefined;
this._distanceDisplayCondition = undefined;
this._distanceDisplayConditionSubscription = undefined;
this._definitionChanged = new Event();

this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT));
}
Expand All @@ -74,14 +75,6 @@ define([
}
},

/**
* Gets or sets the Property specifying the {@link HeightReference}.
* @memberof BoxGraphics.prototype
* @type {Property}
* @default HeightReference.NONE
*/
heightReference : createPropertyDescriptor('heightReference'),

/**
* Gets or sets the boolean Property specifying the visibility of the box.
* @memberof BoxGraphics.prototype
Expand All @@ -98,12 +91,12 @@ define([
dimensions : createPropertyDescriptor('dimensions'),

/**
* Gets or sets the material used to fill the box.
* Gets or sets the Property specifying the {@link HeightReference}.
* @memberof BoxGraphics.prototype
* @type {MaterialProperty}
* @default Color.WHITE
* @type {Property}
* @default HeightReference.NONE
*/
material : createMaterialPropertyDescriptor('material'),
heightReference : createPropertyDescriptor('heightReference'),

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

/**
* Gets or sets the material used to fill the box.
* @memberof BoxGraphics.prototype
* @type {MaterialProperty}
* @default Color.WHITE
*/
material : createMaterialPropertyDescriptor('material'),

/**
* Gets or sets the Property specifying whether the box is outlined.
* @memberof BoxGraphics.prototype
Expand Down Expand Up @@ -164,11 +165,11 @@ define([
if (!defined(result)) {
return new BoxGraphics(this);
}
result.heightReference = this.heightReference;
result.dimensions = this.dimensions;
result.show = this.show;
result.material = this.material;
result.dimensions = this.dimensions;
result.heightReference = this.heightReference;
result.fill = this.fill;
result.material = this.material;
result.outline = this.outline;
result.outlineColor = this.outlineColor;
result.outlineWidth = this.outlineWidth;
Expand All @@ -190,11 +191,11 @@ define([
}
//>>includeEnd('debug');

this.heightReference = defaultValue(this.heightReference, source.heightReference);
this.dimensions = defaultValue(this.dimensions, source.dimensions);
this.show = defaultValue(this.show, source.show);
this.material = defaultValue(this.material, source.material);
this.dimensions = defaultValue(this.dimensions, source.dimensions);
this.heightReference = defaultValue(this.heightReference, source.heightReference);
this.fill = defaultValue(this.fill, source.fill);
this.material = defaultValue(this.material, source.material);
this.outline = defaultValue(this.outline, source.outline);
this.outlineColor = defaultValue(this.outlineColor, source.outlineColor);
this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth);
Expand Down
7 changes: 4 additions & 3 deletions Source/DataSources/CheckerboardMaterialProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,10 @@ define([
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

this._definitionChanged = new Event();

this._evenColor = undefined;
this._evenColorSubscription = undefined;

this._oddColor = undefined;
this._oddColorSubscription = undefined;

this._repeat = undefined;
this._repeatSubscription = undefined;

Expand All @@ -67,6 +64,7 @@ define([
Property.isConstant(this._repeat);
}
},

/**
* Gets the event that is raised whenever the definition of this property changes.
* The definition is considered to have changed if a call to getValue would return
Expand All @@ -81,20 +79,23 @@ define([
return this._definitionChanged;
}
},

/**
* Gets or sets the Property specifying the first {@link Color}.
* @memberof CheckerboardMaterialProperty.prototype
* @type {Property}
* @default Color.WHITE
*/
evenColor : createPropertyDescriptor('evenColor'),

/**
* Gets or sets the Property specifying the second {@link Color}.
* @memberof CheckerboardMaterialProperty.prototype
* @type {Property}
* @default Color.BLACK
*/
oddColor : createPropertyDescriptor('oddColor'),

/**
* Gets or sets the {@link Cartesian2} Property specifying how many times the tiles repeat in each direction.
* @memberof CheckerboardMaterialProperty.prototype
Expand Down
3 changes: 3 additions & 0 deletions Source/DataSources/ColorMaterialProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ define([
this._definitionChanged = new Event();
this._color = undefined;
this._colorSubscription = undefined;

this.color = color;
}

Expand All @@ -43,6 +44,7 @@ define([
return Property.isConstant(this._color);
}
},

/**
* Gets the event that is raised whenever the definition of this property changes.
* The definition is considered to have changed if a call to getValue would return
Expand All @@ -57,6 +59,7 @@ define([
return this._definitionChanged;
}
},

/**
* Gets or sets the {@link Color} {@link Property}.
* @memberof ColorMaterialProperty.prototype
Expand Down
70 changes: 35 additions & 35 deletions Source/DataSources/CorridorGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ define([
* @constructor
*
* @param {Object} [options] Object with the following properties:
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the corridor.
* @param {Property} [options.positions] A Property specifying the array of {@link Cartesian3} positions that define the centerline of the corridor.
* @param {Property} [options.width] A numeric Property specifying the distance between the edges of the corridor.
* @param {Property} [options.cornerType=CornerType.ROUNDED] A {@link CornerType} Property specifying the style of the corners.
* @param {Property} [options.height=0] A numeric Property specifying the altitude of the corridor relative to the ellipsoid surface.
* @param {Property} [options.heightReference] A Property specifying what the height is relative to.
* @param {Property} [options.extrudedHeight] A numeric Property specifying the altitude of the corridor's extruded face relative to the ellipsoid surface.
* @param {Property} [options.extrudedHeightReference] A Property specifying what the extrudedHeight is relative to.
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the corridor.
* @param {Property} [options.cornerType=CornerType.ROUNDED] A {@link CornerType} Property specifying the style of the corners.
* @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the distance between each latitude and longitude.
* @param {Property} [options.fill=true] A boolean Property specifying whether the corridor is filled with the provided material.
* @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to fill the corridor.
* @param {Property} [options.outline=false] A boolean Property specifying whether the corridor is outlined.
* @param {Property} [options.outlineColor=Color.BLACK] A Property specifying the {@link Color} of the outline.
* @param {Property} [options.outlineWidth=1.0] A numeric Property specifying the width of the outline.
* @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the distance between each latitude and longitude.
* @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the corridor casts or receives shadows from each light source.
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this corridor will be displayed.
* @param {Property} [options.classificationType=ClassificationType.BOTH] An enum Property specifying whether this corridor will classify terrain, 3D Tiles, or both when on the ground.
Expand All @@ -48,12 +48,13 @@ define([
* @demo {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Corridor.html|Cesium Sandcastle Corridor Demo}
*/
function CorridorGraphics(options) {
this._definitionChanged = new Event();
this._show = undefined;
this._showSubscription = undefined;
this._material = undefined;
this._materialSubscription = undefined;
this._positions = undefined;
this._positionsSubscription = undefined;
this._width = undefined;
this._widthSubscription = undefined;
this._height = undefined;
this._heightSubscription = undefined;
this._heightReference = undefined;
Expand All @@ -62,14 +63,14 @@ define([
this._extrudedHeightSubscription = undefined;
this._extrudedHeightReference = undefined;
this._extrudedHeightReferenceSubscription = undefined;
this._granularity = undefined;
this._granularitySubscription = undefined;
this._width = undefined;
this._widthSubscription = undefined;
this._cornerType = undefined;
this._cornerTypeSubscription = undefined;
this._granularity = undefined;
this._granularitySubscription = undefined;
this._fill = undefined;
this._fillSubscription = undefined;
this._material = undefined;
this._materialSubscription = undefined;
this._outline = undefined;
this._outlineSubscription = undefined;
this._outlineColor = undefined;
Expand All @@ -84,7 +85,6 @@ define([
this._classificationTypeSubscription = undefined;
this._zIndex = undefined;
this._zIndexSubscription = undefined;
this._definitionChanged = new Event();

this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT));
}
Expand All @@ -111,19 +111,18 @@ define([
show : createPropertyDescriptor('show'),

/**
* Gets or sets the Property specifying the material used to fill the corridor.
* Gets or sets a Property specifying the array of {@link Cartesian3} positions that define the centerline of the corridor.
* @memberof CorridorGraphics.prototype
* @type {MaterialProperty}
* @default Color.WHITE
* @type {Property}
*/
material : createMaterialPropertyDescriptor('material'),
positions : createPropertyDescriptor('positions'),

/**
* Gets or sets a Property specifying the array of {@link Cartesian3} positions that define the centerline of the corridor.
* Gets or sets the numeric Property specifying the width of the corridor.
* @memberof CorridorGraphics.prototype
* @type {Property}
*/
positions : createPropertyDescriptor('positions'),
width : createPropertyDescriptor('width'),

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

/**
* Gets or sets the numeric Property specifying the sampling distance between each latitude and longitude point.
* Gets or sets the {@link CornerType} Property specifying how corners are styled.
* @memberof CorridorGraphics.prototype
* @type {Property}
* @default {CesiumMath.RADIANS_PER_DEGREE}
* @default CornerType.ROUNDED
*/
granularity : createPropertyDescriptor('granularity'),
cornerType : createPropertyDescriptor('cornerType'),

/**
* Gets or sets the numeric Property specifying the width of the corridor.
* Gets or sets the numeric Property specifying the sampling distance between each latitude and longitude point.
* @memberof CorridorGraphics.prototype
* @type {Property}
* @default {CesiumMath.RADIANS_PER_DEGREE}
*/
width : createPropertyDescriptor('width'),
granularity : createPropertyDescriptor('granularity'),

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

/**
* Gets or sets the Property specifying the material used to fill the corridor.
* @memberof CorridorGraphics.prototype
* @type {MaterialProperty}
* @default Color.WHITE
*/
material : createMaterialPropertyDescriptor('material'),

/**
* Gets or sets the Property specifying whether the corridor is outlined.
* @memberof CorridorGraphics.prototype
Expand All @@ -205,14 +213,6 @@ define([
*/
outlineWidth : createPropertyDescriptor('outlineWidth'),

/**
* Gets or sets the {@link CornerType} Property specifying how corners are styled.
* @memberof CorridorGraphics.prototype
* @type {Property}
* @default CornerType.ROUNDED
*/
cornerType : createPropertyDescriptor('cornerType'),

/**
* Get or sets the enum Property specifying whether the corridor
* casts or receives shadows from each light source.
Expand Down Expand Up @@ -257,19 +257,19 @@ define([
return new CorridorGraphics(this);
}
result.show = this.show;
result.material = this.material;
result.positions = this.positions;
result.width = this.width;
result.height = this.height;
result.heightReference = this.heightReference;
result.extrudedHeight = this.extrudedHeight;
result.extrudedHeightReference = this.extrudedHeightReference;
result.cornerType = this.cornerType;
result.granularity = this.granularity;
result.width = this.width;
result.fill = this.fill;
result.material = this.material;
result.outline = this.outline;
result.outlineColor = this.outlineColor;
result.outlineWidth = this.outlineWidth;
result.cornerType = this.cornerType;
result.shadows = this.shadows;
result.distanceDisplayCondition = this.distanceDisplayCondition;
result.classificationType = this.classificationType;
Expand All @@ -291,19 +291,19 @@ define([
//>>includeEnd('debug');

this.show = defaultValue(this.show, source.show);
this.material = defaultValue(this.material, source.material);
this.positions = defaultValue(this.positions, source.positions);
this.width = defaultValue(this.width, source.width);
this.height = defaultValue(this.height, source.height);
this.heightReference = defaultValue(this.heightReference, source.heightReference);
this.extrudedHeight = defaultValue(this.extrudedHeight, source.extrudedHeight);
this.extrudedHeightReference = defaultValue(this.extrudedHeightReference, source.extrudedHeightReference);
this.cornerType = defaultValue(this.cornerType, source.cornerType);
this.granularity = defaultValue(this.granularity, source.granularity);
this.width = defaultValue(this.width, source.width);
this.fill = defaultValue(this.fill, source.fill);
this.material = defaultValue(this.material, source.material);
this.outline = defaultValue(this.outline, source.outline);
this.outlineColor = defaultValue(this.outlineColor, source.outlineColor);
this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth);
this.cornerType = defaultValue(this.cornerType, source.cornerType);
this.shadows = defaultValue(this.shadows, source.shadows);
this.distanceDisplayCondition = defaultValue(this.distanceDisplayCondition, source.distanceDisplayCondition);
this.classificationType = defaultValue(this.classificationType, source.classificationType);
Expand Down
Loading

0 comments on commit 2b4d9b3

Please sign in to comment.