Skip to content

Commit

Permalink
#6674 rename ApproximateTerrainHeights functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rikku-x committed Oct 19, 2018
1 parent 919ce81 commit 9daba86
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Source/Core/ApproximateTerrainHeights.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ define([
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid
* @return {{minimumTerrainHeight: Number, maximumTerrainHeight: Number}}
*/
ApproximateTerrainHeights.getApproximateTerrainHeights = function(rectangle, ellipsoid) {
ApproximateTerrainHeights.getMinimumMaximumHeights = function(rectangle, ellipsoid) {
//>>includeStart('debug', pragmas.debug);
Check.defined('rectangle', rectangle);
if (!defined(ApproximateTerrainHeights._terrainHeights)) {
Expand Down Expand Up @@ -124,7 +124,7 @@ define([
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid
* @return {BoundingSphere} The result bounding sphere
*/
ApproximateTerrainHeights.getInstanceBoundingSphere = function(rectangle, ellipsoid) {
ApproximateTerrainHeights.getBoundingSphere = function(rectangle, ellipsoid) {
//>>includeStart('debug', pragmas.debug);
Check.defined('rectangle', rectangle);
if (!defined(ApproximateTerrainHeights._terrainHeights)) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/GroundPolylineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ define([
var adjustHeightEndTop = adjustHeightEndTopScratch;

var getHeightsRectangle = Rectangle.fromCartographicArray(getHeightCartographics, getHeightRectangleScratch);
var minMaxHeights = ApproximateTerrainHeights.getApproximateTerrainHeights(getHeightsRectangle, ellipsoid);
var minMaxHeights = ApproximateTerrainHeights.getMinimumMaximumHeights(getHeightsRectangle, ellipsoid);
var minHeight = minMaxHeights.minimumTerrainHeight;
var maxHeight = minMaxHeights.maximumTerrainHeight;

Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/CorridorGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ define([

var extrudedHeightValue = GroundGeometryUpdater.getGeometryExtrudedHeight(extrudedHeight, extrudedHeightReference, Iso8601.MINIMUM_VALUE);
if (extrudedHeightValue === GroundGeometryUpdater.CLAMP_TO_GROUND) {
extrudedHeightValue = ApproximateTerrainHeights.getApproximateTerrainHeights(CorridorGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
extrudedHeightValue = ApproximateTerrainHeights.getMinimumMaximumHeights(CorridorGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
}

options.extrudedHeight = extrudedHeightValue;
Expand Down Expand Up @@ -276,7 +276,7 @@ define([

var extrudedHeightValue = GroundGeometryUpdater.getGeometryExtrudedHeight(extrudedHeight, extrudedHeightReference, time);
if (extrudedHeightValue === GroundGeometryUpdater.CLAMP_TO_GROUND) {
extrudedHeightValue = ApproximateTerrainHeights.getApproximateTerrainHeights(CorridorGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
extrudedHeightValue = ApproximateTerrainHeights.getMinimumMaximumHeights(CorridorGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
}

options.extrudedHeight = extrudedHeightValue;
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/EllipseGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ define([

var extrudedHeightValue = GroundGeometryUpdater.getGeometryExtrudedHeight(extrudedHeight, extrudedHeightReference, Iso8601.MINIMUM_VALUE);
if (extrudedHeightValue === GroundGeometryUpdater.CLAMP_TO_GROUND) {
extrudedHeightValue = ApproximateTerrainHeights.getApproximateTerrainHeights(EllipseGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
extrudedHeightValue = ApproximateTerrainHeights.getMinimumMaximumHeights(EllipseGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
}

options.extrudedHeight = extrudedHeightValue;
Expand Down Expand Up @@ -286,7 +286,7 @@ define([

var extrudedHeightValue = GroundGeometryUpdater.getGeometryExtrudedHeight(extrudedHeight, extrudedHeightReference, time);
if (extrudedHeightValue === GroundGeometryUpdater.CLAMP_TO_GROUND) {
extrudedHeightValue = ApproximateTerrainHeights.getApproximateTerrainHeights(EllipseGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
extrudedHeightValue = ApproximateTerrainHeights.getMinimumMaximumHeights(EllipseGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
}

options.extrudedHeight = extrudedHeightValue;
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/PolygonGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ define([

extrudedHeightValue = GroundGeometryUpdater.getGeometryExtrudedHeight(extrudedHeight, extrudedHeightReference, Iso8601.MINIMUM_VALUE);
if (extrudedHeightValue === GroundGeometryUpdater.CLAMP_TO_GROUND) {
extrudedHeightValue = ApproximateTerrainHeights.getApproximateTerrainHeights(PolygonGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
extrudedHeightValue = ApproximateTerrainHeights.getMinimumMaximumHeights(PolygonGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
}

options.extrudedHeight = extrudedHeightValue;
Expand Down Expand Up @@ -371,7 +371,7 @@ define([

extrudedHeightValue = GroundGeometryUpdater.getGeometryExtrudedHeight(extrudedHeight, extrudedHeightReference, time);
if (extrudedHeightValue === GroundGeometryUpdater.CLAMP_TO_GROUND) {
extrudedHeightValue = ApproximateTerrainHeights.getApproximateTerrainHeights(PolygonGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
extrudedHeightValue = ApproximateTerrainHeights.getMinimumMaximumHeights(PolygonGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
}

options.extrudedHeight = extrudedHeightValue;
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/RectangleGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ define([

var extrudedHeightValue = GroundGeometryUpdater.getGeometryExtrudedHeight(extrudedHeight, extrudedHeightReference, Iso8601.MINIMUM_VALUE);
if (extrudedHeightValue === GroundGeometryUpdater.CLAMP_TO_GROUND) {
extrudedHeightValue = ApproximateTerrainHeights.getApproximateTerrainHeights(RectangleGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
extrudedHeightValue = ApproximateTerrainHeights.getMinimumMaximumHeights(RectangleGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
}

options.extrudedHeight = extrudedHeightValue;
Expand Down Expand Up @@ -283,7 +283,7 @@ define([

var extrudedHeightValue = GroundGeometryUpdater.getGeometryExtrudedHeight(extrudedHeight, extrudedHeightReference, time);
if (extrudedHeightValue === GroundGeometryUpdater.CLAMP_TO_GROUND) {
extrudedHeightValue = ApproximateTerrainHeights.getApproximateTerrainHeights(RectangleGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
extrudedHeightValue = ApproximateTerrainHeights.getMinimumMaximumHeights(RectangleGeometry.computeRectangle(options, scratchRectangle)).minimumTerrainHeight;
}

options.extrudedHeight = extrudedHeightValue;
Expand Down
4 changes: 2 additions & 2 deletions Source/Scene/GroundPrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ define([
}

function setMinMaxTerrainHeights(primitive, rectangle, ellipsoid) {
var result = ApproximateTerrainHeights.getApproximateTerrainHeights(rectangle, ellipsoid);
var result = ApproximateTerrainHeights.getMinimumMaximumHeights(rectangle, ellipsoid);

primitive._minTerrainHeight = result.minimumTerrainHeight;
primitive._maxTerrainHeight = result.maximumTerrainHeight;
Expand Down Expand Up @@ -687,7 +687,7 @@ define([

var id = instance.id;
if (defined(id) && defined(instanceRectangle)) {
var boundingSphere = ApproximateTerrainHeights.getInstanceBoundingSphere(instanceRectangle, ellipsoid);
var boundingSphere = ApproximateTerrainHeights.getBoundingSphere(instanceRectangle, ellipsoid);
this._boundingSpheresKeys.push(id);
this._boundingSpheres.push(boundingSphere);
}
Expand Down
24 changes: 12 additions & 12 deletions Specs/Core/ApproximateTerrainHeightsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,44 @@ defineSuite([
});
});

it('getApproximateTerrainHeights computes minimum and maximum terrain heights', function() {
var result = ApproximateTerrainHeights.getApproximateTerrainHeights(Rectangle.fromDegrees(-121.0, 10.0, -120.0, 11.0));
it('getMinimumMaximumHeights computes minimum and maximum terrain heights', function() {
var result = ApproximateTerrainHeights.getMinimumMaximumHeights(Rectangle.fromDegrees(-121.0, 10.0, -120.0, 11.0));
expect(result.minimumTerrainHeight).toEqualEpsilon(-476.125711887558, CesiumMath.EPSILON10);
expect(result.maximumTerrainHeight).toEqualEpsilon(-28.53441619873047, CesiumMath.EPSILON10);
});

it('getApproximateTerrainHeights throws with no rectangle', function() {
it('getMinimumMaximumHeights throws with no rectangle', function() {
expect(function() {
return ApproximateTerrainHeights.getApproximateTerrainHeights();
return ApproximateTerrainHeights.getMinimumMaximumHeights();
}).toThrowDeveloperError();
});

it('getApproximateTerrainHeights throws if ApproximateTerrainHeights was not initialized first', function() {
it('getMinimumMaximumHeights throws if ApproximateTerrainHeights was not initialized first', function() {
var heights = ApproximateTerrainHeights._terrainHeights;
ApproximateTerrainHeights._terrainHeights = undefined;
expect(function() {
return ApproximateTerrainHeights.getApproximateTerrainHeights(Rectangle.fromDegrees(-121.0, 10.0, -120.0, 11.0));
return ApproximateTerrainHeights.getMinimumMaximumHeights(Rectangle.fromDegrees(-121.0, 10.0, -120.0, 11.0));
});
ApproximateTerrainHeights._terrainHeights = heights;
});

it('getInstanceBoundingSphere computes a bounding sphere', function() {
var result = ApproximateTerrainHeights.getInstanceBoundingSphere(Rectangle.fromDegrees(-121.0, 10.0, -120.0, 11.0));
it('getBoundingSphere computes a bounding sphere', function() {
var result = ApproximateTerrainHeights.getBoundingSphere(Rectangle.fromDegrees(-121.0, 10.0, -120.0, 11.0));
expect(result.center).toEqualEpsilon(new Cartesian3(-3183013.8480289434, -5403772.557261968, 1154581.5817616477), CesiumMath.EPSILON10);
expect(result.radius).toEqualEpsilon(77884.16539096291, CesiumMath.EPSILON10);
});

it('getInstanceBoundingSphere throws with no rectangle', function() {
it('getBoundingSphere throws with no rectangle', function() {
expect(function() {
return ApproximateTerrainHeights.getInstanceBoundingSphere();
return ApproximateTerrainHeights.getBoundingSphere();
}).toThrowDeveloperError();
});

it('getInstanceBoundingSphere throws if ApproximateTerrainHeights was not initialized first', function() {
it('getBoundingSphere throws if ApproximateTerrainHeights was not initialized first', function() {
var heights = ApproximateTerrainHeights._terrainHeights;
ApproximateTerrainHeights._terrainHeights = undefined;
expect(function() {
return ApproximateTerrainHeights.getInstanceBoundingSphere(Rectangle.fromDegrees(-121.0, 10.0, -120.0, 11.0));
return ApproximateTerrainHeights.getBoundingSphere(Rectangle.fromDegrees(-121.0, 10.0, -120.0, 11.0));
});
ApproximateTerrainHeights._terrainHeights = heights;
});
Expand Down

0 comments on commit 9daba86

Please sign in to comment.