| | |
| | | // double rotationX = transform[2]; double rotationY = transform[4] |
| | | double minX = transform[0], pixelWidth = transform[1], maxY = transform[3], pixelHeight = transform[5]; |
| | | |
| | | double len = 0; |
| | | int bandCount = ds.getRasterCount(); |
| | | double lineDis = getPolylineDistance(geo); |
| | | double distance = lineDis / Math.max(geo.GetPointCount(), size); |
| | | |
| | | List<double[]> points = getPointsByDistance(geo, distance); |
| | | for (double[] xy : points) { |
| | | for (int i = 0, c = points.size(); i < c; i++) { |
| | | double[] xy = points.get(i); |
| | | if (i > 0) { |
| | | double[] p = points.get(i - 1); |
| | | len += GeoHelper.getDistance(p[0], p[1], xy[0], xy[1]); |
| | | } |
| | | |
| | | int xPixel = (int) Math.floor((xy[0] - minX) / pixelWidth); |
| | | int yPixel = (int) Math.floor((maxY - xy[1]) / Math.abs(pixelHeight)); |
| | | |
| | | List<Double> vals = new ArrayList<>(); |
| | | for (int i = 1; i <= bandCount; i++) { |
| | | for (int j = 1; j <= bandCount; j++) { |
| | | double[] pixelValues = new double[1]; |
| | | ds.GetRasterBand(i).ReadRaster(xPixel, yPixel, 1, 1, pixelValues); |
| | | ds.GetRasterBand(j).ReadRaster(xPixel, yPixel, 1, 1, pixelValues); |
| | | vals.add(pixelValues[0]); |
| | | } |
| | | entity.addPoint(xy[0], xy[1], vals); |
| | | entity.addPoint(xy[0], xy[1], len, vals); |
| | | } |
| | | } |
| | | |