| | |
| | | |
| | | Band band = ds.GetRasterBand(1); |
| | | float[] buffer = new float[width * height]; |
| | | //band.ReadRaster(0, 0, width, height, buffer, width, height, 0, 0); |
| | | band.ReadRaster(0, 0, width, height, buffer); |
| | | float[] building = dto.getBuildings().get(width + "_" + height); |
| | | double[] transform = ds.GetGeoTransform(); |
| | | |
| | | BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); |
| | | double differ = layer.getExtension().getMaxHeight() - layer.getExtension().getMinHeight(), minHeight = layer.getExtension().getMinHeight(); |
| | |
| | | for (int y = 0; y < height; y++) { |
| | | int offset = x + y * width; |
| | | if (Float.isNaN(buffer[offset]) || buffer[offset] < -999 || buffer[offset] < minHeight) continue; |
| | | if (!Float.isNaN(building[offset]) && building[offset] > -999) continue; |
| | | |
| | | double X = transform[0] + x * transform[1] + y * transform[2]; |
| | | double Y = transform[3] + x * transform[4] + y * transform[5]; |
| | | BuildingDto building = intersects(dto, X, Y); |
| | | if (null != building) continue; |
| | | |
| | | int r = 0, g, b; |
| | | if (buffer[offset] - layer.getExtension().getMaxHeight() > 0) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 是否相交 |
| | | * https://blog.csdn.net/flyingshineangel/article/details/135423025 |
| | | */ |
| | | private static BuildingDto intersects(ResultDto dto, double x, double y) { |
| | | Geometry p = new Geometry(ogr.wkbPoint); |
| | | p.AddPoint_2D(x, y); |
| | | p.AssignSpatialReference(dto.getBuildingList().get(0).getGeom().GetSpatialReference()); |
| | | |
| | | return dto.getBuildingList().parallelStream().filter(b -> b.getGeom().Intersects(p)).findFirst().orElse(null); |
| | | } |
| | | |
| | | private void copeFlow(ResultDto dto, LayerDto layer) { |
| | | List<String> vxFiles = new ArrayList<>(); |
| | | List<String> vyFiles = new ArrayList<>(); |