Skip to content

Commit

Permalink
heightSampled -> sampleSuccess.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Sep 27, 2024
1 parent 8d5c9da commit f23191f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Runtime/CesiumSampleHeightResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class CesiumSampleHeightResult
/// values from its input. Its height will either be the height sampled from
/// the tileset at that position, or the original input height if the sample
/// was unsuccessful. To determine which, look at the value of
/// <see cref="CesiumSampleHeightResult.heightSampled"/> at the same index.
/// <see cref="CesiumSampleHeightResult.sampleSuccess"/> at the same index.
/// </para>
/// <para>
/// The returned height is measured from the ellipsoid (usually WGS84) and
Expand All @@ -37,7 +37,7 @@ public class CesiumSampleHeightResult
/// the height sampled from the tileset. If false, the height could not be sampled for
/// the position, so its height is the same as the original input height.
/// </remarks>
public bool[] heightSampled { get; set; }
public bool[] sampleSuccess { get; set; }

/// <summary>
/// Any warnings that occurred while sampling heights.
Expand Down
2 changes: 1 addition & 1 deletion Runtime/ConfigureReinterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ Cesium3DTilesetLoadFailureDetails tilesetDetails
promise.SetException(new Exception("message"));
CesiumSampleHeightResult result = new CesiumSampleHeightResult();
result.longitudeLatitudeHeightPositions = null;
result.heightSampled = null;
result.sampleSuccess = null;
result.warnings = null;
promise.SetResult(result);
Task<CesiumSampleHeightResult> task = promise.Task;
Expand Down
24 changes: 12 additions & 12 deletions Tests/TestCesium3DTileset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public IEnumerator SampleHeightMostDetailedWorksWithAnEmptyArrayOfPositions()
CesiumSampleHeightResult result = task.Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.longitudeLatitudeHeightPositions);
Assert.IsNotNull(result.heightSampled);
Assert.IsNotNull(result.sampleSuccess);
Assert.IsNotNull(result.warnings);
Assert.AreEqual(result.longitudeLatitudeHeightPositions.Length, 0);
Assert.AreEqual(result.heightSampled.Length, 0);
Assert.AreEqual(result.sampleSuccess.Length, 0);
Assert.AreEqual(result.warnings.Length, 0);
}

Expand All @@ -54,13 +54,13 @@ public IEnumerator SampleHeightMostDetailedWorksWithASinglePosition()
CesiumSampleHeightResult result = task.Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.longitudeLatitudeHeightPositions);
Assert.IsNotNull(result.heightSampled);
Assert.IsNotNull(result.sampleSuccess);
Assert.IsNotNull(result.warnings);
Assert.AreEqual(result.longitudeLatitudeHeightPositions.Length, 1);
Assert.AreEqual(result.heightSampled.Length, 1);
Assert.AreEqual(result.sampleSuccess.Length, 1);
Assert.AreEqual(result.warnings.Length, 0);

Assert.AreEqual(result.heightSampled[0], true);
Assert.AreEqual(result.sampleSuccess[0], true);
Assert.AreEqual(result.longitudeLatitudeHeightPositions[0].x, -105.1, 1e-12);
Assert.AreEqual(result.longitudeLatitudeHeightPositions[0].y, 40.1, 1e-12);
// Returned height should be different from the original height (1.0) by at least one meter.
Expand Down Expand Up @@ -88,19 +88,19 @@ public IEnumerator SampleHeightMostDetailedWorksWithMultiplePositions()
CesiumSampleHeightResult result = task.Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.longitudeLatitudeHeightPositions);
Assert.IsNotNull(result.heightSampled);
Assert.IsNotNull(result.sampleSuccess);
Assert.IsNotNull(result.warnings);
Assert.AreEqual(result.longitudeLatitudeHeightPositions.Length, 2);
Assert.AreEqual(result.heightSampled.Length, 2);
Assert.AreEqual(result.sampleSuccess.Length, 2);
Assert.AreEqual(result.warnings.Length, 0);

Assert.AreEqual(result.heightSampled[0], true);
Assert.AreEqual(result.sampleSuccess[0], true);
Assert.AreEqual(result.longitudeLatitudeHeightPositions[0].x, -105.1, 1e-12);
Assert.AreEqual(result.longitudeLatitudeHeightPositions[0].y, 40.1, 1e-12);
// Returned height should be different from the original height (1.0) by at least one meter.
Assert.IsTrue(math.abs(result.longitudeLatitudeHeightPositions[0].z - 1.0) > 1.0);

Assert.AreEqual(result.heightSampled[1], true);
Assert.AreEqual(result.sampleSuccess[1], true);
Assert.AreEqual(result.longitudeLatitudeHeightPositions[1].x, 105.1, 1e-12);
Assert.AreEqual(result.longitudeLatitudeHeightPositions[1].y, -40.1, 1e-12);
// Returned height should be different from the original height (1.0) by at least one meter.
Expand All @@ -127,13 +127,13 @@ public IEnumerator SampleHeightMostDetailedIndicatesNotSampledForPositionOutside
CesiumSampleHeightResult result = task.Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.longitudeLatitudeHeightPositions);
Assert.IsNotNull(result.heightSampled);
Assert.IsNotNull(result.sampleSuccess);
Assert.IsNotNull(result.warnings);
Assert.AreEqual(result.longitudeLatitudeHeightPositions.Length, 1);
Assert.AreEqual(result.heightSampled.Length, 1);
Assert.AreEqual(result.sampleSuccess.Length, 1);
Assert.AreEqual(result.warnings.Length, 0);

Assert.AreEqual(result.heightSampled[0], false);
Assert.AreEqual(result.sampleSuccess[0], false);
Assert.AreEqual(result.longitudeLatitudeHeightPositions[0].x, 151.20972, 1e-12);
Assert.AreEqual(result.longitudeLatitudeHeightPositions[0].y, -33.87100, 1e-12);
Assert.AreEqual(result.longitudeLatitudeHeightPositions[0].z, 1.0, 1e-12);
Expand Down
2 changes: 1 addition & 1 deletion native~/Runtime/src/Cesium3DTilesetImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ Cesium3DTilesetImpl::SampleHeightMostDetailed(

CesiumForUnity::CesiumSampleHeightResult unityResult;
unityResult.longitudeLatitudeHeightPositions(positions);
unityResult.heightSampled(heightSampled);
unityResult.sampleSuccess(heightSampled);
unityResult.warnings(warnings);

promise.SetResult(unityResult);
Expand Down

0 comments on commit f23191f

Please sign in to comment.