Преглед изворни кода

计算距离,增加高度

wuweihao пре 4 година
родитељ
комит
58d4e26a4d

+ 141 - 0
laser/src/main/java/com/fdkankan/indoor/base/convert/DistanceUtil.java

@@ -0,0 +1,141 @@
+package com.fdkankan.indoor.base.convert;
+
+import com.fdkankan.indoor.base.util.Factors;
+import com.fdkankan.indoor.base.util.Options;
+
+import java.awt.geom.Point2D;
+import java.util.List;
+
+/**
+ * @author Admin
+ * 计算距离
+ */
+public class DistanceUtil {
+
+    /**
+     * 计算距离
+     * 这个只有经纬度, 没有高度
+     * @param coordinates1
+     * @param coordinates2
+     * @param options 单位是米
+     * @return
+     */
+    private static double distance(Double[] coordinates1, Double[] coordinates2, Options options) {
+        double dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
+        double dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
+        double lat1 = degreesToRadians(coordinates1[1]);
+        double lat2 = degreesToRadians(coordinates2[1]);
+
+        double a = Math.pow(Math.sin(dLat / 2), 2) +
+                        Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
+
+        return radiansToLength(
+                2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)),
+                options.getUnits()
+        );
+    }
+
+    /**
+     * 计算距离
+     * 输入两个三维坐标点 x y z
+     * @param coordinates1  [lon,lat,alt]
+     * @param coordinates2
+     * @return     返回值单位是米
+     */
+    public  static  double distance3(Double[] coordinates1, Double[] coordinates2){
+        double[] p1= GisCoordinateTransform.Convert2000BLToGauss(coordinates1[0],coordinates1[1]);
+        double[] p2= GisCoordinateTransform.Convert2000BLToGauss(coordinates2[0],coordinates2[1]);
+        double l=Math.pow(p1[0]-p2[0],2) +Math.pow(p1[1]-p2[1],2)+Math.pow(coordinates1[2]-coordinates2[2],2);
+        return Math.sqrt(l);
+    }
+
+    public static double degreesToRadians(Double degrees) {
+        if (degrees == null) {
+            return 0.0D;
+        }
+        double radians = degrees % 360;
+        return (radians * Math.PI) / 180;
+    }
+
+    public static double radiansToLength(double radians, String units) {
+        Double factor = Factors.getFactorsData(units);
+        if (factor == null) {
+            throw new RuntimeException(units + " units is invalid");
+        }
+        return radians * factor;
+    }
+
+
+    /**
+     * 判断点是否在多边形内
+     * @param point 检测点
+     * @param pts   多边形的顶点
+     * @return      点在多边形内返回true,否则返回false
+     */
+    public static boolean IsPtInPoly(Point2D.Double point, List<Point2D.Double> pts){
+
+        int N = pts.size();
+        boolean boundOrVertex = true; //如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
+        int intersectCount = 0;//cross points count of x
+        double precision = 2e-10; //浮点类型计算时候与0比较时候的容差
+        Point2D.Double p1, p2;//neighbour bound vertices
+        Point2D.Double p = point; //当前点
+
+        p1 = pts.get(0);//left vertex
+        for(int i = 1; i <= N; ++i){//check all rays
+            if(p.equals(p1)){
+                return boundOrVertex;//p is an vertex
+            }
+
+            p2 = pts.get(i % N);//right vertex
+            if(p.x < Math.min(p1.x, p2.x) || p.x > Math.max(p1.x, p2.x)){//ray is outside of our interests
+                p1 = p2;
+                continue;//next ray left point
+            }
+
+            if(p.x > Math.min(p1.x, p2.x) && p.x < Math.max(p1.x, p2.x)){//横坐标 内  ray is crossing over by the algorithm (common part of)
+                if(p.y <= Math.max(p1.y, p2.y)){//y下  x is before of ray
+                    if(p1.x == p2.x && p.y >= Math.min(p1.y, p2.y)){//overlies on a horizontal ray  垂线
+                        return boundOrVertex;
+                    }
+
+                    if(p1.y == p2.y){//水平线 ray is vertical
+                        if(p1.y == p.y){//水平线内 overlies on a vertical ray
+                            return boundOrVertex;
+                        }else{//before ray
+                            ++intersectCount;  //交点在上方
+                        }
+                    }else{//cross point on the left side
+                        double xinters = (p.x - p1.x) * (p2.y - p1.y) / (p2.x - p1.x) + p1.y;//两点式化简,交点y坐标 cross point of y
+                        if(Math.abs(p.y - xinters) < precision){//== 0  在线上  overlies on a ray
+                            return boundOrVertex;
+                        }
+
+                        if(p.y < xinters){//before ray
+                            ++intersectCount;  //交点在上方
+                        }
+                    }
+                }
+            }else{//special case when ray is crossing through the vertex
+                if(p.x == p2.x && p.y <= p2.y){//p crossing over p2
+                    Point2D.Double p3 = pts.get((i+1) % N); //next vertex
+                    if(p.x >= Math.min(p1.x, p3.x) && p.x <= Math.max(p1.x, p3.x)){//p.x lies between p1.x & p3.x
+                        ++intersectCount;
+                    }else{
+                        intersectCount += 2;
+                    }
+                }
+            }
+            p1 = p2;//next ray left point
+        }
+
+        if(intersectCount % 2 == 0){//偶数在多边形外
+            return false;
+        } else { //奇数在多边形内
+            return true;
+        }
+
+    }
+
+
+}

+ 46 - 2
laser/src/main/java/com/fdkankan/indoor/base/convert/ModifyDataSets.java

@@ -3,6 +3,9 @@ package com.fdkankan.indoor.base.convert;
 import java.io.IOException;
 
 
+import com.fdkankan.indoor.core.entity.dto.SecurityDto;
+import com.fdkankan.indoor.core.entity.po.DataSetPo;
+import net.sf.json.JSON;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 
@@ -44,8 +47,10 @@ public class ModifyDataSets {
 		JSONObject security = new JSONObject();
 		security.put("group_read", 0);
 		security.put("group_write", 1);
-		security.put("can_write", false);
-		
+//		security.put("can_write", false);
+		// 默认true
+		security.put("can_write", true);
+
 		dataset.put("security", security);
 		dataset.put("id", 0);
 		dataset.put("bundle_id", 1);
@@ -72,6 +77,45 @@ public class ModifyDataSets {
 		dataset.put("has_images", true);
 		return dataset;
 	}
+
+
+		public static DataSetPo createDataSetPo(Double[] location){
+			DataSetPo po = new DataSetPo();
+
+			SecurityDto securityDto = new SecurityDto();
+
+			securityDto.setGroup_read(0);
+			securityDto.setGroup_write(1);
+			// 默认true
+			securityDto.setCan_write(true);
+			// 默认true
+			po.setSecurity(securityDto);
+
+			po.setId(0);
+			po.setBundle_id(1);
+			po.setType("4dage");
+			po.setName("chunk1");
+			po.setTitle("chunk1");
+			po.setColor("pink");
+			po.setVisible(false);
+
+			//double[] location = {0,0,0};
+			//location = TransformGPS.convert(location);
+			//原点 ,获取特征点的原点
+			po.setLocation(location);
+			po.setOrientation(0.0);
+			Integer[] site_model_entity_ids = {10,11,12};
+			po.setSite_model_entity_ids(site_model_entity_ids);
+			po.setPoint_cloud_type("POTREE");
+
+			//添加boundingbox,从modifyCloud里的convertFromBoundingBox获取
+			//dataset.put("bounding_box_min", "");
+			//dataset.put("bounding_box_max", "");
+
+			po.setHas_depth_images(true);
+			po.setHas_images(true);
+			return po;
+		}
 	
 	public static JSONArray readSiteModel() throws IOException { 
 		String str = FileUtil.readStringFile(inputFilePath);

+ 117 - 117
laser/src/main/java/com/fdkankan/indoor/base/util/DistanceUtil.java

@@ -1,117 +1,117 @@
-package com.fdkankan.indoor.base.util;
-
-import java.awt.geom.Point2D;
-import java.util.List;
-
-/**
- * @author Admin
- * 距离计算
- */
-public class DistanceUtil {
-
-    public static double distance(Double[] coordinates1, Double[] coordinates2, Options options) {
-        double dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
-        double dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
-        double lat1 = degreesToRadians(coordinates1[1]);
-        double lat2 = degreesToRadians(coordinates2[1]);
-
-        double a = Math.pow(Math.sin(dLat / 2), 2) +
-                        Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
-
-        return radiansToLength(
-                2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)),
-                options.getUnits()
-        );
-    }
-
-
-    public static double degreesToRadians(Double degrees) {
-        if (degrees == null) {
-            return 0.0D;
-        }
-        double radians = degrees % 360;
-        return (radians * Math.PI) / 180;
-    }
-
-    public static double radiansToLength(double radians, String units) {
-        Double factor = Factors.getFactorsData(units);
-        if (factor == null) {
-            throw new RuntimeException(units + " units is invalid");
-        }
-        return radians * factor;
-    }
-
-
-    /**
-     * 判断点是否在多边形内
-     * @param point 检测点
-     * @param pts   多边形的顶点
-     * @return      点在多边形内返回true,否则返回false
-     */
-    public static boolean IsPtInPoly(Point2D.Double point, List<Point2D.Double> pts){
-
-        int N = pts.size();
-        boolean boundOrVertex = true; //如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
-        int intersectCount = 0;//cross points count of x
-        double precision = 2e-10; //浮点类型计算时候与0比较时候的容差
-        Point2D.Double p1, p2;//neighbour bound vertices
-        Point2D.Double p = point; //当前点
-
-        p1 = pts.get(0);//left vertex
-        for(int i = 1; i <= N; ++i){//check all rays
-            if(p.equals(p1)){
-                return boundOrVertex;//p is an vertex
-            }
-
-            p2 = pts.get(i % N);//right vertex
-            if(p.x < Math.min(p1.x, p2.x) || p.x > Math.max(p1.x, p2.x)){//ray is outside of our interests
-                p1 = p2;
-                continue;//next ray left point
-            }
-
-            if(p.x > Math.min(p1.x, p2.x) && p.x < Math.max(p1.x, p2.x)){//横坐标 内  ray is crossing over by the algorithm (common part of)
-                if(p.y <= Math.max(p1.y, p2.y)){//y下  x is before of ray
-                    if(p1.x == p2.x && p.y >= Math.min(p1.y, p2.y)){//overlies on a horizontal ray  垂线
-                        return boundOrVertex;
-                    }
-
-                    if(p1.y == p2.y){//水平线 ray is vertical
-                        if(p1.y == p.y){//水平线内 overlies on a vertical ray
-                            return boundOrVertex;
-                        }else{//before ray
-                            ++intersectCount;  //交点在上方
-                        }
-                    }else{//cross point on the left side
-                        double xinters = (p.x - p1.x) * (p2.y - p1.y) / (p2.x - p1.x) + p1.y;//两点式化简,交点y坐标 cross point of y
-                        if(Math.abs(p.y - xinters) < precision){//== 0  在线上  overlies on a ray
-                            return boundOrVertex;
-                        }
-
-                        if(p.y < xinters){//before ray
-                            ++intersectCount;  //交点在上方
-                        }
-                    }
-                }
-            }else{//special case when ray is crossing through the vertex
-                if(p.x == p2.x && p.y <= p2.y){//p crossing over p2
-                    Point2D.Double p3 = pts.get((i+1) % N); //next vertex
-                    if(p.x >= Math.min(p1.x, p3.x) && p.x <= Math.max(p1.x, p3.x)){//p.x lies between p1.x & p3.x
-                        ++intersectCount;
-                    }else{
-                        intersectCount += 2;
-                    }
-                }
-            }
-            p1 = p2;//next ray left point
-        }
-
-        if(intersectCount % 2 == 0){//偶数在多边形外
-            return false;
-        } else { //奇数在多边形内
-            return true;
-        }
-
-    }
-
-
-}
+//package com.fdkankan.indoor.base.util;
+//
+//import java.awt.geom.Point2D;
+//import java.util.List;
+//
+///**
+// * @author Admin
+// * 距离计算
+// */
+//public class DistanceUtil {
+//
+//    public static double distance(Double[] coordinates1, Double[] coordinates2, Options options) {
+//        double dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
+//        double dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
+//        double lat1 = degreesToRadians(coordinates1[1]);
+//        double lat2 = degreesToRadians(coordinates2[1]);
+//
+//        double a = Math.pow(Math.sin(dLat / 2), 2) +
+//                        Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
+//
+//        return radiansToLength(
+//                2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)),
+//                options.getUnits()
+//        );
+//    }
+//
+//
+//    public static double degreesToRadians(Double degrees) {
+//        if (degrees == null) {
+//            return 0.0D;
+//        }
+//        double radians = degrees % 360;
+//        return (radians * Math.PI) / 180;
+//    }
+//
+//    public static double radiansToLength(double radians, String units) {
+//        Double factor = Factors.getFactorsData(units);
+//        if (factor == null) {
+//            throw new RuntimeException(units + " units is invalid");
+//        }
+//        return radians * factor;
+//    }
+//
+//
+//    /**
+//     * 判断点是否在多边形内
+//     * @param point 检测点
+//     * @param pts   多边形的顶点
+//     * @return      点在多边形内返回true,否则返回false
+//     */
+//    public static boolean IsPtInPoly(Point2D.Double point, List<Point2D.Double> pts){
+//
+//        int N = pts.size();
+//        boolean boundOrVertex = true; //如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
+//        int intersectCount = 0;//cross points count of x
+//        double precision = 2e-10; //浮点类型计算时候与0比较时候的容差
+//        Point2D.Double p1, p2;//neighbour bound vertices
+//        Point2D.Double p = point; //当前点
+//
+//        p1 = pts.get(0);//left vertex
+//        for(int i = 1; i <= N; ++i){//check all rays
+//            if(p.equals(p1)){
+//                return boundOrVertex;//p is an vertex
+//            }
+//
+//            p2 = pts.get(i % N);//right vertex
+//            if(p.x < Math.min(p1.x, p2.x) || p.x > Math.max(p1.x, p2.x)){//ray is outside of our interests
+//                p1 = p2;
+//                continue;//next ray left point
+//            }
+//
+//            if(p.x > Math.min(p1.x, p2.x) && p.x < Math.max(p1.x, p2.x)){//横坐标 内  ray is crossing over by the algorithm (common part of)
+//                if(p.y <= Math.max(p1.y, p2.y)){//y下  x is before of ray
+//                    if(p1.x == p2.x && p.y >= Math.min(p1.y, p2.y)){//overlies on a horizontal ray  垂线
+//                        return boundOrVertex;
+//                    }
+//
+//                    if(p1.y == p2.y){//水平线 ray is vertical
+//                        if(p1.y == p.y){//水平线内 overlies on a vertical ray
+//                            return boundOrVertex;
+//                        }else{//before ray
+//                            ++intersectCount;  //交点在上方
+//                        }
+//                    }else{//cross point on the left side
+//                        double xinters = (p.x - p1.x) * (p2.y - p1.y) / (p2.x - p1.x) + p1.y;//两点式化简,交点y坐标 cross point of y
+//                        if(Math.abs(p.y - xinters) < precision){//== 0  在线上  overlies on a ray
+//                            return boundOrVertex;
+//                        }
+//
+//                        if(p.y < xinters){//before ray
+//                            ++intersectCount;  //交点在上方
+//                        }
+//                    }
+//                }
+//            }else{//special case when ray is crossing through the vertex
+//                if(p.x == p2.x && p.y <= p2.y){//p crossing over p2
+//                    Point2D.Double p3 = pts.get((i+1) % N); //next vertex
+//                    if(p.x >= Math.min(p1.x, p3.x) && p.x <= Math.max(p1.x, p3.x)){//p.x lies between p1.x & p3.x
+//                        ++intersectCount;
+//                    }else{
+//                        intersectCount += 2;
+//                    }
+//                }
+//            }
+//            p1 = p2;//next ray left point
+//        }
+//
+//        if(intersectCount % 2 == 0){//偶数在多边形外
+//            return false;
+//        } else { //奇数在多边形内
+//            return true;
+//        }
+//
+//    }
+//
+//
+//}

+ 40 - 0
laser/src/main/java/com/fdkankan/indoor/core/controller/DateSetController.java

@@ -0,0 +1,40 @@
+package com.fdkankan.indoor.core.controller;
+
+import com.fdkankan.indoor.base.aop.WebControllerLog;
+import com.fdkankan.indoor.base.util.Result;
+import com.fdkankan.indoor.core.service.DataSetService;
+import com.fdkankan.indoor.core.service.InitService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Created by owen on 2021/7/28 0028 9:04
+ *
+ */
+@Slf4j
+@Api(tags = "场景信息接口(dataSet)")
+@RestController
+public class DateSetController {
+
+    @Autowired
+    DataSetService entityService;
+
+
+    /**
+     * 获取数据
+     * @param sceneCode
+     * @return
+     */
+    @WebControllerLog(description = "场景信息接口-获取数据")
+    @ApiOperation(value = "获取数据")
+    @GetMapping("indoor/{sceneCode}/api/datasets")
+    public Object getDataSet(@PathVariable String sceneCode) {
+        Result result = entityService.getDataSet(sceneCode);
+        return result.getData();
+    }
+}

+ 7 - 7
laser/src/main/java/com/fdkankan/indoor/core/controller/FilterController.java

@@ -85,13 +85,13 @@ public class FilterController {
     }
 
 
-    @WebControllerLog(description = "测试id查询")
-    @ApiOperation(value = "测试id查询")
-    @GetMapping("indoor/{sceneCode}/api/filter1/{id}")
-    public Result getDataById1(@PathVariable String sceneCode, @PathVariable Integer id) {
-        log.info("sceneCode: {}", sceneCode);
-        return filterService.findById1(sceneCode, id);
-    }
+//    @WebControllerLog(description = "测试id查询")
+//    @ApiOperation(value = "测试id查询")
+//    @GetMapping("indoor/{sceneCode}/api/filter1/{id}")
+//    public Result getDataById1(@PathVariable String sceneCode, @PathVariable Integer id) {
+//        log.info("sceneCode: {}", sceneCode);
+//        return filterService.findById1(sceneCode, id);
+//    }
 
 
 

+ 4 - 4
laser/src/main/java/com/fdkankan/indoor/core/entity/DataSetEntity.java

@@ -1,8 +1,11 @@
 package com.fdkankan.indoor.core.entity;
 
+import com.fdkankan.indoor.core.entity.po.DataSetPo;
 import lombok.Data;
 import org.springframework.data.mongodb.core.mapping.Document;
 
+import java.util.List;
+
 
 /**
  * Created by owen on 2021/7/28 0027 10:42
@@ -12,10 +15,7 @@ import org.springframework.data.mongodb.core.mapping.Document;
 @Data
 public class DataSetEntity extends BaseEntity {
 
-
-    private String sceneCode;
-
-    private Object data;
+    private List<DataSetPo> data;
 
 
 }

+ 47 - 0
laser/src/main/java/com/fdkankan/indoor/core/entity/po/DataSetPo.java

@@ -0,0 +1,47 @@
+package com.fdkankan.indoor.core.entity.po;
+
+import com.fdkankan.indoor.core.entity.dto.SecurityDto;
+import lombok.Data;
+
+/**
+ * Created by owen on 2021/8/2 0002 14:42
+ * 场景的描述信息, 模型信息
+ */
+@Data
+public class DataSetPo {
+
+    private Integer id;
+
+    private Integer bundle_id;
+
+    private String type;
+
+    private String name;
+
+    private String title;
+
+    private String color;
+    private Boolean visible;
+
+    // 原点转的
+    private Double[] location;
+    private Double orientation;
+    private Integer[] site_model_entity_ids;
+
+    private String point_cloud_type;
+
+    private Double[] bounding_box_min;
+    private Double[] bounding_box_max;
+
+    // 是否有深度图
+    private Boolean has_depth_images;
+
+    // 是否有深度图
+    private Boolean has_images;
+
+    // 读写权限
+    private SecurityDto security;
+
+
+
+}

+ 1 - 1
laser/src/main/java/com/fdkankan/indoor/core/mapper/DataSetMapper.java

@@ -11,5 +11,5 @@ import org.springframework.stereotype.Component;
 @Component
 public interface DataSetMapper extends MongoRepository<DataSetEntity, String> {
 
-    DataSetEntity findBySceneCode(String sceneCode);
+//    DataSetEntity findBySceneCode(String sceneCode);
 }

+ 3 - 0
laser/src/main/java/com/fdkankan/indoor/core/service/DataSetService.java

@@ -1,5 +1,6 @@
 package com.fdkankan.indoor.core.service;
 
+import com.fdkankan.indoor.base.util.Result;
 import com.fdkankan.indoor.core.entity.DataSetEntity;
 
 /**
@@ -7,4 +8,6 @@ import com.fdkankan.indoor.core.entity.DataSetEntity;
  */
 public interface DataSetService {
     void save(DataSetEntity entity);
+
+    Result getDataSet(String sceneCode);
 }

+ 4 - 4
laser/src/main/java/com/fdkankan/indoor/core/service/FilterService.java

@@ -13,12 +13,12 @@ import com.fdkankan.indoor.core.entity.FilterEntity;
 public interface FilterService {
 
 
-    Result findById(String sceneCode, Integer id);
+//    Result findById(String sceneCode, Integer id);
 
-    Result query(String code, QueryJsonDataOne queryJsonDataOne, QueryJsonDataTwo queryJsonDataTwo, JsonDataDetailDto jsonDataDetailDto);
-    Result query_5(String code, QueryJsonDataOne queryJsonDataOne, QueryJsonDataTwo queryJsonDataTwo, JsonDataDetailDto jsonDataDetailDto);
+//    Result query(String code, QueryJsonDataOne queryJsonDataOne, QueryJsonDataTwo queryJsonDataTwo, JsonDataDetailDto jsonDataDetailDto);
+//    Result query_5(String code, QueryJsonDataOne queryJsonDataOne, QueryJsonDataTwo queryJsonDataTwo, JsonDataDetailDto jsonDataDetailDto);
 
-    Result findById1(String sceneCode, Integer id);
+//    Result findById1(String sceneCode, Integer id);
 
 
     void save(FilterEntity entity);

+ 43 - 1
laser/src/main/java/com/fdkankan/indoor/core/service/impl/DataSetServiceImpl.java

@@ -1,18 +1,26 @@
 package com.fdkankan.indoor.core.service.impl;
 
+import com.fdkankan.indoor.base.util.Result;
 import com.fdkankan.indoor.core.entity.DataSetEntity;
+import com.fdkankan.indoor.core.entity.dto.PoiHotDto;
+import com.fdkankan.indoor.core.entity.dto.SecurityDto;
+import com.fdkankan.indoor.core.entity.po.DataSetPo;
 import com.fdkankan.indoor.core.mapper.DataSetMapper;
 import com.fdkankan.indoor.core.service.DataSetService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
 /**
  * Created by owen on 2021/7/28 0028 20:05
  */
 @Service
 @Slf4j
-public class DataSetServiceImpl implements DataSetService {
+public class DataSetServiceImpl extends IBaseServiceImpl implements DataSetService {
 
     @Autowired
     DataSetMapper dataSetMapper;
@@ -21,4 +29,38 @@ public class DataSetServiceImpl implements DataSetService {
     public void save(DataSetEntity entity) {
         dataSetMapper.save(entity);
     }
+
+    @Override
+    public Result getDataSet(String sceneCode) {
+        DataSetEntity entity = findById(sceneCode);
+        return Result.success(entity.getData());
+    }
+
+    private DataSetEntity findById(String sceneCode){
+        Optional<DataSetEntity> optional = dataSetMapper.findById(sceneCode);
+        // 处理是否登录
+        DataSetEntity entity = optional.get();
+
+        if (isLogin()){
+            return entity;
+        }
+
+        entity.setData(changeSecurityUnLoginList(entity.getData()));
+            return entity;
+
+    }
+
+
+    private List<DataSetPo> changeSecurityUnLoginList(List<DataSetPo> param){
+
+        List<DataSetPo> result = new ArrayList<>();
+        for (DataSetPo dto : param) {
+            dto.setSecurity(changeSecurityUnLogin());
+            result.add(dto);
+        }
+        return result;
+    }
+
+
+
 }

Разлика између датотеке није приказан због своје велике величине
+ 625 - 601
laser/src/main/java/com/fdkankan/indoor/core/service/impl/FilterServiceImpl.java


+ 13 - 0
laser/src/main/java/com/fdkankan/indoor/core/service/impl/IBaseServiceImpl.java

@@ -46,6 +46,19 @@ public class IBaseServiceImpl {
         return true;
 
     }
+
+    /**
+     * 未登录, can_write: false
+     * @param
+     * @return
+     */
+    public SecurityDto changeSecurityUnLogin(){
+        SecurityDto dto = new SecurityDto();
+        dto.setCan_write(false);
+        dto.setGroup_read(0);
+        dto.setGroup_write(1);
+        return dto;
+    }
 }
 
 

+ 48 - 45
laser/src/main/java/com/fdkankan/indoor/core/service/impl/InitServiceImpl.java

@@ -12,6 +12,7 @@ import com.fdkankan.indoor.base.util.Result;
 import com.fdkankan.indoor.base.util.SnowFlakeUUidUtils;
 import com.fdkankan.indoor.core.entity.dto.*;
 import com.fdkankan.indoor.core.entity.*;
+import com.fdkankan.indoor.core.entity.po.DataSetPo;
 import com.fdkankan.indoor.core.mapper.InitMapper;
 import com.fdkankan.indoor.core.service.*;
 import lombok.extern.slf4j.Slf4j;
@@ -125,46 +126,6 @@ public class InitServiceImpl implements InitService {
         return Result.success();
     }
 
-    /**
-     * 替换两个文件的c 换成场景码
-     * index.html
-     * /locat/addDataSet.html
-     * @param sceneCode
-     */
-    private void replaceHtml(String sceneCode) {
-        String indexName = "index.html";
-        String addDataSetName = "addDataSet.html";
-
-        String basePath = configConstant.serverBasePath + "/" + sceneCode + "/" ;
-        String indexPath = basePath + indexName;
-        String addDateSetPath = basePath + "locat/" + addDataSetName;
-
-        String indexStr = cn.hutool.core.io.FileUtil.readUtf8String(indexPath);
-        String dataSetStr = cn.hutool.core.io.FileUtil.readUtf8String(addDateSetPath);
-
-        indexStr = indexStr.replaceAll("@replace", sceneCode);
-        dataSetStr = dataSetStr.replaceAll("@replace", sceneCode);
-
-        cn.hutool.core.io.FileUtil.writeUtf8String(indexStr, indexPath);
-        cn.hutool.core.io.FileUtil.writeUtf8String(dataSetStr, addDateSetPath);
-        log.info("html文件替完成");
-
-    }
-
-
-    /**
-     * 复制静态资源
-     * @param sceneCode
-     */
-    private void copyDefault(String sceneCode) {
-        // /. 是复制该目录下所有文件
-        String source = configConstant.serverBasePath + "/default/.";
-        String target = configConstant.serverBasePath + "/" + sceneCode;
-        String cmd = "cp -r " + source + " " + target;
-        CmdUtils.callLine(cmd);
-        log.info("复制default目录完成");
-    }
-
 
     /**
      * 需要控制点,才能完成以下操作
@@ -208,6 +169,49 @@ public class InitServiceImpl implements InitService {
         log.info("initDataStep_2处理完成");
     }
 
+    /**
+     * 替换两个文件的c 换成场景码
+     * index.html
+     * /locat/addDataSet.html
+     * @param sceneCode
+     */
+    private void replaceHtml(String sceneCode) {
+        String indexName = "index.html";
+        String addDataSetName = "addDataSet.html";
+
+        String basePath = configConstant.serverBasePath + "/" + sceneCode + "/" ;
+        String indexPath = basePath + indexName;
+        String addDateSetPath = basePath + "locat/" + addDataSetName;
+
+        String indexStr = cn.hutool.core.io.FileUtil.readUtf8String(indexPath);
+        String dataSetStr = cn.hutool.core.io.FileUtil.readUtf8String(addDateSetPath);
+
+        indexStr = indexStr.replaceAll("@replace", sceneCode);
+        dataSetStr = dataSetStr.replaceAll("@replace", sceneCode);
+
+        cn.hutool.core.io.FileUtil.writeUtf8String(indexStr, indexPath);
+        cn.hutool.core.io.FileUtil.writeUtf8String(dataSetStr, addDateSetPath);
+        log.info("html文件替完成");
+
+    }
+
+
+    /**
+     * 复制静态资源
+     * @param sceneCode
+     */
+    private void copyDefault(String sceneCode) {
+        // /. 是复制该目录下所有文件
+        String source = configConstant.serverBasePath + "/default/.";
+        String target = configConstant.serverBasePath + "/" + sceneCode;
+        String cmd = "cp -r " + source + " " + target;
+        CmdUtils.callLine(cmd);
+        log.info("复制default目录完成");
+    }
+
+
+
+
     @Override
     public List<InitEntity> findByStatus(Integer status) {
         return initMapper.findByStatus(status);
@@ -422,15 +426,14 @@ public class InitServiceImpl implements InitService {
 
     private void createDataSet(String sceneCode){
         DataSetEntity entity = new DataSetEntity();
-        entity.setId(SnowFlakeUUidUtils.getUuid("DS"));
-        entity.setSceneCode(sceneCode);
+        entity.setId(sceneCode);
         entity.setUpdateTime(LocalDateTime.now());
         // 设置原点坐标,通过场景码查询特殊点表的原点
         SpecialPointEntity sp = specialPointService.findBySceneCodeAndPoiKey(sceneCode, TypeConstant.POI_ORIGIN);
         Double[] poi = sp.getPoi();
-        log.info("原点坐标11111: {}", poi.toString());
-        JSONObject dataSet = ModifyDataSets.createDataSet(poi);
-        entity.setData(dataSet);
+//        JSONObject dataSet = ModifyDataSets.createDataSet(poi);
+        DataSetPo po = ModifyDataSets.createDataSetPo(poi);
+        entity.setData(Arrays.asList(po));
         dataSetService.save(entity);
         log.info("DataSet数据初始化创建完成");
     }

+ 7 - 8
laser/src/main/java/com/fdkankan/indoor/core/service/impl/PoiServiceImpl.java

@@ -196,16 +196,15 @@ public class PoiServiceImpl extends IBaseServiceImpl implements PoiService {
      * @param
      * @return
      */
-    private SecurityDto changeSecurityUnLogin(){
-        SecurityDto dto = new SecurityDto();
-        dto.setCan_write(false);
-        dto.setGroup_read(0);
-        dto.setGroup_write(1);
-        return dto;
-    }
+//    private SecurityDto changeSecurityUnLogin(){
+//        SecurityDto dto = new SecurityDto();
+//        dto.setCan_write(false);
+//        dto.setGroup_read(0);
+//        dto.setGroup_write(1);
+//        return dto;
+//    }
 
     private List<PoiHotDto> changeSecurityUnLoginList(List<PoiHotDto> param){
-//        List<PoiHotDto> collect = param.stream().peek(p -> p.setSecurity(changeSecurityUnLogin())).collect(Collectors.toList());
 
         List<PoiHotDto> result = new ArrayList<>();
         for (PoiHotDto dto : param) {

+ 1 - 1
laser/src/main/java/com/fdkankan/indoor/core/service/impl/SiteServiceImpl.java

@@ -1,8 +1,8 @@
 package com.fdkankan.indoor.core.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.indoor.base.convert.DistanceUtil;
 import com.fdkankan.indoor.base.util.GisUtils;
-import com.fdkankan.indoor.base.util.DistanceUtil;
 import com.fdkankan.indoor.base.util.Result;
 import com.fdkankan.indoor.core.entity.SiteModelEntity;
 import com.fdkankan.indoor.core.entity.dto.SiteDto;