| | |
| | | /** |
| | | * 添加点 |
| | | */ |
| | | public void addPoint(Double x, Double y, List<Double> vals) { |
| | | Point point = new Point(x, y, vals); |
| | | public void addPoint(double x, double y, double len, List<Double> vals) { |
| | | Point point = new Point(x, y, len, vals); |
| | | this.points.add(point); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | public static class Point { |
| | | private Double x; |
| | | private double x; |
| | | |
| | | private Double y; |
| | | private double y; |
| | | |
| | | private double len; |
| | | |
| | | private List<Double> vals; |
| | | |
| | | public Point() { |
| | | } |
| | | |
| | | public Point(Double x, Double y, List<Double> vals) { |
| | | public Point(double x, double y, double len, List<Double> vals) { |
| | | this.x = x; |
| | | this.y = y; |
| | | this.len = WebHelper.round(len, 3); |
| | | this.vals = vals; |
| | | } |
| | | |
| | | public Double getX() { |
| | | public double getX() { |
| | | return x; |
| | | } |
| | | |
| | | public void setX(Double x) { |
| | | public void setX(double x) { |
| | | this.x = x; |
| | | } |
| | | |
| | | public Double getY() { |
| | | public double getY() { |
| | | return y; |
| | | } |
| | | |
| | | public void setY(Double y) { |
| | | public void setY(double y) { |
| | | this.y = y; |
| | | } |
| | | |
| | | public double getLen() { |
| | | return len; |
| | | } |
| | | |
| | | public void setLen(double len) { |
| | | this.len = len; |
| | | } |
| | | |
| | | public List<Double> getVals() { |
| | | return vals; |
| | | } |
| | |
| | | private String tile_rgb; |
| | | |
| | | /** |
| | | * 图层类型。0:普通,1:DEM图层 |
| | | * 图层类型。0:普通,1:DEM图层,2:自定义 |
| | | */ |
| | | private Integer type; |
| | | |
| | |
| | | * 拉伸因子,配合 enhance_factor使用 |
| | | */ |
| | | private Double enhance_factor; |
| | | |
| | | private Integer image_type = -1; |
| | | |
| | | private Integer sat_id = -1; |
| | | |
| | | private Integer sensor_id = -1; |
| | | |
| | | //private Integer pub_status = 0; |
| | | |
| | | private String type_i = ""; |
| | | |
| | | private String type_ii = ""; |
| | | |
| | | private String type_iii = ""; |
| | | |
| | | private String type_iv = ""; |
| | | |
| | | /** |
| | | * 边界计算方式 0外包,1, 内接, 2 精准 |
| | |
| | | public void setBoundary_cal_mode(Integer boundary_cal_mode) { |
| | | this.boundary_cal_mode = boundary_cal_mode; |
| | | } |
| | | |
| | | public Integer getImage_type() { |
| | | return image_type; |
| | | } |
| | | |
| | | public void setImage_type(Integer image_type) { |
| | | this.image_type = image_type; |
| | | } |
| | | |
| | | public Integer getSat_id() { |
| | | return sat_id; |
| | | } |
| | | |
| | | public void setSat_id(Integer sat_id) { |
| | | this.sat_id = sat_id; |
| | | } |
| | | |
| | | public Integer getSensor_id() { |
| | | return sensor_id; |
| | | } |
| | | |
| | | public void setSensor_id(Integer sensor_id) { |
| | | this.sensor_id = sensor_id; |
| | | } |
| | | |
| | | public String getType_i() { |
| | | return type_i; |
| | | } |
| | | |
| | | public void setType_i(String type_i) { |
| | | this.type_i = type_i; |
| | | } |
| | | |
| | | public String getType_ii() { |
| | | return type_ii; |
| | | } |
| | | |
| | | public void setType_ii(String type_ii) { |
| | | this.type_ii = type_ii; |
| | | } |
| | | |
| | | public String getType_iii() { |
| | | return type_iii; |
| | | } |
| | | |
| | | public void setType_iii(String type_iii) { |
| | | this.type_iii = type_iii; |
| | | } |
| | | |
| | | public String getType_iv() { |
| | | return type_iv; |
| | | } |
| | | |
| | | public void setType_iv(String type_iv) { |
| | | this.type_iv = type_iv; |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | // 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); |
| | | } |
| | | } |
| | | |