Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataSources batch different geometry types together #6239

Merged
merged 5 commits into from
Feb 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ Change Log

### 1.43 - 2018-03-01

##### Breaking Changes :mega:
* Removed `GeometryUpdater.perInstanceColorAppearanceType` and `GeometryUpdater.materialAppearanceType`. [#6239](https://github.com/AnalyticalGraphicsInc/cesium/pull/6239)
* `GeometryVisualizer` no longer uses a `type` parameter. [#6239](https://github.com/AnalyticalGraphicsInc/cesium/pull/6239)
* `GeometryVisualizer` no longer displays polylines. Use `PolylineVisualizer` instead. [#6239](https://github.com/AnalyticalGraphicsInc/cesium/pull/6239)

##### Deprecated :hourglass_flowing_sand:
* In the `Resource` class, `addQueryParameters` and `addTemplateValues` have been deprecated and will be removed in Cesium 1.45. Please use `setQueryParameters` and `setTemplateValues` instead.

##### Additions :tada:
* Added support for a promise to a resource for `CesiumTerrainProvider`, `createTileMapServiceImageryProvider` and `Cesium3DTileset` [#6204](https://github.com/AnalyticalGraphicsInc/cesium/pull/6204)
* Added `Cesium.Math.cbrt`. [#6222](https://github.com/AnalyticalGraphicsInc/cesium/pull/6222)
* Added `PolylineVisualizer` for displaying polyline entities [#6239](https://github.com/AnalyticalGraphicsInc/cesium/pull/6239)
* `Resource` class [#6205](https://github.com/AnalyticalGraphicsInc/cesium/issues/6205)
* Added `put`, `patch`, `delete`, `options` and `head` methods, so it can be used for all XHR requests.
* Added `preserveQueryParameters` parameter to `getDerivedResource`, to allow us to append query parameters instead of always replacing them.
Expand Down
64 changes: 25 additions & 39 deletions Source/DataSources/BoxGeometryUpdater.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
define([
'../Core/BoxGeometry',
'../Core/BoxOutlineGeometry',
'../Core/Check',
'../Core/Color',
'../Core/ColorGeometryInstanceAttribute',
'../Core/defaultValue',
Expand All @@ -26,6 +27,7 @@ define([
], function(
BoxGeometry,
BoxOutlineGeometry,
Check,
Color,
ColorGeometryInstanceAttribute,
defaultValue,
Expand Down Expand Up @@ -76,12 +78,8 @@ define([
*/
function BoxGeometryUpdater(entity, scene) {
//>>includeStart('debug', pragmas.debug);
if (!defined(entity)) {
throw new DeveloperError('entity is required');
}
if (!defined(scene)) {
throw new DeveloperError('scene is required');
}
Check.defined('entity', entity);
Check.defined('scene', scene);
//>>includeEnd('debug');

this._entity = entity;
Expand All @@ -100,29 +98,23 @@ define([
this._shadowsProperty = undefined;
this._distanceDisplayConditionProperty = undefined;
this._options = new GeometryOptions(entity);
this._id = 'box-' + entity.id;

this._onEntityPropertyChanged(entity, 'box', entity.box, undefined);
}

defineProperties(BoxGeometryUpdater, {
defineProperties(BoxGeometryUpdater.prototype, {
/**
* Gets the type of Appearance to use for simple color-based geometry.
* @memberof BoxGeometryUpdater
* @type {Appearance}
* Gets the unique ID associated with this updater
* @memberof BoxGeometryUpdater.prototype
* @type {String}
* @readonly
*/
perInstanceColorAppearanceType : {
value : PerInstanceColorAppearance
id: {
get: function() {
return this._id;
}
},
/**
* Gets the type of Appearance to use for material-based geometry.
* @memberof BoxGeometryUpdater
* @type {Appearance}
*/
materialAppearanceType : {
value : MaterialAppearance
}
});

defineProperties(BoxGeometryUpdater.prototype, {
/**
* Gets the entity associated with this geometry.
* @memberof BoxGeometryUpdater.prototype
Expand Down Expand Up @@ -323,9 +315,7 @@ define([
*/
BoxGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
//>>includeStart('debug', pragmas.debug);
if (!defined(time)) {
throw new DeveloperError('time is required.');
}
Check.defined('time', time);

if (!this._fillEnabled) {
throw new DeveloperError('This instance does not represent a filled geometry.');
Expand Down Expand Up @@ -377,9 +367,7 @@ define([
*/
BoxGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
//>>includeStart('debug', pragmas.debug);
if (!defined(time)) {
throw new DeveloperError('time is required.');
}
Check.defined('time', time);

if (!this._outlineEnabled) {
throw new DeveloperError('This instance does not represent an outlined geometry.');
Expand Down Expand Up @@ -512,13 +500,11 @@ define([
*/
BoxGeometryUpdater.prototype.createDynamicUpdater = function(primitives) {
//>>includeStart('debug', pragmas.debug);
Check.defined('primitives', primitives);

if (!this._dynamic) {
throw new DeveloperError('This instance does not represent dynamic geometry.');
}

if (!defined(primitives)) {
throw new DeveloperError('primitives is required.');
}
//>>includeEnd('debug');

return new DynamicGeometryUpdater(primitives, this);
Expand All @@ -532,13 +518,13 @@ define([
this._primitive = undefined;
this._outlinePrimitive = undefined;
this._geometryUpdater = geometryUpdater;
this._entity = geometryUpdater._entity;
this._options = new GeometryOptions(geometryUpdater._entity);
}

DynamicGeometryUpdater.prototype.update = function(time) {
//>>includeStart('debug', pragmas.debug);
if (!defined(time)) {
throw new DeveloperError('time is required.');
}
Check.defined('time', time);
//>>includeEnd('debug');

var primitives = this._primitives;
Expand All @@ -548,7 +534,7 @@ define([
this._outlinePrimitive = undefined;

var geometryUpdater = this._geometryUpdater;
var entity = geometryUpdater._entity;
var entity = this._entity;
var box = entity.box;
if (!entity.isShowing || !entity.isAvailable(time) || !Property.getValueOrDefault(box.show, time, true)) {
return;
Expand Down Expand Up @@ -625,8 +611,8 @@ define([
}
};

DynamicGeometryUpdater.prototype.getBoundingSphere = function(entity, result) {
return dynamicGeometryGetBoundingSphere(entity, this._primitive, this._outlinePrimitive, result);
DynamicGeometryUpdater.prototype.getBoundingSphere = function(result) {
return dynamicGeometryGetBoundingSphere(this._entity, this._primitive, this._outlinePrimitive, result);
};

DynamicGeometryUpdater.prototype.isDestroyed = function() {
Expand Down
64 changes: 25 additions & 39 deletions Source/DataSources/CorridorGeometryUpdater.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
define([
'../Core/Check',
'../Core/Color',
'../Core/ColorGeometryInstanceAttribute',
'../Core/CorridorGeometry',
Expand Down Expand Up @@ -26,6 +27,7 @@ define([
'./MaterialProperty',
'./Property'
], function(
Check,
Color,
ColorGeometryInstanceAttribute,
CorridorGeometry,
Expand Down Expand Up @@ -85,12 +87,8 @@ define([
*/
function CorridorGeometryUpdater(entity, scene) {
//>>includeStart('debug', pragmas.debug);
if (!defined(entity)) {
throw new DeveloperError('entity is required');
}
if (!defined(scene)) {
throw new DeveloperError('scene is required');
}
Check.defined('entity', entity);
Check.defined('scene', scene);
//>>includeEnd('debug');

this._entity = entity;
Expand All @@ -111,30 +109,23 @@ define([
this._distanceDisplayConditionProperty = undefined;
this._onTerrain = false;
this._options = new GeometryOptions(entity);
this._id = 'corridor-' + entity.id;

this._onEntityPropertyChanged(entity, 'corridor', entity.corridor, undefined);
}

defineProperties(CorridorGeometryUpdater, {
defineProperties(CorridorGeometryUpdater.prototype, {
/**
* Gets the type of Appearance to use for simple color-based geometry.
* @memberof CorridorGeometryUpdater
* @type {Appearance}
* Gets the unique ID associated with this updater
* @memberof CorridorGeometryUpdater.prototype
* @type {String}
* @readonly
*/
perInstanceColorAppearanceType : {
value : PerInstanceColorAppearance
id: {
get: function() {
return this._id;
}
},
/**
* Gets the type of Appearance to use for material-based geometry.
* @memberof CorridorGeometryUpdater
* @type {Appearance}
*/
materialAppearanceType : {
value : MaterialAppearance
}
});

defineProperties(CorridorGeometryUpdater.prototype, {
/**
* Gets the entity associated with this geometry.
* @memberof CorridorGeometryUpdater.prototype
Expand Down Expand Up @@ -349,9 +340,7 @@ define([
*/
CorridorGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
//>>includeStart('debug', pragmas.debug);
if (!defined(time)) {
throw new DeveloperError('time is required.');
}
Check.defined('time', time);

if (!this._fillEnabled) {
throw new DeveloperError('This instance does not represent a filled geometry.');
Expand Down Expand Up @@ -401,9 +390,7 @@ define([
*/
CorridorGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
//>>includeStart('debug', pragmas.debug);
if (!defined(time)) {
throw new DeveloperError('time is required.');
}
Check.defined('time', time);

if (!this._outlineEnabled) {
throw new DeveloperError('This instance does not represent an outlined geometry.');
Expand Down Expand Up @@ -558,13 +545,12 @@ define([
*/
CorridorGeometryUpdater.prototype.createDynamicUpdater = function(primitives, groundPrimitives) {
//>>includeStart('debug', pragmas.debug);
Check.defined('primitives', primitives);
Check.defined('groundPrimitives', groundPrimitives);

if (!this._dynamic) {
throw new DeveloperError('This instance does not represent dynamic geometry.');
}

if (!defined(primitives)) {
throw new DeveloperError('primitives is required.');
}
//>>includeEnd('debug');

return new DynamicGeometryUpdater(primitives, groundPrimitives, this);
Expand All @@ -580,12 +566,12 @@ define([
this._outlinePrimitive = undefined;
this._geometryUpdater = geometryUpdater;
this._options = new GeometryOptions(geometryUpdater._entity);
this._entity = geometryUpdater._entity;
}

DynamicGeometryUpdater.prototype.update = function(time) {
//>>includeStart('debug', pragmas.debug);
if (!defined(time)) {
throw new DeveloperError('time is required.');
}
Check.defined('time', time);
//>>includeEnd('debug');

var geometryUpdater = this._geometryUpdater;
Expand All @@ -602,7 +588,7 @@ define([
}
this._primitive = undefined;

var entity = geometryUpdater._entity;
var entity = this._entity;
var corridor = entity.corridor;
if (!entity.isShowing || !entity.isAvailable(time) || !Property.getValueOrDefault(corridor.show, time, true)) {
return;
Expand Down Expand Up @@ -701,8 +687,8 @@ define([
}
};

DynamicGeometryUpdater.prototype.getBoundingSphere = function(entity, result) {
return dynamicGeometryGetBoundingSphere(entity, this._primitive, this._outlinePrimitive, result);
DynamicGeometryUpdater.prototype.getBoundingSphere = function(result) {
return dynamicGeometryGetBoundingSphere(this._entity, this._primitive, this._outlinePrimitive, result);
};

DynamicGeometryUpdater.prototype.isDestroyed = function() {
Expand Down
Loading