Skip to content

Commit

Permalink
Changes after review.
Browse files Browse the repository at this point in the history
Better short circuting of branch logic in visualizers when an entity is not being displayed.
  • Loading branch information
mramato committed Jul 18, 2014
1 parent 1d09da6 commit 5205099
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
12 changes: 8 additions & 4 deletions Source/DataSources/BillboardVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,16 @@ define([
return;
}

position = Property.getValueOrUndefined(entity._position, time, position);
var textureValue = Property.getValueOrUndefined(billboardGraphics._image, time);

var textureValue;
var billboard;
var billboardVisualizerIndex = entity._billboardVisualizerIndex;
var show = defined(position) && defined(textureValue) && entity.isAvailable(time) && Property.getValueOrDefault(billboardGraphics._show, time, true);
var show = entity.isAvailable(time) && Property.getValueOrDefault(billboardGraphics._show, time, true);

if (show) {
position = Property.getValueOrUndefined(entity._position, time, position);
textureValue = Property.getValueOrUndefined(billboardGraphics._image, time);
show = defined(position) && defined(textureValue);
}

if (!show) {
//don't bother creating or updating anything else
Expand Down
12 changes: 8 additions & 4 deletions Source/DataSources/LabelVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,16 @@ define([
return;
}

position = Property.getValueOrUndefined(entity._position, time, position);
var text = Property.getValueOrUndefined(labelGraphics._text, time);

var text;
var label;
var labelVisualizerIndex = entity._labelVisualizerIndex;
var show = defined(position) && defined(text) && entity.isAvailable(time) && Property.getValueOrDefault(labelGraphics._show, time, true);
var show = entity.isAvailable(time) && Property.getValueOrDefault(labelGraphics._show, time, true);

if (show) {
position = Property.getValueOrUndefined(entity._position, time, position);
text = Property.getValueOrUndefined(labelGraphics._text, time);
show = defined(position) && defined(text);
}

if (!show) {
//don't bother creating or updating anything else
Expand Down
12 changes: 8 additions & 4 deletions Source/DataSources/ModelVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,16 @@ define([
return;
}

position = Property.getValueOrUndefined(entity._position, time, position);
var uri = Property.getValueOrUndefined(modelGraphics._uri, time);

var uri;
var modelHash = this._modelHash;
var modelData = modelHash[entity.id];
var show = defined(position) && defined(uri) && entity.isAvailable(time) && Property.getValueOrDefault(modelGraphics._show, time, true);
var show = entity.isAvailable(time) && Property.getValueOrDefault(modelGraphics._show, time, true);

if (show) {
position = Property.getValueOrUndefined(entity._position, time, position);
uri = Property.getValueOrUndefined(modelGraphics._uri, time);
show = defined(position) && defined(uri);
}

if (!show) {
if (defined(modelData)) {
Expand Down
5 changes: 1 addition & 4 deletions Source/DataSources/PointVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,9 @@ define([
return;
}

position = Property.getValueOrUndefined(entity._position, time, position);

var billboard;
var pointVisualizerIndex = entity._pointVisualizerIndex;
var show = entity.isAvailable(time) && defined(position) && Property.getValueOrDefault(pointGraphics._show, time, true);

var show = entity.isAvailable(time) && Property.getValueOrDefault(pointGraphics._show, time, true) && defined(Property.getValueOrUndefined(entity._position, time, position));
if (!show) {
//don't bother creating or updating anything else
if (defined(pointVisualizerIndex)) {
Expand Down

0 comments on commit 5205099

Please sign in to comment.