月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-09-15 b05352cd656b55aadba4ac4326a29fdda2107108
栅格分析-线分析,添加距离累计
已修改3个文件
126 ■■■■ 文件已修改
src/main/java/com/moon/server/entity/data/AnalysisResultEntity.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/entity/shujian/CreateLayerEntity.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/data/RasterAnalysisService.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/entity/data/AnalysisResultEntity.java
@@ -25,8 +25,8 @@
    /**
     * 添加点
     */
    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);
    }
@@ -110,37 +110,48 @@
    }
    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;
        }
src/main/java/com/moon/server/entity/shujian/CreateLayerEntity.java
@@ -106,7 +106,7 @@
        private String tile_rgb;
        /**
         * 图层类型。0:普通,1:DEM图层
         * 图层类型。0:普通,1:DEM图层,2:自定义
         */
        private Integer type;
@@ -144,6 +144,22 @@
         * 拉伸因子,配合 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 精准
@@ -272,6 +288,62 @@
        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;
        }
    }
@@ -423,8 +495,8 @@
        private List<Process> online_process;
        public Config(Integer colorTableId ,Integer type, List<?> levels) {
            Process process = new Process(colorTableId,type, levels);
        public Config(Integer colorTableId, Integer type, List<?> levels) {
            Process process = new Process(colorTableId, type, levels);
            this.online_process = new ArrayList<>();
            this.online_process.add(process);
@@ -475,14 +547,14 @@
         * @param type   0-默认色板,1-渐变色板
         * @param levels 层级
         */
        public Process(Integer colorTableId ,Integer type, List<?> levels) {
        public Process(Integer colorTableId, Integer type, List<?> levels) {
            this();
            this.color_table_id = colorTableId;
            this.config.put("type", type);
            this.config.put("levels", levels);
            if (type > 0) {
                this. config.put("gradation", "visibility");
                this.config.put("gradation", "visibility");
            }
        }
src/main/java/com/moon/server/service/data/RasterAnalysisService.java
@@ -144,22 +144,29 @@
        // 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);
        }
    }