Search in sources :

Example 1 with ScaledIntegerGriddedDigitalElevationModelFile

use of com.revolsys.elevation.gridded.scaledint.ScaledIntegerGriddedDigitalElevationModelFile in project com.revolsys.open by revolsys.

the class ScaledIntegerGriddedDigitalElevationModelTest method test203RandomAccessMissingCreateValues.

@Test
public void test203RandomAccessMissingCreateValues() throws IOException {
    final String filePath = "target/test/elevation/missingCreateEmpty.sigdem";
    final Path path = Paths.get(filePath);
    Files.deleteIfExists(path);
    final GeometryFactory geometryFactory = GeometryFactory.fixed3d(3005, 1000.0, 1000.0, 1000.0);
    final GriddedElevationModel expectedModel = GriddedElevationModelTest.newIntArrayModelNaNOnDiagonal(3005);
    try (final ScaledIntegerGriddedDigitalElevationModelFile actualModel = new ScaledIntegerGriddedDigitalElevationModelFile(path, geometryFactory, 0, 0, 255, 255, 1)) {
        actualModel.setElevations(expectedModel);
        assertModelEquals(expectedModel, actualModel);
    }
    final GriddedElevationModel actualModel = GriddedElevationModel.newGriddedElevationModel(path);
    assertModelEquals(expectedModel, actualModel);
}
Also used : Path(java.nio.file.Path) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) ScaledIntegerGriddedDigitalElevationModelFile(com.revolsys.elevation.gridded.scaledint.ScaledIntegerGriddedDigitalElevationModelFile) GriddedElevationModel(com.revolsys.elevation.gridded.GriddedElevationModel) Test(org.junit.Test)

Example 2 with ScaledIntegerGriddedDigitalElevationModelFile

use of com.revolsys.elevation.gridded.scaledint.ScaledIntegerGriddedDigitalElevationModelFile in project com.revolsys.open by revolsys.

the class ScaledIntegerGriddedDigitalElevationModelTest method test200RandomAccess.

@Test
public void test200RandomAccess() {
    final long time = System.currentTimeMillis();
    final GriddedElevationModel model = GriddedElevationModelTest.newIntArrayModelNaNOnDiagonal(3005);
    final String filePath = "target/test/elevation/nanDiagonal.sigdem";
    writeModel(model, filePath);
    try (final ScaledIntegerGriddedDigitalElevationModelFile actualModel = new ScaledIntegerGriddedDigitalElevationModelFile(Paths.get(filePath))) {
        assertModelEquals(model, actualModel);
    }
    System.out.println("test200RandomAccess\t" + Dates.toEllapsedTime(time, System.currentTimeMillis()));
}
Also used : ScaledIntegerGriddedDigitalElevationModelFile(com.revolsys.elevation.gridded.scaledint.ScaledIntegerGriddedDigitalElevationModelFile) GriddedElevationModel(com.revolsys.elevation.gridded.GriddedElevationModel) Test(org.junit.Test)

Example 3 with ScaledIntegerGriddedDigitalElevationModelFile

use of com.revolsys.elevation.gridded.scaledint.ScaledIntegerGriddedDigitalElevationModelFile in project com.revolsys.open by revolsys.

the class ScaledIntegerGriddedDigitalElevationModelTest method test203RandomAccessMissingCreateEmpty.

@Test
public void test203RandomAccessMissingCreateEmpty() throws IOException {
    final String filePath = "target/test/elevation/missingCreateEmpty.sigdem";
    final Path path = Paths.get(filePath);
    Files.deleteIfExists(path);
    final GeometryFactory geometryFactory = GeometryFactory.fixed3d(3005, 1000.0, 1000.0, 1000.0);
    final GriddedElevationModel expectedModel = GriddedElevationModelTest.newIntArrayModelEmpty(3005);
    try (final ScaledIntegerGriddedDigitalElevationModelFile actualModel = new ScaledIntegerGriddedDigitalElevationModelFile(path, geometryFactory, 0, 0, 255, 255, 1)) {
        assertModelEquals(expectedModel, actualModel);
    }
    final GriddedElevationModel actualModel = GriddedElevationModel.newGriddedElevationModel(path);
    assertModelEquals(expectedModel, actualModel);
}
Also used : Path(java.nio.file.Path) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) ScaledIntegerGriddedDigitalElevationModelFile(com.revolsys.elevation.gridded.scaledint.ScaledIntegerGriddedDigitalElevationModelFile) GriddedElevationModel(com.revolsys.elevation.gridded.GriddedElevationModel) Test(org.junit.Test)

Aggregations

GriddedElevationModel (com.revolsys.elevation.gridded.GriddedElevationModel)3 ScaledIntegerGriddedDigitalElevationModelFile (com.revolsys.elevation.gridded.scaledint.ScaledIntegerGriddedDigitalElevationModelFile)3 Test (org.junit.Test)3 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)2 Path (java.nio.file.Path)2