From b05352cd656b55aadba4ac4326a29fdda2107108 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 15 九月 2023 10:11:14 +0800
Subject: [PATCH] 栅格分析-线分析,添加距离累计

---
 src/main/java/com/moon/server/service/data/RasterAnalysisService.java |   15 +++-
 src/main/java/com/moon/server/entity/shujian/CreateLayerEntity.java   |   82 +++++++++++++++++++++++++-
 src/main/java/com/moon/server/entity/data/AnalysisResultEntity.java   |   29 ++++++---
 3 files changed, 108 insertions(+), 18 deletions(-)

diff --git a/src/main/java/com/moon/server/entity/data/AnalysisResultEntity.java b/src/main/java/com/moon/server/entity/data/AnalysisResultEntity.java
index 4a6a83a..89c8804 100644
--- a/src/main/java/com/moon/server/entity/data/AnalysisResultEntity.java
+++ b/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;
         }
diff --git a/src/main/java/com/moon/server/entity/shujian/CreateLayerEntity.java b/src/main/java/com/moon/server/entity/shujian/CreateLayerEntity.java
index ff59cce..9f2cbdf 100644
--- a/src/main/java/com/moon/server/entity/shujian/CreateLayerEntity.java
+++ b/src/main/java/com/moon/server/entity/shujian/CreateLayerEntity.java
@@ -106,7 +106,7 @@
         private String tile_rgb;
 
         /**
-         * 鍥惧眰绫诲瀷銆�0锛氭櫘閫氾紝1锛欴EM鍥惧眰
+         * 鍥惧眰绫诲瀷銆�0锛氭櫘閫氾紝1锛欴EM鍥惧眰锛�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");
             }
         }
 
diff --git a/src/main/java/com/moon/server/service/data/RasterAnalysisService.java b/src/main/java/com/moon/server/service/data/RasterAnalysisService.java
index 80be306..a2866b4 100644
--- a/src/main/java/com/moon/server/service/data/RasterAnalysisService.java
+++ b/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);
         }
     }
 

--
Gitblit v1.9.3