@Test public void testLoadWithNullLayer() { try { URL url = getClass().getResource("testgrid.tif"); classUnderTest.doLoadData(url, null); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { } }
@Override protected boolean doLoadData(URL url, ModelLayer layer) { Validate.notNull(url, "A URL is required"); Validate.notNull(layer, "A model layer is required"); File file = URLUtil.urlToFile(url); Dataset gdalDataset; try { gdalDataset = GDALUtils.open(file); } catch (Exception e) { e.printStackTrace(); return false; } List<Position> positions = new ArrayList<Position>(); float[][] values = new float[gdalDataset.getRasterXSize()][gdalDataset.getRasterYSize()]; float[] minmax = new float[] { Float.MAX_VALUE, -Float.MAX_VALUE }; readValuesFromDataset(gdalDataset, positions, values, minmax); BinaryTriangleTree btt = new BinaryTriangleTree(positions, gdalDataset.GetRasterXSize(), gdalDataset.GetRasterYSize()); btt.setForceGLTriangles(true); FastShape shape = btt.buildMesh(modelParameters.getMaxVariance()); positions = shape.getPositions(); shape.setForceSortedPrimitives(true); shape.setLighted(true); shape.setCalculateNormals(true); shape.setTwoSidedLighting(true); shape.setColorBuffer(createColorBufferForDataset(positions, values, minmax, gdalDataset)); shape.setColorBufferElementSize(4); layer.addShape(shape); this.bounds = shape.getBounds(); this.followTerrain = shape.isFollowTerrain(); return true; }
GDALRasterModelProvider extends AbstractDataProvider<ModelLayer> implements ModelProvider { @Override protected boolean doLoadData(URL url, ModelLayer layer) { Validate.notNull(url, "A URL is required"); Validate.notNull(layer, "A model layer is required"); File file = URLUtil.urlToFile(url); Dataset gdalDataset; try { gdalDataset = GDALUtils.open(file); } catch (Exception e) { e.printStackTrace(); return false; } List<Position> positions = new ArrayList<Position>(); float[][] values = new float[gdalDataset.getRasterXSize()][gdalDataset.getRasterYSize()]; float[] minmax = new float[] { Float.MAX_VALUE, -Float.MAX_VALUE }; readValuesFromDataset(gdalDataset, positions, values, minmax); BinaryTriangleTree btt = new BinaryTriangleTree(positions, gdalDataset.GetRasterXSize(), gdalDataset.GetRasterYSize()); btt.setForceGLTriangles(true); FastShape shape = btt.buildMesh(modelParameters.getMaxVariance()); positions = shape.getPositions(); shape.setForceSortedPrimitives(true); shape.setLighted(true); shape.setCalculateNormals(true); shape.setTwoSidedLighting(true); shape.setColorBuffer(createColorBufferForDataset(positions, values, minmax, gdalDataset)); shape.setColorBufferElementSize(4); layer.addShape(shape); this.bounds = shape.getBounds(); this.followTerrain = shape.isFollowTerrain(); return true; } }
GDALRasterModelProvider extends AbstractDataProvider<ModelLayer> implements ModelProvider { @Override protected boolean doLoadData(URL url, ModelLayer layer) { Validate.notNull(url, "A URL is required"); Validate.notNull(layer, "A model layer is required"); File file = URLUtil.urlToFile(url); Dataset gdalDataset; try { gdalDataset = GDALUtils.open(file); } catch (Exception e) { e.printStackTrace(); return false; } List<Position> positions = new ArrayList<Position>(); float[][] values = new float[gdalDataset.getRasterXSize()][gdalDataset.getRasterYSize()]; float[] minmax = new float[] { Float.MAX_VALUE, -Float.MAX_VALUE }; readValuesFromDataset(gdalDataset, positions, values, minmax); BinaryTriangleTree btt = new BinaryTriangleTree(positions, gdalDataset.GetRasterXSize(), gdalDataset.GetRasterYSize()); btt.setForceGLTriangles(true); FastShape shape = btt.buildMesh(modelParameters.getMaxVariance()); positions = shape.getPositions(); shape.setForceSortedPrimitives(true); shape.setLighted(true); shape.setCalculateNormals(true); shape.setTwoSidedLighting(true); shape.setColorBuffer(createColorBufferForDataset(positions, values, minmax, gdalDataset)); shape.setColorBufferElementSize(4); layer.addShape(shape); this.bounds = shape.getBounds(); this.followTerrain = shape.isFollowTerrain(); return true; } GDALRasterModelProvider();  GDALRasterModelProvider(GDALRasterModelParameters parameters); }
GDALRasterModelProvider extends AbstractDataProvider<ModelLayer> implements ModelProvider { @Override protected boolean doLoadData(URL url, ModelLayer layer) { Validate.notNull(url, "A URL is required"); Validate.notNull(layer, "A model layer is required"); File file = URLUtil.urlToFile(url); Dataset gdalDataset; try { gdalDataset = GDALUtils.open(file); } catch (Exception e) { e.printStackTrace(); return false; } List<Position> positions = new ArrayList<Position>(); float[][] values = new float[gdalDataset.getRasterXSize()][gdalDataset.getRasterYSize()]; float[] minmax = new float[] { Float.MAX_VALUE, -Float.MAX_VALUE }; readValuesFromDataset(gdalDataset, positions, values, minmax); BinaryTriangleTree btt = new BinaryTriangleTree(positions, gdalDataset.GetRasterXSize(), gdalDataset.GetRasterYSize()); btt.setForceGLTriangles(true); FastShape shape = btt.buildMesh(modelParameters.getMaxVariance()); positions = shape.getPositions(); shape.setForceSortedPrimitives(true); shape.setLighted(true); shape.setCalculateNormals(true); shape.setTwoSidedLighting(true); shape.setColorBuffer(createColorBufferForDataset(positions, values, minmax, gdalDataset)); shape.setColorBufferElementSize(4); layer.addShape(shape); this.bounds = shape.getBounds(); this.followTerrain = shape.isFollowTerrain(); return true; } GDALRasterModelProvider();  GDALRasterModelProvider(GDALRasterModelParameters parameters); @Override Bounds getBounds(); @Override boolean isFollowTerrain(); }
GDALRasterModelProvider extends AbstractDataProvider<ModelLayer> implements ModelProvider { @Override protected boolean doLoadData(URL url, ModelLayer layer) { Validate.notNull(url, "A URL is required"); Validate.notNull(layer, "A model layer is required"); File file = URLUtil.urlToFile(url); Dataset gdalDataset; try { gdalDataset = GDALUtils.open(file); } catch (Exception e) { e.printStackTrace(); return false; } List<Position> positions = new ArrayList<Position>(); float[][] values = new float[gdalDataset.getRasterXSize()][gdalDataset.getRasterYSize()]; float[] minmax = new float[] { Float.MAX_VALUE, -Float.MAX_VALUE }; readValuesFromDataset(gdalDataset, positions, values, minmax); BinaryTriangleTree btt = new BinaryTriangleTree(positions, gdalDataset.GetRasterXSize(), gdalDataset.GetRasterYSize()); btt.setForceGLTriangles(true); FastShape shape = btt.buildMesh(modelParameters.getMaxVariance()); positions = shape.getPositions(); shape.setForceSortedPrimitives(true); shape.setLighted(true); shape.setCalculateNormals(true); shape.setTwoSidedLighting(true); shape.setColorBuffer(createColorBufferForDataset(positions, values, minmax, gdalDataset)); shape.setColorBufferElementSize(4); layer.addShape(shape); this.bounds = shape.getBounds(); this.followTerrain = shape.isFollowTerrain(); return true; } GDALRasterModelProvider();  GDALRasterModelProvider(GDALRasterModelParameters parameters); @Override Bounds getBounds(); @Override boolean isFollowTerrain();  }