diff --git a/src/main/java/org/orekit/rugged/raster/EarthHemisphere.java b/src/main/java/org/orekit/rugged/raster/EarthHemisphere.java index d445482f2e27ad429b8e63caa18d8b0fdb909bd5..c670938f0a3b524e5cd3ef623bcf0287da3d646c 100644 --- a/src/main/java/org/orekit/rugged/raster/EarthHemisphere.java +++ b/src/main/java/org/orekit/rugged/raster/EarthHemisphere.java @@ -7,6 +7,7 @@ package org.orekit.rugged.raster; * <p> * For Longitude: WESTEXTREME / WEST / EAST / EASTEXTREME * @author Guylaine Prat + * @since X.x */ public enum EarthHemisphere { diff --git a/src/main/java/org/orekit/rugged/raster/Tile.java b/src/main/java/org/orekit/rugged/raster/Tile.java index 146ffe92dea3e81de311316a2ae4ec4e3183f157..cf2701eb89a51429041a09dfbd33935bfa2d654a 100644 --- a/src/main/java/org/orekit/rugged/raster/Tile.java +++ b/src/main/java/org/orekit/rugged/raster/Tile.java @@ -289,6 +289,8 @@ public interface Tile extends UpdatableTile { */ Location getLocation(double latitude, double longitude); + + // TODO GP check if useful ... /** Get tile neighborhood (in case the DEM tiles are not overlapping). * <p> * TBN: used to create zipper tiles in case of DEM with tiles not overlapping. diff --git a/src/main/java/org/orekit/rugged/raster/TilesCache.java b/src/main/java/org/orekit/rugged/raster/TilesCache.java index e493f7a6f9142ae46a7cad03e59241822baf9dfb..8fabf26aa2310297e7fc8da6ecbae0a1fe5ed4b4 100644 --- a/src/main/java/org/orekit/rugged/raster/TilesCache.java +++ b/src/main/java/org/orekit/rugged/raster/TilesCache.java @@ -116,18 +116,18 @@ public class TilesCache<T extends Tile> { if ( !isOvelapping ) { // DEM with seamless tiles (no overlapping) - // Check if the tile HAS INTERPOLATION NEIGHBORS (the (latitude, longitude) is inside the tile) - // otherwise the (latitude, longitude) is on the edge of the tile: one must create a zipper tile - // because tiles are not overlapping ... - final Tile.Location location = tile.getLocation(latitude, longitude); + // Check if the tile HAS INTERPOLATION NEIGHBORS (the point (latitude, longitude) is inside the tile), + // otherwise the point (latitude, longitude) is on the edge of the tile: + // one must create a zipper tile because tiles are not overlapping ... + final Tile.Location pointLocation = tile.getLocation(latitude, longitude); - // TODO GP final Tile.Location neighborhood = tile.checkNeighborhood(latitude, longitude); + // TODO GP check if useful: final Tile.Location neighborhood = tile.checkNeighborhood(latitude, longitude); // We are on the edge of the tile - if (location != Tile.Location.HAS_INTERPOLATION_NEIGHBORS) { + if (pointLocation != Tile.Location.HAS_INTERPOLATION_NEIGHBORS) { // Create a "zipper tile" - return createZipperTile(latitude, longitude, tile, location); + return createZipperTile(tile, latitude, longitude, pointLocation); } else { // we are not on the edge of the tile @@ -153,6 +153,7 @@ public class TilesCache<T extends Tile> { * @param latitude latitude of the desired tile (rad) * @param longitude longitude of the desired tile (rad) * @return the tile + * @since X.x */ private T createTile(final double latitude, final double longitude) { @@ -174,13 +175,24 @@ public class TilesCache<T extends Tile> { return tile; } - private T createZipperTile(final double latitude, final double longitude, - final T currentTile, final Tile.Location location) { + + /** Create a zipper tile for DEM with seamless tiles (no overlapping) + * @param currentTile current tile + * @param latitude ground point latitude (rad) + * @param longitude ground point longitude (rad) + * @param pointLocation ground point location with respect to the tile + * @return zipper tile covering the ground point + * @since X.x + */ + private T createZipperTile(final T currentTile, + final double latitude, final double longitude, + final Tile.Location pointLocation) { T zipperTile = null; - // One must create a zipper tile between this tile and the neighbor tile - switch (location) { + // One must create a zipper tile between this tile and the neighbor tile + // according to the ground point location + switch (pointLocation) { case NORTH: // latitudeIndex > latitudeRows - 2 @@ -223,8 +235,11 @@ public class TilesCache<T extends Tile> { break; default: - System.out.println("Location= " + location + " => Case not yet implemented"); + // TODO AFAC + System.out.println("Point location= " + pointLocation + " => Case not yet implemented"); return null; +// // impossible to reach +// throw new RuggedException(RuggedMessages.INTERNAL_ERROR); } // end switch @@ -238,13 +253,22 @@ public class TilesCache<T extends Tile> { } /** Initialize the zipper tile for a given geometry and the full set of elevations + * @param zipperLatitudeMin + * @param zipperLongitudeMin + * @param zipperLatitudeStep + * @param zipperLongitudeStep + * @param zipperLatitudeRows + * @param zipperLongitudeColumns + * @param zipperElevations + * @return the zipper tile + * @since X.x */ private T initializeZipperTile(final double zipperLatitudeMin, final double zipperLongitudeMin, final double zipperLatitudeStep, final double zipperLongitudeStep, final int zipperLatitudeRows, final int zipperLongitudeColumns, final double[][] zipperElevations) { -// Tile zipperTile = new ZipperTile(); + // Create an empty tile final T zipperTile = factory.createTile(); // Set the tile geometry @@ -264,14 +288,104 @@ public class TilesCache<T extends Tile> { return zipperTile; } + + private T createZipperNorthOrSouth(final EarthHemisphere latitudeHemisphere, final double longitude, final T tile) { + + final int latitudeRows = tile.getLatitudeRows(); + final int longitudeCols = tile.getLongitudeColumns(); + final double latStep = tile.getLatitudeStep(); + final double lonStep = tile.getLongitudeStep(); + final double minLat = tile.getMinimumLatitude(); + + // Get the North or South tile + final T tileNorthOrSouth = createNorthOrSouthTile(latitudeHemisphere, longitude, minLat, latitudeRows, latStep); + + // TODO AFAC ################ + switch (latitudeHemisphere) { + case NORTH: + tilePrint(tileNorthOrSouth, "North tile:"); + break; + case SOUTH: + tilePrint(tileNorthOrSouth, "South tile:"); + break; + default: + // impossible to reach + throw new RuggedException(RuggedMessages.INTERNAL_ERROR); + } + + + // If NORTH hemisphere: + // Create zipper tile between the current tile and the North tile; + // 2 rows belong to the North part of the origin/current tile + // 2 rows belong to the South part of the North tile + + // If SOUTH hemisphere: + // Create zipper tile between the current tile and the South tile; + // 2 rows belong to the South part of the origin/current tile + // 2 rows belong to the North part of the South tile + + // TODO we suppose here the 2 tiles have same origin, step and size along longitude + + double zipperLatStep = latStep; + int zipperLatRows = 4; + + int zipperLonCols = longitudeCols; + + double zipperLatMin; + double[][] elevations; + switch (latitudeHemisphere) { + case NORTH: + zipperLatMin = minLat + (latitudeRows - 2)*latStep; + + elevations = getZipperNorthSouthElevations(zipperLatRows, zipperLonCols, + tileNorthOrSouth, tile, latitudeRows); + break; + + case SOUTH: + zipperLatMin = minLat - 2*latStep; + + elevations= getZipperNorthSouthElevations(zipperLatRows, zipperLonCols, + tile, tileNorthOrSouth, latitudeRows); + break; + + default: + // impossible to reach + throw new RuggedException(RuggedMessages.INTERNAL_ERROR); + } + + final T zipperNorthOrSouth = initializeZipperTile(zipperLatMin, tile.getMinimumLongitude(), + zipperLatStep, lonStep, + zipperLatRows, zipperLonCols, elevations); + + // TODO AFAC ################ + switch (latitudeHemisphere) { + case NORTH: + tilePrint(zipperNorthOrSouth, "NORTH Zipper tile:"); + break; + case SOUTH: + tilePrint(zipperNorthOrSouth, "SOUTH Zipper tile:"); + break; + default: + // impossible to reach + throw new RuggedException(RuggedMessages.INTERNAL_ERROR); + } +// printTileFile(tileZipperNorth, "Plots/Zipper_lat_"); + // ################ + + return zipperNorthOrSouth; + } + /** Create the zipper tile between the current tile and the Northern tile of the current tile * for a given longitude * @param longitude given longitude (rad) * @param tile current tile - * @return northern tile of the current tile + * @return northern zipper tile of the current tile + * @since X.x */ private T createZipperNorth(final double longitude, final T tile) { + //TODO GP check if can be put in common with createZipperSouth ?? + final int latitudeRows = tile.getLatitudeRows(); final int longitudeCols = tile.getLongitudeColumns(); final double latStep = tile.getLatitudeStep(); @@ -300,8 +414,8 @@ public class TilesCache<T extends Tile> { tileNorth, tile, latitudeRows); final T zipperNorth = initializeZipperTile(zipperLatMin, tile.getMinimumLongitude(), - zipperLatStep, lonStep, - zipperLatRows, zipperLonCols, elevations); + zipperLatStep, lonStep, + zipperLatRows, zipperLonCols, elevations); // TODO AFAC ################ tilePrint(zipperNorth, "NORTH Zipper tile:"); // printTileFile(tileZipperNorth, "Plots/Zipper_lat_"); @@ -314,7 +428,8 @@ public class TilesCache<T extends Tile> { * for a given longitude * @param longitude given longitude (rad) * @param tile current tile - * @return southern tile of the current tile + * @return southern zipper tile of the current tile + * @since X.x */ private T createZipperSouth(final double longitude, final T tile) { @@ -361,8 +476,8 @@ public class TilesCache<T extends Tile> { tile, tileSouth, latitudeRows); final T zipperSouth = initializeZipperTile(zipperLatMin, tile.getMinimumLongitude(), - zipperLatStep, lonStep, - zipperLatRows, zipperLonCols, elevations); + zipperLatStep, lonStep, + zipperLatRows, zipperLonCols, elevations); // TODO AFAC ################ tilePrint(zipperSouth, "SOUTH Zipper tile:"); // printTileFile(zipperSouth, "Plots/Zipper_lat_"); @@ -372,12 +487,13 @@ public class TilesCache<T extends Tile> { } /** Get the elevations for the zipper tile between a northern and a southern tiles - * @param zipperLatRows - * @param zipperLonCols + * @param zipperLatRows number of rows in latitude + * @param zipperLonCols number of column in longitude * @param northernTile the tile which is the northern * @param southernTile the tile which is the southern * @param southernLatRows latitude rows of the southern tile - * @return the elevations to fill in the zipper tile between a northern and a southern tiles + * @return the elevations to fill in the zipper tile between a northern and a southern tiles + * @since X.x */ private double[][] getZipperNorthSouthElevations(int zipperLatRows, int zipperLonCols, final T northernTile, final T southernTile, @@ -405,10 +521,13 @@ public class TilesCache<T extends Tile> { * for a given latitude * @param latitude given latitude (rad) * @param tile current tile - * @return western tile of the current tile + * @return western zipper tile of the current tile + * @since X.x */ private T createZipperWest(final double latitude, final T tile) { + //TODO GP check if can be put in common with createZipperEast ?? + final int latitudeRows = tile.getLatitudeRows(); final int longitudeCols = tile.getLongitudeColumns(); final double latStep = tile.getLatitudeStep(); @@ -466,7 +585,8 @@ public class TilesCache<T extends Tile> { * for a given latitude * @param latitude given latitude (rad) * @param tile current tile - * @return eastern tile of the current tile + * @return eastern zipper tile of the current tile + * @since X.x */ private T createZipperEast(final double latitude, final T tile) { @@ -523,14 +643,15 @@ public class TilesCache<T extends Tile> { return zipperEast; } - /** Get the elevations for the zipper tile between a eastern and a western tiles - * @param zipperLatRows - * @param zipperLonCols - * @param easternTile the tile which is the eastern - * @param westernTile the tile which is the western - * @param westernLonCols longitude columns of the western tile - * @return the elevations to fill in the zipper tile between a eastern and a western tiles - */ + /** Get the elevations for the zipper tile between a eastern and a western tiles + * @param zipperLatRows number of rows in latitude + * @param zipperLonCols number of column in longitude + * @param easternTile the tile which is the eastern + * @param westernTile the tile which is the western + * @param westernLonCols longitude columns of the western tile + * @return the elevations to fill in the zipper tile between a eastern and a western tiles + * @since X.x + */ private double[][] getZipperEastWestElevations(int zipperLatRows, int zipperLonCols, final T easternTile, final T westernTile, final int westernLonCols) { @@ -553,6 +674,18 @@ public class TilesCache<T extends Tile> { return elevations; } + /** Create a corner zipper tile + * @param zipperCorner zipper tile point at minimum latitude and minimum longitude + * @param zipperLatStep latitude step (rad) + * @param zipperLonStep longitude step (rad) + * @param currentTile current tile + * @param belowLeftTile below left tile + * @param aboveLeftTile above left tile + * @param belowRightTile below right tile + * @param aboveRightTile above right tile + * @return corner zipper tile + * @since X.x + */ private T createCornerZipper(final GeodeticPoint zipperCorner, final double zipperLatStep, final double zipperLonStep, final T currentTile, @@ -563,7 +696,9 @@ public class TilesCache<T extends Tile> { final int zipperLonCols = 4; double[][] elevations = new double[zipperLatRows][zipperLonCols]; - // rows 0 and 1 of zipper: 2 first cells belong to the below left tile and 2 last cells to the below right tile + // rows 0 and 1 of zipper: + // 2 first cells belong to the below left tile and 2 last cells to the below right tile + // row 0 elevations[0][0] = belowLeftTile.getElevationAtIndices(belowLeftTile.getLatitudeRows() - 2, belowLeftTile.getLongitudeColumns() - 2); elevations[0][1] = belowLeftTile.getElevationAtIndices(belowLeftTile.getLatitudeRows() - 2, belowLeftTile.getLongitudeColumns() - 1); @@ -578,7 +713,9 @@ public class TilesCache<T extends Tile> { elevations[1][2] = belowRightTile.getElevationAtIndices(belowRightTile.getLatitudeRows() - 1, 0); elevations[1][3] = belowRightTile.getElevationAtIndices(belowRightTile.getLatitudeRows() - 1, 1); - // rows 2 and 3 of zipper: 2 first cells belong to the above left tile and 2 last cells to the above right tile + // rows 2 and 3 of zipper: + // 2 first cells belong to the above left tile and 2 last cells to the above right tile + // row 2 elevations[2][0] = aboveLeftTile.getElevationAtIndices(0, aboveLeftTile.getLongitudeColumns() - 2); elevations[2][1] = aboveLeftTile.getElevationAtIndices(0, aboveLeftTile.getLongitudeColumns() - 1); @@ -604,8 +741,15 @@ public class TilesCache<T extends Tile> { return cornerZipperTile; } - private T createCornerZipperNorthWest(final double latitude, final double longitude, final T currentTile) { - + /** Create the North West corner zipper tile + * @param latitude ground point latitude (rad) + * @param longitude ground point longitude (rad) + * @param currentTile current tile + * @return the North West corner zipper tile + * @since X.x + */ + private T createCornerZipperNorthWest(final double latitude, final double longitude, final T currentTile) { + final int latitudeRows = currentTile.getLatitudeRows(); final int longitudeCols = currentTile.getLongitudeColumns(); final double latStep = currentTile.getLatitudeStep(); @@ -642,7 +786,14 @@ public class TilesCache<T extends Tile> { } - private T createCornerZipperNorthEast(final double latitude, final double longitude, final T currentTile) { + /** Create the North East corner zipper tile + * @param latitude ground point latitude (rad) + * @param longitude ground point longitude (rad) + * @param currentTile current tile + * @return the North East corner zipper tile + * @since X.x + */ + private T createCornerZipperNorthEast(final double latitude, final double longitude, final T currentTile) { final int latitudeRows = currentTile.getLatitudeRows(); final int longitudeCols = currentTile.getLongitudeColumns(); @@ -679,7 +830,14 @@ public class TilesCache<T extends Tile> { currentTile, belowLeftTile, aboveLeftTile, belowRightTile, aboveRightTile); } - private T createCornerZipperSouthWest(final double latitude, final double longitude, final T currentTile) { + /** Create the South West corner zipper tile + * @param latitude ground point latitude (rad) + * @param longitude ground point longitude (rad) + * @param currentTile current tile + * @return the South West corner zipper tile + * @since X.x + */ + private T createCornerZipperSouthWest(final double latitude, final double longitude, final T currentTile) { final int latitudeRows = currentTile.getLatitudeRows(); final int longitudeCols = currentTile.getLongitudeColumns(); @@ -716,7 +874,14 @@ public class TilesCache<T extends Tile> { currentTile, belowLeftTile, aboveLeftTile, belowRightTile, aboveRightTile); } - private T createCornerZipperSouthEast(final double latitude, final double longitude, final T currentTile) { + /** Create the South East corner zipper tile + * @param latitude ground point latitude (rad) + * @param longitude ground point longitude (rad) + * @param currentTile current tile + * @return the South East corner zipper tile + * @since X.x + */ + private T createCornerZipperSouthEast(final double latitude, final double longitude, final T currentTile) { final int latitudeRows = currentTile.getLatitudeRows(); final int longitudeCols = currentTile.getLongitudeColumns(); @@ -753,22 +918,23 @@ public class TilesCache<T extends Tile> { currentTile, belowLeftTile, aboveLeftTile, belowRightTile, aboveRightTile); } - /** - * Create the tile in intercardinal direction of the current Tile i.e. NW, NE, SW, SE - * @param latitudeHemisphere - * @param minLat - * @param latitudeRows - * @param latStep - * @param longitudeHemisphere - * @param minLon - * @param longitudeCols - * @param lonStep - * @return - */ - private T createIntercardinalTile(final EarthHemisphere latitudeHemisphere, - final double minLat, final int latitudeRows, final double latStep, - final EarthHemisphere longitudeHemisphere, - final double minLon, final int longitudeCols, final double lonStep) { + /** + * Create the tile in intercardinal direction of the current Tile i.e. NW, NE, SW, SE + * @param latitudeHemisphere hemisphere for latitude: NORTH / SOUTH + * @param minLat latitude minimum for the tile (rad) + * @param latitudeRows latitude rows + * @param latStep latitude step (rad) + * @param longitudeHemisphere hemisphere for longitude : WEST / EAST + * @param minLon longitude minimum for the tile (rad) + * @param longitudeCols longitude columns + * @param lonStep longitude step (rad) + * @return the tile in intercardinal direction + * @since X.x + */ + private T createIntercardinalTile(final EarthHemisphere latitudeHemisphere, + final double minLat, final int latitudeRows, final double latStep, + final EarthHemisphere longitudeHemisphere, + final double minLon, final int longitudeCols, final double lonStep) { // lonHemisphere = +1 : East or = -1 : West int lonHemisphere; @@ -805,10 +971,22 @@ public class TilesCache<T extends Tile> { } - private GeodeticPoint computeZipperOrigin(final EarthHemisphere latitudeHemisphere, - final double minLat, final int latitudeRows, final double latStep, - final EarthHemisphere longitudeHemisphere, - final double minLon, final int longitudeCols, final double lonStep) { + /** Compute the zipper tile origin + * @param latitudeHemisphere latitude hemisphere + * @param minLat zipper tile latitude origin (rad) + * @param latitudeRows latitude rows + * @param latStep latitude step (rad) + * @param longitudeHemisphere longitude hemisphere + * @param minLon zipper tile longitude origin (rad) + * @param longitudeCols longitude columns + * @param lonStep longitude step (rad) + * @return zipper tile origin point + * @since X.x + */ + private GeodeticPoint computeZipperOrigin(final EarthHemisphere latitudeHemisphere, + final double minLat, final int latitudeRows, final double latStep, + final EarthHemisphere longitudeHemisphere, + final double minLon, final int longitudeCols, final double lonStep) { double addLon; switch (longitudeHemisphere) { @@ -843,18 +1021,19 @@ public class TilesCache<T extends Tile> { } /** Create the Northern or Southern tile of a given tile defined by minLat, longitude, latitudeRows and latStep - * @param earthHemisphere - * @param longitude - * @param minLat - * @param latitudeRows - * @param latStep - * @return + * @param latitudeHemisphere latitude hemisphere + * @param longitude longitude to define the tile (rad) + * @param minLat minimum latitude to define the tile (rad) + * @param latitudeRows latitude rows + * @param latStep latitude step (rad) + * @return North or South tile according to the Earth hemisphere + * @since X.x */ - private T createNorthOrSouthTile(final EarthHemisphere earthHemisphere, final double longitude, + private T createNorthOrSouthTile(final EarthHemisphere latitudeHemisphere, final double longitude, final double minLat, final int latitudeRows, final double latStep) { // hemisphere = +1 : North or = -1 : South int hemisphere; - switch (earthHemisphere) { + switch (latitudeHemisphere) { case NORTH: hemisphere = +1; break; @@ -872,18 +1051,19 @@ public class TilesCache<T extends Tile> { /** Create the Eastern or Western tile of a given tile defined by latitude, minLon, longitudeCols and lonStep - * @param earthHemisphere - * @param latitude - * @param minLon - * @param longitudeCols - * @param lonStep - * @return + * @param longitudeHemisphere longitude hemisphere + * @param latitude latitude to define the tile (rad) + * @param minLon minimum longitude to define the tile (rad) + * @param longitudeCols longitude columns + * @param lonStep longitude step (rad) + * @return East or West tile tile according to the Earth hemisphere + * @since X.x */ - private T createEastOrWestTile(final EarthHemisphere earthHemisphere, final double latitude, + private T createEastOrWestTile(final EarthHemisphere longitudeHemisphere, final double latitude, final double minLon, final int longitudeCols, final double lonStep) { // hemisphere = +1 : East or = -1 : West int hemisphere; - switch (earthHemisphere) { + switch (longitudeHemisphere) { case EAST: hemisphere = +1; break; @@ -950,6 +1130,7 @@ public class TilesCache<T extends Tile> { "\n"); } + // TODO GP AFAC private void printTileFile(final Tile tile, String prefix) { String tileFileName = prefix + (int) FastMath.toDegrees(tile.getMinimumLatitude()) + "_lon_" + (int) FastMath.toDegrees(tile.getMinimumLongitude()) + ".txt"; diff --git a/src/test/java/org/orekit/rugged/raster/TilesCacheTest.java b/src/test/java/org/orekit/rugged/raster/TilesCacheTest.java index 97cca10bf7d961832700a0bd97becb4f77c894a1..b5c96ce98a3acf72d759eacc2d951caa6b2e35e2 100644 --- a/src/test/java/org/orekit/rugged/raster/TilesCacheTest.java +++ b/src/test/java/org/orekit/rugged/raster/TilesCacheTest.java @@ -20,7 +20,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; @@ -32,8 +31,11 @@ import org.hipparchus.random.Well19937a; import org.hipparchus.util.FastMath; import org.junit.Assert; import org.junit.Test; -import org.junit.Ignore; +/** + * @author Luc Maisonobe + * @author Guylaine Prat + */ public class TilesCacheTest { @Test @@ -170,13 +172,13 @@ public class TilesCacheTest { Assert.assertEquals(17, factory.getCount()); } - - @Ignore + @Test public void testDummySRTM() throws URISyntaxException, FileNotFoundException, UnsupportedEncodingException { // Simple SRTM with 2 elevations final int rowCols = 1000; +// final int rowCols = 6000; final double tileSizeDeg = 5.; DummySRTMsimpleElevationUpdater srtmUpdater = new DummySRTMsimpleElevationUpdater(tileSizeDeg, rowCols, 10.0, 20.0); final double rasterStepDeg = srtmUpdater.getTileStepDeg(); // 1./1200.; @@ -186,6 +188,24 @@ public class TilesCacheTest { // final double tileSizeDeg = 5.; // DummySRTMelevationUpdater srtmUpdater = new DummySRTMelevationUpdater(tileSizeDeg, rowCols, 800.0, 9000.0, 0.1, 0xf0a401650191f9f6l); // final double rasterStepDeg = srtmUpdater.getTileStepDeg(); // 1./1200.; + +// org.gdal.gdal.gdal.AllRegister(); +// + // String demRootDir = "/home/guylaine/RuggedProject/demReader/data/DEM/extract"; + // fr.cssi.demreader.raster.RasterFilesHandler rasterFile = new fr.cssi.demreader.raster.SrtmDt1FileHandler(demRootDir); + // fr.cssi.demreader.raster.DemReaderTileUpdater srtmUpdater = null; + // if (rasterFile.findRasterFile()) { + // srtmUpdater = fr.cssi.demreader.raster.RasterHandler.initRasterHandler(rasterFile); + // } else { + // String str = "Raster files of type .dt1 not found in " + demRootDir; + // DummyLocalizable message = new DummyLocalizable(str); + // throw new RuggedException(message); + // } + // // from gdalinfo + // final int rowCols = 1201; + // final double rasterStepDeg = 0.000833333333333; + // final double tileSizeDeg = rasterStepDeg * rowCols; + CountingFactory factory = new CountingFactory(); TilesCache<SimpleTile> cache = new TilesCache<SimpleTile>(factory, srtmUpdater , 5, false); @@ -200,12 +220,36 @@ public class TilesCacheTest { System.out.println("NORTH EAST hemisphere"); latDeg = 37.1; lonDeg = 17.5; + // // méditerannée + // latDegVO = 37.1; + // lonDegVO = 17.5; + // // zone montagneuse italie + // latDegVO = 46.1; + // lonDegVO = 12.5; + // plaine france +// latDegVO = 46.1; +// lonDegVO = 12.5; + // search the tile +// latDeg = latDegVO; +// lonDeg = lonDegVO; + + System.out.println(">>>> Search lat deg = " + latDeg + " lon deg= " + lonDeg + "\n"); SimpleTile tileNE = cache.getTile(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg)); printTileInfo(tileNE, rasterStepDeg, rasterStepDeg); + if (rowCols == 6000) checkLatLonIndex(latDeg, 2519, lonDeg, 2999, 77.729902, tileNE); +// + tileName = "lat" + Double.toString(latDeg) + "lon" + Double.toString(lonDeg) + ".txt"; +// + stepPrint = 1; +// + stepPrintZipper = 1; +// + nbRowColForPrint = 10; +// + // printTileData(tileName, tileNE, stepPrint); +// + // printExtractTileData(tileName, tileNE, stepPrint, tileNE.getLatitudeRows() - nbRowColForPrint, tileNE.getLatitudeRows(), 0, tileNE.getLongitudeColumns()); +// + printEdgeTileData(tileName, tileNE, stepPrint, tileNE.getLatitudeRows(), tileNE.getLongitudeColumns(), nbRowColForPrint); +// + printSurroundingTiles(latDeg, lonDeg, tileSizeDeg, rasterStepDeg, cache, stepPrint, nbRowColForPrint); + // Latitude North of the tile System.out.println("##### Bord de tuile au niveau latitude North #####"); latDeg = getNorthernEdgeOfTile(tileNE); @@ -220,7 +264,7 @@ public class TilesCacheTest { // printTileData(zipperName, zipperTile, stepPrintZipper); // Latitude South of the tile - System.out.println("#### Changement de tuile au niveau latitude South #####"); + System.out.println("#### Bord de tuile au niveau latitude South #####"); latDeg = getSouthernEdgeOfTile(tileNE); lonDeg = 17.5; zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.SOUTH, tileNE, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -233,7 +277,7 @@ public class TilesCacheTest { // printTileData(zipperName, zipperTile, stepPrintZipper); // Longitude West of the tile - System.out.println("#### Changement de tuile au niveau longitude West #####"); + System.out.println("#### Bord de tuile au niveau longitude West #####"); latDeg = 37.1; lonDeg = getWesternEdgeOfTile(tileNE); zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.WEST, tileNE, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -246,7 +290,7 @@ public class TilesCacheTest { // printTileData(zipperName, zipperTile, stepPrintZipper); // Longitude East of the tile - System.out.println("#### Changement de tuile au niveau longitude East #####"); + System.out.println("#### Bord de tuile au niveau longitude East #####"); latDeg = 37.1; lonDeg = getEasternEdgeOfTile(tileNE); zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.EAST,tileNE, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -271,7 +315,8 @@ public class TilesCacheTest { System.out.println(">>>> Search lat deg = " + latDeg + " lon deg= " + lonDeg + "\n"); SimpleTile tileSE = cache.getTile(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg)); printTileInfo(tileSE, rasterStepDeg, rasterStepDeg); - if (rowCols == 6000) checkLatLonIndex(latDeg, 3479, lonDeg, 2999, -307.157295, tileSE); + +// if (rowCols == 6000) checkLatLonIndex(latDeg, 3479, lonDeg, 2999, -307.157295, tileSE); // String tileName = "lat" + Double.toString(latDeg) + "lon" + Double.toString(lonDeg) + ".txt"; // int stepPrint = 1; @@ -282,6 +327,15 @@ public class TilesCacheTest { // printEdgeTileData(tileName, tileSE, stepPrint, tileSE.getLatitudeRows(), tileSE.getLongitudeColumns(), nbRowColForPrint); // printSurroundingTiles(latDeg, lonDeg, tileSizeDeg, rasterStepDeg, cache, stepPrint, nbRowColForPrint); +// + tileName = "lat" + Double.toString(latDeg) + "lon" + Double.toString(lonDeg) + ".txt"; +// + stepPrint = 1; +// + stepPrintZipper = 1; +// + nbRowColForPrint = 10; +// + // printTileData(tileName, tileNE, stepPrint); +// + // printExtractTileData(tileName, tileNE, stepPrint, tileNE.getLatitudeRows() - nbRowColForPrint, tileNE.getLatitudeRows(), 0, tileNE.getLongitudeColumns()); +// + printEdgeTileData(tileName, tileSE, stepPrint, tileSE.getLatitudeRows(), tileSE.getLongitudeColumns(), nbRowColForPrint); +// + printSurroundingTiles(latDeg, lonDeg, tileSizeDeg, rasterStepDeg, cache, stepPrint, nbRowColForPrint); + // Latitude North of the tile System.out.println("##### Bord de tuile au niveau latitude North #####"); latDeg = getNorthernEdgeOfTile(tileSE); @@ -296,7 +350,7 @@ public class TilesCacheTest { // printTileData(zipperName, zipperTile, stepPrintZipper); // Latitude South of the tile - System.out.println("#### Changement de tuile au niveau latitude South #####"); + System.out.println("#### Bord de tuile au niveau latitude South #####"); latDeg = getSouthernEdgeOfTile(tileSE); lonDeg = 17.5; zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.SOUTH, tileSE, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -304,11 +358,12 @@ public class TilesCacheTest { if (rowCols == 6000) checkOneValueZipperTile(latDeg, lonDeg, zipperTile, 4, rowCols, epsilonLatLon, -40.00125, -39.99875, 15.00042, 19.99958, 1, 2999, -327.258708); + // zipperName = "zipperSouthLatitude.txt"; // printTileData(zipperName, zipperTile, stepPrintZipper); // Longitude West of the tile - System.out.println("#### Changement de tuile au niveau longitude West #####"); + System.out.println("#### Bord de tuile au niveau longitude West #####"); latDeg = -37.1; lonDeg = getWesternEdgeOfTile(tileSE); zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.WEST, tileSE, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -321,7 +376,7 @@ public class TilesCacheTest { // printTileData(zipperName, zipperTile, stepPrintZipper); // Longitude East of the tile - System.out.println("#### Changement de tuile au niveau longitude East #####"); + System.out.println("#### Bord de tuile au niveau longitude East #####"); latDeg = -37.1; lonDeg = getEasternEdgeOfTile(tileSE); zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.EAST, tileSE, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -346,7 +401,17 @@ public class TilesCacheTest { System.out.println(">>>> Search lat deg = " + latDeg + " lon deg= " + lonDeg + "\n"); SimpleTile tileNW = cache.getTile(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg)); printTileInfo(tileNW, rasterStepDeg, rasterStepDeg); - if (rowCols == 6000) checkLatLonIndex(latDeg, 2519, lonDeg, 2999, 76.790119, tileNW); + +// if (rowCols == 6000) checkLatLonIndex(latDeg, 2519, lonDeg, 2999, 76.790119, tileNW); + +// + tileName = "lat" + Double.toString(latDeg) + "lon" + Double.toString(lonDeg) + ".txt"; +// + stepPrint = 1; +// + stepPrintZipper = 1; +// + nbRowColForPrint = 10; +// +// printTileData(tileName, tileNE, stepPrint); +// +// printExtractTileData(tileName, tileNE, stepPrint, tileNE.getLatitudeRows() - nbRowColForPrint, tileNE.getLatitudeRows(), 0, tileNE.getLongitudeColumns()); +// + printEdgeTileData(tileName, tileNW, stepPrint, tileNW.getLatitudeRows(), tileNW.getLongitudeColumns(), nbRowColForPrint); +// + printSurroundingTiles(latDeg, lonDeg, tileSizeDeg, rasterStepDeg, cache, stepPrint, nbRowColForPrint); // Latitude North of the tile System.out.println("##### Bord de tuile au niveau latitude North #####"); @@ -358,8 +423,11 @@ public class TilesCacheTest { 39.99875, 40.00125, -19.99958, -15.00042, 1, 2999, 77.919679); +// + zipperName = "zipperNorthLatitude.txt"; +// + printTileData(zipperName, zipperTile, stepPrintZipper); + // Latitude South of the tile - System.out.println("#### Changement de tuile au niveau latitude South #####"); + System.out.println("#### Bord de tuile au niveau latitude South #####"); latDeg = getSouthernEdgeOfTile(tileNW); lonDeg = -17.5; zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.SOUTH, tileNW, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -367,9 +435,13 @@ public class TilesCacheTest { if (rowCols == 6000) checkOneValueZipperTile(latDeg, lonDeg, zipperTile, 4, rowCols, epsilonLatLon, 34.99875, 35.00125, -19.99958, -15.00042, 1, 2999, 90.796560); + +// + zipperName = "zipperSouthLatitude.txt"; +// + printTileData(zipperName, zipperTile, stepPrintZipper); + // Longitude West of the tile - System.out.println("#### Changement de tuile au niveau longitude West #####"); + System.out.println("#### Bord de tuile au niveau longitude West #####"); latDeg = 37.1; lonDeg = getWesternEdgeOfTile(tileNW); zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.WEST, tileNW, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -377,9 +449,13 @@ public class TilesCacheTest { if (rowCols == 6000) checkOneValueZipperTile(latDeg, lonDeg, zipperTile, rowCols, 4, epsilonLatLon, 35.00042, 39.99958, -20.00125, -19.99875, 2519, 1, 80.250639); + +// + zipperName = "zipperWestLongitude.txt"; +// + printTileData(zipperName, zipperTile, stepPrintZipper); + // Longitude East of the tile - System.out.println("#### Changement de tuile au niveau longitude East #####"); + System.out.println("#### Bord de tuile au niveau longitude East #####"); latDeg = 37.1; lonDeg = getEasternEdgeOfTile(tileNW); zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.EAST, tileNW, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -387,6 +463,10 @@ public class TilesCacheTest { if (rowCols == 6000) checkOneValueZipperTile(latDeg, lonDeg, zipperTile, rowCols, 4, epsilonLatLon, 35.00042, 39.99958, -15.00125, -14.99875, 2519, 1, 73.111331); + +// + zipperName = "zipperEastLongitude.txt"; +// + printTileData(zipperName, zipperTile, stepPrintZipper); + // Check the 4 corner zipper tiles check4cornersZipperTiles(tileNW, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -401,8 +481,18 @@ public class TilesCacheTest { System.out.println(">>>> Search lat deg = " + latDeg + " lon deg= " + lonDeg + "\n"); SimpleTile tileSW = cache.getTile(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg)); printTileInfo(tileSW, rasterStepDeg, rasterStepDeg); + if (rowCols == 6000) checkLatLonIndex(latDeg, 3479, lonDeg, 2999, -64.1245445, tileSW); +// + tileName = "lat" + Double.toString(latDeg) + "lon" + Double.toString(lonDeg) + ".txt"; +// + stepPrint = 1; +// + stepPrintZipper = 1; +// + nbRowColForPrint = 10; +// +// printTileData(tileName, tileNE, stepPrint); +// +// printExtractTileData(tileName, tileNE, stepPrint, tileNE.getLatitudeRows() - nbRowColForPrint, tileNE.getLatitudeRows(), 0, tileNE.getLongitudeColumns()); +// + printEdgeTileData(tileName, tileSW, stepPrint, tileSW.getLatitudeRows(), tileSW.getLongitudeColumns(), nbRowColForPrint); +// + printSurroundingTiles(latDeg, lonDeg, tileSizeDeg, rasterStepDeg, cache, stepPrint, nbRowColForPrint); + // Latitude North of the tile System.out.println("##### Bord de tuile au niveau latitude North #####"); latDeg = getNorthernEdgeOfTile(tileSW); @@ -413,8 +503,11 @@ public class TilesCacheTest { -35.00125, -34.99875, -19.99958, -15.000416, 1, 2999, -60.408025); +// + zipperName = "zipperNorthLatitude.txt"; +// + printTileData(zipperName, zipperTile, stepPrintZipper); + // Latitude South of the tile - System.out.println("#### Changement de tuile au niveau latitude South #####"); + System.out.println("#### Bord de tuile au niveau latitude South #####"); latDeg = getSouthernEdgeOfTile(tileSW); lonDeg = -17.5; zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.SOUTH, tileSW, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -422,9 +515,13 @@ public class TilesCacheTest { if (rowCols == 6000) checkOneValueZipperTile(latDeg, lonDeg, zipperTile, 4, rowCols, epsilonLatLon, -40.00125, -39.99875, -19.99958, -15.000417, 1, 2999, -67.851618); + +// + zipperName = "zipperSouthLatitude.txt"; +// + printTileData(zipperName, zipperTile, stepPrintZipper); + // Longitude West of the tile - System.out.println("#### Changement de tuile au niveau longitude West #####"); + System.out.println("#### Bord de tuile au niveau longitude West #####"); latDeg = -37.1; lonDeg = getWesternEdgeOfTile(tileSW); zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.WEST, tileSW, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -432,9 +529,13 @@ public class TilesCacheTest { if (rowCols == 6000) checkOneValueZipperTile(latDeg, lonDeg, zipperTile, rowCols, 4, epsilonLatLon, -39.99958, -35.00042, -20.00125, -19.99875, 3479, 1, -51.107712); + +// + zipperName = "zipperWestLongitude.txt"; +// + printTileData(zipperName, zipperTile, stepPrintZipper); + // Longitude East of the tile - System.out.println("#### Changement de tuile au niveau longitude East #####"); + System.out.println("#### Bord de tuile au niveau longitude East #####"); latDeg = -37.1; lonDeg = getEasternEdgeOfTile(tileSW); zipperTile = searchAndVerifyZipperTile(latDeg, lonDeg, Tile.Location.EAST, tileSW, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); @@ -443,6 +544,9 @@ public class TilesCacheTest { -39.99958, -35.00042, -15.00125, -14.998750, 3479, 1, -76.264544); +// + zipperName = "zipperEastLongitude.txt"; +// + printTileData(zipperName, zipperTile, stepPrintZipper); + // Check the 4 corner zipper tiles check4cornersZipperTiles(tileSW, tileSizeDeg, rasterStepDeg, cache, epsilonLatLon); } @@ -459,6 +563,7 @@ public class TilesCacheTest { checkGeodeticPointBelongsToZipper(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg), zipperTile); checkZipperTile(zipperTile, zipperLocation, tile, tileSizeDeg, cache, epsilonLatLon); + return zipperTile; } @@ -468,6 +573,7 @@ public class TilesCacheTest { double lonDeg; SimpleTile cornerZipperTile; + // Latitude/Longitude corner NW System.out.println("##### Coin de tuile au niveau latitude North et longitude West #####"); latDeg = getNorthernEdgeOfTile(tile); @@ -645,8 +751,8 @@ public class TilesCacheTest { } private void checkCornerElevations(SimpleTile cornerZipperTile, SimpleTile originTile, - SimpleTile belowLeft, SimpleTile belowRight, SimpleTile aboveLeft, SimpleTile aboveRight, - double epsilonLatLon) { + SimpleTile belowLeft, SimpleTile belowRight, SimpleTile aboveLeft, SimpleTile aboveRight, + double epsilonLatLon) { // row 0 of zipper double cornerZipperElevation = cornerZipperTile.getElevationAtIndices(0, 0); @@ -727,12 +833,13 @@ public class TilesCacheTest { } - private void checkZipperTile(SimpleTile zipperTile, Tile.Location location, SimpleTile originTile, - double tileSizeDeg, TilesCache<SimpleTile> cache, double epsilonLatLon) { + private void checkZipperTile(SimpleTile zipperTile, Tile.Location zipperLocation, + SimpleTile originTile, double tileSizeDeg, + TilesCache<SimpleTile> cache, double epsilonLatLon) { SurroundingTiles surroundingTiles = new SurroundingTiles(originTile, tileSizeDeg, cache); - if (location == Tile.Location.SOUTH) { + if (zipperLocation == Tile.Location.SOUTH) { SimpleTile tileBelow = surroundingTiles.getTileBelow(); for (int jLon = 0; jLon < zipperTile.getLongitudeColumns(); jLon++) { // row 0 of zipper @@ -755,7 +862,7 @@ public class TilesCacheTest { originELevation = originTile.getElevationAtIndices(1, jLon); assertEquals(originELevation, zipperElevation, epsilonLatLon); } - } else if (location == Tile.Location.NORTH) { + } else if (zipperLocation == Tile.Location.NORTH) { SimpleTile tileAbove = surroundingTiles.getTileAbove(); for (int jLon = 0; jLon < zipperTile.getLongitudeColumns(); jLon++) { // row 0 of zipper @@ -778,7 +885,7 @@ public class TilesCacheTest { aboveELevation = tileAbove.getElevationAtIndices(1, jLon); assertEquals(aboveELevation, zipperElevation, epsilonLatLon); } - } else if (location == Tile.Location.WEST) { + } else if (zipperLocation == Tile.Location.WEST) { SimpleTile tileLeft = surroundingTiles.getTileLeft(); for (int iLat = 0; iLat < zipperTile.getLatitudeRows(); iLat++) { // col 0 of zipper @@ -802,25 +909,25 @@ public class TilesCacheTest { assertEquals(originELevation, zipperElevation, epsilonLatLon); } - } else if (location == Tile.Location.EAST) { + } else if (zipperLocation == Tile.Location.EAST) { SimpleTile tileRight = surroundingTiles.getTileRight(); for (int iLat = 0; iLat < zipperTile.getLatitudeRows(); iLat++) { - // row 0 of zipper + // col 0 of zipper double zipperElevation = zipperTile.getElevationAtIndices(iLat, 0); double originELevation = originTile.getElevationAtIndices(iLat, originTile.getLongitudeColumns() - 2); assertEquals(originELevation, zipperElevation, epsilonLatLon); - // row 1 of zipper + // col 1 of zipper zipperElevation = zipperTile.getElevationAtIndices(iLat, 1); originELevation = originTile.getElevationAtIndices(iLat, originTile.getLongitudeColumns() - 1); assertEquals(originELevation, zipperElevation, epsilonLatLon); - // row 2 of zipper + // col 2 of zipper zipperElevation = zipperTile.getElevationAtIndices(iLat, 2); double rightELevation = tileRight.getElevationAtIndices(iLat, 0); assertEquals(rightELevation, zipperElevation, epsilonLatLon); - // row 3 of zipper + // col 3 of zipper zipperElevation = zipperTile.getElevationAtIndices(iLat, 3); rightELevation = tileRight.getElevationAtIndices(iLat, 1); assertEquals(rightELevation, zipperElevation, epsilonLatLon); @@ -871,8 +978,7 @@ public class TilesCacheTest { } - - final static double epsilonElevation = 1.e-6; + private void checkLatLonIndex(final double latDeg, final int expectedLatIndex, final double lonDeg, final int expectedLonIndex, final double expectedElevation, @@ -892,6 +998,8 @@ public class TilesCacheTest { assertEquals(expectedElevation, tile.getElevationAtIndices(expectedLatIndex, expectedLonIndex), epsilonElevation); } + final static double epsilonElevation = 1.e-6; + final static java.text.DecimalFormatSymbols symbols = new java.text.DecimalFormatSymbols(java.util.Locale.US); final static java.text.DecimalFormat dfs = new java.text.DecimalFormat("#.#####",symbols); @@ -917,8 +1025,6 @@ public class TilesCacheTest { } catch (Exception e) { System.out.println("problem"); } - - } private void printTileData(String tileName, SimpleTile tile, int stepPrint) throws FileNotFoundException, UnsupportedEncodingException { @@ -968,122 +1074,13 @@ public class TilesCacheTest { } } if (elevationPrinter != null) elevationPrinter.close(); - - } - -// @Test -// public void testDummyTileCreationOld() { -// // double[] latDeg = {48.53631399 , 50}; -// //// double[] latDeg = {60., 59.99999, 59., 58., 57, 56, -// //// 55, 54, 53,52, 51, -// //// 50, 46, -// //// 45, 42, -// //// 40, 38, 36, -// //// 35, -// //// -35, -36, -38, -// //// -49, -// //// -50, -51, -54, -// //// -55}; -// // int[] expected = {1,1,1,1,1,1, -// // 2, 2,2,2,2, -// // 3,3, -// // 4,4, -// // 5,5,5, -// // 6, -// // 20, 20, 20, -// // 22, -// // 23, 23, 23, -// // 24}; -// // for (int i= 0; i < latDeg.length; i++) { -// // int tileName = (int) (1 + (60. - latDeg[i])/5); -// //// int subDirValue = (int) FastMath.ceil((125. - 2.*latDeg[i])/10.); -// // -// // System.out.println(" lat = " + latDeg[i] + " nb= " + tileName); -// //// assertTrue(tileName == expected[i]); -// // } -// // -// // double[] lonDeg = {2.20809251, 5}; -// //// double[] lonDeg = {-180, -179, -176, -175, -174, -11, -10, -6, -5, -1, 0 , 4, 5, 20, 22, 26, 175, 177, 180}; -// //// double[] expected = { 1, 1, 1 , 2, 2, 34, 35, 35, 36, 36, 37, 37, 38, 41, 41, 42, 72, 72, 73}; -// // for (int i= 0; i < lonDeg.length; i++) { -// // int tileName = (int) (1 + (lonDeg[i] + 180.)/5); -// //// int parentDirValue = (int) (FastMath.ceil(2.*lonDeg[i] + 365.)/10.); -// // -// // System.out.println(" lon = " + lonDeg[i] + " nb= " + tileName); -// //// assertTrue(tileName == parentDirValue); -// //// assertTrue(tileName == expected[i]); -// // } -// -// CountingFactory factory = new CountingFactory(); -// TilesCache<SimpleTile> cache = new TilesCache<SimpleTile>(factory, -// new DummySRTMelevationUpdater(10.0, 20.0), -// 3, false); -// -// // Centre of tile 36/06 -// // Origin = (-5.000000000000000,35.000000000000000) -// // Pixel Size = (0.000833333333333,-0.000833333333333) -// // Upper Left ( -5.0000000, 35.0000000) ( 5d 0' 0.00"W, 35d 0' 0.00"N) -// // Lower Left ( -5.0000000, 30.0000000) ( 5d 0' 0.00"W, 30d 0' 0.00"N) -// // Upper Right ( 0.0000000, 35.0000000) ( 0d 0' 0.01"E, 35d 0' 0.00"N) -// // Lower Right ( 0.0000000, 30.0000000) ( 0d 0' 0.01"E, 30d 0' 0.00"N) -// -// final double rasterStepDeg = 1./1200.; -// -// double latDeg = 37.1; -// double lonDeg = 7.2; -// System.out.println("Search lat deg = " + latDeg + " lon deg= " + lonDeg); -// SimpleTile tile = cache.getTile(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg)); -// printTileInfo(tile, rasterStepDeg, rasterStepDeg); -// -// // latDeg = 39.5; -// // lonDeg = 7.5; -// // System.out.println("Search lat deg = " + latDeg + " lon deg= " + lonDeg); -// // tile = cache.getTile(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg)); -// // printTileInfo(tile); -// -// // System.out.println("!!!! Changement de tuile au niveau longitude Est"); -// // latDeg = 37.5; -// // lonDeg = 10. + 0.1*rasterStepDeg; -// // System.out.println("Search lat deg = " + latDeg + " lon deg= " + lonDeg); -// // tile = cache.getTile(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg)); -// // printTileInfo(tile); -// -// -// -// // System.out.println("!!!! Bord de tuile au niveau latitude Sud"); -// // latDeg = 35. + 0.9*rasterStepDeg; -// // lonDeg = 7.5; -// // System.out.println("Search lat deg = " + latDeg + " lon deg= " + lonDeg); -// // tile = cache.getTile(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg)); -// // printTileInfo(tile); -// -// // System.out.println("!!!! Changement de tuile au niveau latitude Sud"); -// // latDeg = 35. - 0.1*rasterStepDeg; -// //// System.out.println(" calcul brut = " + (((latDeg - 30.) / rasterStepDeg)) + -// //// " floorInt " + ((int) FastMath.floor((latDeg - 30.) / rasterStepDeg))); -// //// System.out.println(" calcul = " + ((int) FastMath.floor((latDeg - 30.) / rasterStepDeg))); -// // lonDeg = 7.5; -// // System.out.println("Search lat deg = " + latDeg + " lon deg= " + lonDeg); -// // tile = cache.getTile(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg)); -// // printTileInfo(tile); -// -// System.out.println("!!!! Bord de tuile au niveau latitude Nord"); -// latDeg = 40. - 0.1*rasterStepDeg; -// lonDeg = 7.5; -// System.out.println("Search lat deg = " + latDeg + " lon deg= " + lonDeg); -// tile = cache.getTile(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg)); -// printTileInfo(tile); -// -// // System.out.println("!!!! Changement de tuile au niveau latitude Nord"); -// // latDeg = 40. + 0.1*rasterStepDeg; -// // lonDeg = 7.5; -// // System.out.println("Search lat deg = " + latDeg + " lon deg= " + lonDeg); -// // tile = cache.getTile(FastMath.toRadians(latDeg), FastMath.toRadians(lonDeg)); -// // printTileInfo(tile); -// -// -// } +// + printExtractTileData(tileName + "NorthEdge", tile, stepPrint, iLatMax - nbRowCols, iLatMax, 0, jLonMax); +// + printExtractTileData(tileName + "SouthEdge", tile, stepPrint, 0, nbRowCols, 0, jLonMax); +// + printExtractTileData(tileName + "WestEdge", tile, stepPrint, 0, iLatMax, 0, nbRowCols); +// + printExtractTileData(tileName + "EastEdge", tile, stepPrint, 0, iLatMax, jLonMax - nbRowCols, jLonMax); + + } } class SurroundingTiles { @@ -1133,7 +1130,4 @@ class SurroundingTiles { public SimpleTile getTileRight() { return tileRight; } - - - }