Skip to content

Commit

Permalink
Remove a new test (we'll add it later); fix selectOverview function
Browse files Browse the repository at this point in the history
  • Loading branch information
pomadchin committed Apr 1, 2020
1 parent d930be7 commit f62214e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,9 @@ class GeoTiffReprojectRasterSourceSpec extends FunSpec with RasterMatchers with
LayoutDefinition(RasterExtent(LatLng.worldExtent, CellSize(width*3.5, height*3.5)), tileSize = 256)
}

val thriceFuzzySourceAutoHigher = rasterSource.reprojectToGrid(LatLng, thriceFuzzyLayout, NearestNeighbor, AutoHigherResolution).asInstanceOf[GeoTiffReprojectRasterSource]
val thriceFuzzySourceAutoHigher = rasterSource.reprojectToGrid(LatLng, thriceFuzzyLayout, NearestNeighbor).asInstanceOf[GeoTiffReprojectRasterSource]
thriceFuzzySourceAutoHigher.closestTiffOverview.cellSize shouldBe CellSize(20, 20)

val thriceFuzzySourceAuto = rasterSource.reprojectToGrid(LatLng, thriceFuzzyLayout).asInstanceOf[GeoTiffReprojectRasterSource]
thriceFuzzySourceAuto.closestTiffOverview.cellSize.width shouldBe 40.0 +- 0.1
thriceFuzzySourceAuto.closestTiffOverview.cellSize.height shouldBe 40.0 +- 0.1

val quatroFuzzyLayout = {
val CellSize(width, height) = baseReproject.cellSize
LayoutDefinition(RasterExtent(LatLng.worldExtent, CellSize(width*4.1, height*4.1)), tileSize = 256)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ object OverviewStrategy {
overviewCS.indexOf(overviewCS.min)
case AutoHigherResolution =>
val idx = selectIndexByProximity(overviewCS, desiredCS, 1.0)
// AutoHigherResolution defaults to Base if index out of bounds
if (idx >= overviewCS.size) overviewCS.indexOf(overviewCS.min) else idx
// AutoHigherResolution defaults to the closest level
// Out of bounds means, that idx = overviewCS.size + 1
if (idx > overviewCS.size) idx - 1 else idx
}
if (maybeIndex < 0) 0
else if (maybeIndex >= overviewCS.size) overviewCS.size - 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ class OverviewStrategySpec extends FunSpec with Matchers {
selected should be (2)
}

it("should select the base overview if out of bounds") {
it("should select the best matching overview if out of bounds") {
val selected =
OverviewStrategy.selectOverview(availableResolutions, CellSize(32,32), strategy)
selected should be (0)
selected should be (4)
}
}
}

0 comments on commit f62214e

Please sign in to comment.