| | |
| | | */ |
| | | public void analysisPolyline(AnalysisResultEntity entity, Dataset ds, Geometry geo, int size) { |
| | | double[] transform = ds.GetGeoTransform(); |
| | | double xSize = ds.getRasterXSize(), ySize = ds.getRasterXSize(); |
| | | int xSize = ds.getRasterXSize(), ySize = ds.getRasterYSize(); |
| | | double minX = transform[0], pixelWidth = transform[1], maxY = transform[3], pixelHeight = transform[5]; |
| | | |
| | | double len = 0; |
| | |
| | | */ |
| | | public void analysisPolygon(AnalysisResultEntity entity, Dataset ds, Geometry geo) { |
| | | double[] transform = ds.GetGeoTransform(); |
| | | int xSize = ds.getRasterXSize(), ySize = ds.getRasterYSize(); |
| | | 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 = 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 xMaxPixel = Math.min((int) Math.floor((env[1] - minX) / pixelWidth), xSize); |
| | | int yMaxPixel = Math.min((int) Math.floor((maxY - env[2]) / pixelHeight), ySize); |
| | | |
| | | int bandCount = ds.getRasterCount(); |
| | | int width = Math.abs(xMaxPixel - xMinPixel); |
| | | int height = Math.abs(yMaxPixel - yMinPixel); |
| | | if (width < 1 || height < 1) { |
| | | if (width < 1 || height < 1 || xMaxPixel < 1 || yMaxPixel < 1) { |
| | | setError(entity, "查询范围无效"); |
| | | return; |
| | | } |