| | |
| | | */ |
| | | public void analysisPolyline(AnalysisResultEntity entity, Dataset ds, Geometry geo, int size) { |
| | | double[] transform = ds.GetGeoTransform(); |
| | | // double rotationX = transform[2]; double rotationY = transform[4] |
| | | double xSize = ds.getRasterXSize(), ySize = ds.getRasterXSize(); |
| | | double minX = transform[0], pixelWidth = transform[1], maxY = transform[3], pixelHeight = transform[5]; |
| | | |
| | | double len = 0; |
| | |
| | | |
| | | int xPixel = (int) Math.floor((xy[0] - minX) / pixelWidth); |
| | | int yPixel = (int) Math.floor((maxY - xy[1]) / Math.abs(pixelHeight)); |
| | | if (xPixel < 1 || xPixel > xSize || yPixel < 1 || yPixel > ySize) { |
| | | continue; |
| | | } |
| | | |
| | | List<Double> vals = new ArrayList<>(); |
| | | for (int j = 1; j <= bandCount; j++) { |
| | |
| | | */ |
| | | public void analysisPolygon(AnalysisResultEntity entity, Dataset ds, Geometry geo) { |
| | | double[] transform = ds.GetGeoTransform(); |
| | | // double rotationX = transform[2]; double rotationY = transform[4] |
| | | double minX = transform[0], pixelWidth = transform[1], maxY = transform[3], pixelHeight = Math.abs(transform[5]); |
| | | double minX = transform[0], pixelWidth = transform[1], maxY = transform[3], pixelHeight = Math.abs(transform[5]), rotationX = transform[2], rotationY = transform[4]; |
| | | double[] env = new double[4]; |
| | | geo.GetEnvelope(env); |
| | | |
| | | int xMinPixel = (int) Math.floor((env[0] - minX) / pixelWidth); |
| | | int yMinPixel = (int) Math.floor((maxY - env[3]) / pixelHeight); |
| | | int xMaxPixel = (int) Math.floor((env[1] - minX) / pixelWidth); |
| | | int yMaxPixel = (int) Math.floor((maxY - env[2]) / pixelHeight); |
| | | int xMinPixel = Math.max((int) Math.floor((env[0] - minX) / pixelWidth), 1); |
| | | int yMinPixel = Math.max((int) Math.floor((maxY - env[3]) / pixelHeight), 1); |
| | | int xMaxPixel = Math.min((int) Math.floor((env[1] - minX) / pixelWidth), ds.getRasterXSize()); |
| | | int yMaxPixel = Math.min((int) Math.floor((maxY - env[2]) / pixelHeight), ds.getRasterYSize()); |
| | | |
| | | int bandCount = ds.getRasterCount(); |
| | | int width = Math.abs(xMaxPixel - xMinPixel); |
| | | int height = Math.abs(yMaxPixel - yMinPixel); |
| | | if (width < 1 || height < 1) { |
| | | setError(entity, "查询范围无效"); |
| | | return; |
| | | } |
| | | |
| | | if (width * height > StaticData.I64 * StaticData.I64) { |
| | | readRasterForBlocks(entity, ds, bandCount, xMinPixel, yMinPixel, width, height); |
| | |
| | | d += distance; |
| | | } |
| | | } |
| | | |
| | | list.add(geo.GetPoint(c)); |
| | | |
| | | return list; |