|
@@ -96,10 +96,12 @@ public class InitServiceImpl implements InitService {
|
|
|
@Autowired
|
|
|
ControlPointCalculateService controlPointCalculateService;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* initDataStep1
|
|
|
* 有顺序分,不能乱
|
|
|
- * from :age 四维看看重算,其他:手动重算
|
|
|
+ * from :age 四维看看重算,其他:手动重算
|
|
|
*/
|
|
|
@Override
|
|
|
public Result initData(InitDto param) {
|
|
@@ -121,7 +123,7 @@ public class InitServiceImpl implements InitService {
|
|
|
|
|
|
// 重算
|
|
|
|
|
|
- if ("recount".equals(from)){
|
|
|
+ if ("recount".equals(from)) {
|
|
|
log.info("进行手动重新");
|
|
|
path = init.getPath();
|
|
|
title = init.getTitle();
|
|
@@ -178,14 +180,13 @@ public class InitServiceImpl implements InitService {
|
|
|
copyDefault(sceneCode);
|
|
|
|
|
|
|
|
|
- //step8 替换index.html、/locat/addDataSet.html的场景码, @replace, @title
|
|
|
+ //step8 替换index.html、/locat/addDataSet.html的场景码, @replace, @title
|
|
|
replaceHtml(sceneCode, title);
|
|
|
|
|
|
// step9 创建 t_measurement表, 测量表,空数据
|
|
|
createMeasurement(sceneCode);
|
|
|
|
|
|
|
|
|
-
|
|
|
log.info("================== 初始化第一步完成 ==================");
|
|
|
|
|
|
/**
|
|
@@ -196,7 +197,7 @@ public class InitServiceImpl implements InitService {
|
|
|
String controlPointPath = laserDataPath + "/controlPoint.json";
|
|
|
log.info("控制点文件路径:{}", controlPointPath);
|
|
|
boolean flag = false;
|
|
|
- if (cn.hutool.core.io.FileUtil.exist(controlPointPath)){
|
|
|
+ if (cn.hutool.core.io.FileUtil.exist(controlPointPath)) {
|
|
|
log.info("处理控制点逻辑");
|
|
|
createControlPoint(sceneCode, laserDataPath);
|
|
|
flag = true;
|
|
@@ -212,7 +213,7 @@ public class InitServiceImpl implements InitService {
|
|
|
init.setRecount(recount);
|
|
|
|
|
|
|
|
|
- if (flag){
|
|
|
+ if (flag) {
|
|
|
init.setStatus(1);
|
|
|
log.info("完全初始化完成");
|
|
|
} else {
|
|
@@ -226,22 +227,19 @@ public class InitServiceImpl implements InitService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 这个方法可以本地调试
|
|
|
* 需要控制点,才能完成以下操作
|
|
|
* 重新输入控制点时, 把相应数据删除, 重新初始化
|
|
|
*
|
|
|
- *
|
|
|
* @param sceneCode
|
|
|
*/
|
|
|
@Override
|
|
|
- public void initDataStep2(String sceneCode){
|
|
|
+ public void initDataStep2(String sceneCode, String from) {
|
|
|
|
|
|
Optional<InitEntity> optional = initMapper.findById(sceneCode);
|
|
|
- if (!optional.isPresent()){
|
|
|
- throw new BaseRuntimeException(MsgCode.e3001,"此场景的数据初始化不存在");
|
|
|
+ if (!optional.isPresent()) {
|
|
|
+ throw new BaseRuntimeException(MsgCode.e3001, "此场景的数据初始化不存在");
|
|
|
}
|
|
|
InitEntity init = optional.get();
|
|
|
|
|
@@ -262,10 +260,9 @@ public class InitServiceImpl implements InitService {
|
|
|
log.info("更新控制点计算完成");
|
|
|
|
|
|
|
|
|
-
|
|
|
// step1: 处理vision.txt 创建filter表, 处理特殊点:firstView
|
|
|
// createFilter(sceneCode, laserDataPath, controlPoint);
|
|
|
- createFilter(sceneCode, laserDataPath, calculateEntity);
|
|
|
+ createFilter(sceneCode, laserDataPath, calculateEntity, from);
|
|
|
|
|
|
// step2 处理could.js、创建sitModel, 使用的是代码初始化,创建site_model, 处理原点、中心点、最大点、最小点
|
|
|
// processCould(sceneCode, laserDataPath, controlPoint);
|
|
@@ -275,11 +272,14 @@ public class InitServiceImpl implements InitService {
|
|
|
createConfig(sceneCode);
|
|
|
|
|
|
// step7 创建t_datasets表, 使用的是代码, 需要处理原点之后执行
|
|
|
- createDataSet(sceneCode, laserDataPath, calculateEntity.getRotation2());
|
|
|
+ DataSetPo dataSet = createDataSet(sceneCode, laserDataPath, calculateEntity.getRotation2(), from);
|
|
|
// createDataSet(sceneCode, laserDataPath, calculateEntity);
|
|
|
|
|
|
// step 10 创建 t_tiled_map表, 需要用到dataSet数据
|
|
|
- tiledMapService.init(sceneCode);
|
|
|
+ tiledMapService.init(sceneCode, from);
|
|
|
+
|
|
|
+ // Route数据重新计算, 并保存数据库
|
|
|
+ routeService.updateRouteByControlPointCalculate(dataSet.getLocation(), dataSet.getOrientation(), sceneCode, calculateEntity, laserDataPath);
|
|
|
|
|
|
|
|
|
// step8 目录pano、pano_depth、webcloud上传oss, 初始化合并场景码跟原来的一样
|
|
@@ -293,32 +293,11 @@ public class InitServiceImpl implements InitService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-// @Override
|
|
|
-// public void initSiteModel(String sceneCode){
|
|
|
-// // step1: 获取控制点
|
|
|
-// ControlPointEntity controlPoint = getControlPoint(sceneCode);
|
|
|
-// if (controlPoint == null){
|
|
|
-// throw new BaseRuntimeException("控制点不存在:" + sceneCode);
|
|
|
-// }
|
|
|
-//
|
|
|
-// // step2: init数据路径
|
|
|
-// InitEntity initEntity = this.findById(sceneCode);
|
|
|
-// if (initEntity == null) {
|
|
|
-// throw new BaseRuntimeException("初始化数据不存在:" + sceneCode);
|
|
|
-// }
|
|
|
-// String path = initEntity.getPath();
|
|
|
-// path = path + "/laserData";
|
|
|
-//
|
|
|
-// processCould(sceneCode, path, controlPoint);
|
|
|
-//
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
@Override
|
|
|
- public void initSiteModel(String sceneCode){
|
|
|
+ public void initSiteModel(String sceneCode) {
|
|
|
// step1: 获取控制点
|
|
|
ControlPointCalculateEntity controlPoint = getControlPointCalculate(sceneCode);
|
|
|
- if (controlPoint == null){
|
|
|
+ if (controlPoint == null) {
|
|
|
throw new BaseRuntimeException("控制点计算不存在:" + sceneCode);
|
|
|
}
|
|
|
|
|
@@ -338,20 +317,26 @@ public class InitServiceImpl implements InitService {
|
|
|
|
|
|
/**
|
|
|
* 输入控制点,需要把相关数据从新初始化
|
|
|
+ *
|
|
|
* @param sceneCode
|
|
|
*/
|
|
|
- private void removeInitDataStep2(String sceneCode){
|
|
|
+ private void removeInitDataStep2(String sceneCode) {
|
|
|
filterService.remove(sceneCode);
|
|
|
specialPointService.remove(sceneCode);
|
|
|
configService.remove(sceneCode);
|
|
|
dataSetService.remove(sceneCode);
|
|
|
siteService.remove(sceneCode);
|
|
|
+ tiledMapService.remove(sceneCode);
|
|
|
+ // 2021-09-15
|
|
|
+ routeService.remove(sceneCode);
|
|
|
+
|
|
|
|
|
|
log.info("删除initDataStep2数据完成");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 重算场景
|
|
|
+ *
|
|
|
* @param sceneCode
|
|
|
* @return
|
|
|
*/
|
|
@@ -359,7 +344,6 @@ public class InitServiceImpl implements InitService {
|
|
|
public Result initRecount(String sceneCode) {
|
|
|
|
|
|
|
|
|
-
|
|
|
log.info("执行手动重新:{}", sceneCode);
|
|
|
// 重新初始化数据, 地址在里面处理
|
|
|
InitDto initDto = new InitDto();
|
|
@@ -381,13 +365,14 @@ public class InitServiceImpl implements InitService {
|
|
|
/**
|
|
|
* 替换两个文件的c 换成场景码
|
|
|
* index.html
|
|
|
+ *
|
|
|
* @param sceneCode
|
|
|
* @param title
|
|
|
*/
|
|
|
private void replaceHtml(String sceneCode, String title) {
|
|
|
String indexName = "index.html";
|
|
|
|
|
|
- String basePath = configConstant.serverBasePath + "/" + sceneCode + "/" ;
|
|
|
+ String basePath = configConstant.serverBasePath + "/" + sceneCode + "/";
|
|
|
String indexPath = basePath + indexName;
|
|
|
|
|
|
String indexStr = cn.hutool.core.io.FileUtil.readUtf8String(indexPath);
|
|
@@ -411,12 +396,13 @@ public class InitServiceImpl implements InitService {
|
|
|
|
|
|
/**
|
|
|
* 初始化控制点
|
|
|
+ *
|
|
|
* @param sceneCode
|
|
|
* @param laserDataPath
|
|
|
*/
|
|
|
private void createControlPoint(String sceneCode, String laserDataPath) {
|
|
|
String path = laserDataPath + "/controlPoint.json";
|
|
|
- if (!cn.hutool.core.io.FileUtil.exist(path)){
|
|
|
+ if (!cn.hutool.core.io.FileUtil.exist(path)) {
|
|
|
throw new BaseRuntimeException("控制点文件不存在: " + path);
|
|
|
}
|
|
|
|
|
@@ -439,8 +425,8 @@ public class InitServiceImpl implements InitService {
|
|
|
double ageX_2 = poi_2.getJSONObject("location").getDouble("x");
|
|
|
double ageY_2 = poi_2.getJSONObject("location").getDouble("y");
|
|
|
|
|
|
- double[] gpsCoord1 = {gpsLon_1, gpsLat_1 };
|
|
|
- double[] gpsCoord2 = { gpsLon_2, gpsLat_2};
|
|
|
+ double[] gpsCoord1 = {gpsLon_1, gpsLat_1};
|
|
|
+ double[] gpsCoord2 = {gpsLon_2, gpsLat_2};
|
|
|
double[] ageLocation1 = {ageX_1, ageY_1};
|
|
|
double[] ageLocation2 = {ageX_2, ageY_2};
|
|
|
|
|
@@ -465,7 +451,7 @@ public class InitServiceImpl implements InitService {
|
|
|
log.info("算法控制点保存完成");
|
|
|
|
|
|
// 执行initData2 初始化
|
|
|
- this.initDataStep2(sceneCode);
|
|
|
+ this.initDataStep2(sceneCode, "age");
|
|
|
|
|
|
log.info("controlPoint控制点初始化完成");
|
|
|
}
|
|
@@ -480,9 +466,9 @@ public class InitServiceImpl implements InitService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 复制静态资源
|
|
|
+ *
|
|
|
* @param sceneCode
|
|
|
*/
|
|
|
private void copyDefault(String sceneCode) {
|
|
@@ -495,8 +481,6 @@ public class InitServiceImpl implements InitService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
public List<InitEntity> findByStatus(Integer status) {
|
|
|
return initMapper.findByStatus(status);
|
|
@@ -536,7 +520,6 @@ public class InitServiceImpl implements InitService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public Result testRemove(String sceneCode) {
|
|
|
this.initRemove(sceneCode);
|
|
@@ -544,11 +527,11 @@ public class InitServiceImpl implements InitService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void testInitDataStep2(String sceneCode) {
|
|
|
+ public void testInitDataStep2(String sceneCode, String from) {
|
|
|
|
|
|
Optional<InitEntity> optional = initMapper.findById(sceneCode);
|
|
|
- if (!optional.isPresent()){
|
|
|
- throw new BaseRuntimeException(MsgCode.e3001,"此场景的数据初始化不存在");
|
|
|
+ if (!optional.isPresent()) {
|
|
|
+ throw new BaseRuntimeException(MsgCode.e3001, "此场景的数据初始化不存在");
|
|
|
}
|
|
|
InitEntity init = optional.get();
|
|
|
|
|
@@ -568,7 +551,7 @@ public class InitServiceImpl implements InitService {
|
|
|
log.info("更新控制点计算完成");
|
|
|
|
|
|
// step1: 处理vision.txt 创建filter表, 处理特殊点:firstView
|
|
|
- createFilter(sceneCode, laserDataPath, calculateEntity);
|
|
|
+ createFilter(sceneCode, laserDataPath, calculateEntity, from);
|
|
|
|
|
|
// step2 处理could.js 使用的是代码初始化,创建site_model, 处理原点、中心点、最大点、最小点
|
|
|
processCould(sceneCode, laserDataPath, calculateEntity);
|
|
@@ -577,7 +560,11 @@ public class InitServiceImpl implements InitService {
|
|
|
createConfig(sceneCode);
|
|
|
|
|
|
// step7 创建t_datasets表, 使用的是代码, 需要处理原点之后执行, dataSet.orientation: 计算控制点结果rotation2
|
|
|
- createDataSet(sceneCode, laserDataPath, calculateEntity.getRotation2());
|
|
|
+ DataSetPo dataSet = createDataSet(sceneCode, laserDataPath, calculateEntity.getRotation2(), from);
|
|
|
+
|
|
|
+ // Route数据重新计算, 并保存数据库
|
|
|
+ routeService.updateRouteByControlPointCalculate(dataSet.getLocation(), dataSet.getOrientation(), sceneCode, calculateEntity, laserDataPath);
|
|
|
+
|
|
|
|
|
|
|
|
|
// step8 目录pano、pano_depth、webcloud上传oss,
|
|
@@ -592,30 +579,14 @@ public class InitServiceImpl implements InitService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-// // 这个不能本地调试
|
|
|
-// private void createFilter(String sceneCode, String path, ControlPointEntity dto){
|
|
|
-// path = path +"/vision.txt";
|
|
|
-// if (!cn.hutool.core.io.FileUtil.isFile(path)){
|
|
|
-// throw new BaseRuntimeException(MsgCode.e3001, "vision.txt不存在");
|
|
|
-// }
|
|
|
-// JSONArray jsonArray = convertToVision.createFilter(sceneCode, path, dto);
|
|
|
-// FilterEntity entity = new FilterEntity();
|
|
|
-// entity.setId(sceneCode);
|
|
|
-// entity.setCreateTime(LocalDateTime.now());
|
|
|
-// //将array数组转换成对象
|
|
|
-// List<FilterHotDto> list = JSONArray.toList(jsonArray, FilterHotDto.class);
|
|
|
-// entity.setData(list);
|
|
|
-// filterService.save(entity);
|
|
|
-// log.info("filter数据初始化创建完成");
|
|
|
-// }
|
|
|
|
|
|
// 这个不能本地调试
|
|
|
- private void createFilter(String sceneCode, String path, ControlPointCalculateEntity calculateEntity){
|
|
|
- path = path +"/vision.txt";
|
|
|
- if (!cn.hutool.core.io.FileUtil.isFile(path)){
|
|
|
+ private void createFilter(String sceneCode, String path, ControlPointCalculateEntity calculateEntity, String from) {
|
|
|
+ path = path + "/vision.txt";
|
|
|
+ if (!cn.hutool.core.io.FileUtil.isFile(path)) {
|
|
|
throw new BaseRuntimeException(MsgCode.e3001, "vision.txt不存在");
|
|
|
}
|
|
|
- JSONArray jsonArray = convertToVision.createFilter(sceneCode, path, calculateEntity);
|
|
|
+ JSONArray jsonArray = convertToVision.createFilter(sceneCode, path, calculateEntity, from);
|
|
|
FilterEntity entity = new FilterEntity();
|
|
|
entity.setId(sceneCode);
|
|
|
entity.setCreateTime(LocalDateTime.now());
|
|
@@ -629,15 +600,16 @@ public class InitServiceImpl implements InitService {
|
|
|
|
|
|
/**
|
|
|
* 处理could.js 并做相应的计算
|
|
|
+ *
|
|
|
* @param sceneCode
|
|
|
* @param path
|
|
|
*/
|
|
|
- private void processCould(String sceneCode, String path, ControlPointCalculateEntity dto){
|
|
|
+ private void processCould(String sceneCode, String path, ControlPointCalculateEntity dto) {
|
|
|
path = path + "/webcloud/cloud.js";
|
|
|
// 处理原点,将原点坐标转为坐标, 转换后的原点只有经纬度,没有高度, 高度现在默认是0
|
|
|
double[] doubles = ModifyCloud.convertFromOrigin(dto);
|
|
|
// 2021-08-4 原点默认 z:0
|
|
|
- Double[] gpsOrigin = {doubles[0] ,doubles[1], 0.0};
|
|
|
+ Double[] gpsOrigin = {doubles[0], doubles[1], 0.0};
|
|
|
// 将数据保存到db, dateSet数据location使用
|
|
|
saveSpecialPoint(sceneCode, TypeConstant.POI_ORIGIN, null, gpsOrigin);
|
|
|
log.info("原点保存成功");
|
|
@@ -668,9 +640,9 @@ public class InitServiceImpl implements InitService {
|
|
|
|
|
|
|
|
|
// 虚拟点坐标(四维看看坐标)
|
|
|
- Double[] ageMax = {maxX,maxY,maxZ};
|
|
|
- Double[] ageMin = {minX,minY,minZ};
|
|
|
- Double[] ageCentre = {centreX,centreY,centreZ};
|
|
|
+ Double[] ageMax = {maxX, maxY, maxZ};
|
|
|
+ Double[] ageMin = {minX, minY, minZ};
|
|
|
+ Double[] ageCentre = {centreX, centreY, centreZ};
|
|
|
|
|
|
JSONObject resJson = ModifyCloud.convertFromBoundingBox(boundingBox, dto);
|
|
|
|
|
@@ -694,75 +666,10 @@ public class InitServiceImpl implements InitService {
|
|
|
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * 处理could.js 并做相应的计算
|
|
|
-// * @param sceneCode
|
|
|
-// * @param path
|
|
|
-// */
|
|
|
-// private void processCould(String sceneCode, String path, ControlPointEntity dto){
|
|
|
-// path = path + "/webcloud/cloud.js";
|
|
|
-// // 处理原点,将原点坐标转为坐标, 转换后的原点只有经纬度,没有高度, 高度现在默认是0
|
|
|
-// double[] doubles = ModifyCloud.convertFromOrigin(dto);
|
|
|
-// // 2021-08-4 原点默认 z:0
|
|
|
-// Double[] gpsOrigin = {doubles[0] ,doubles[1], 0.0};
|
|
|
-// // 将数据保存到db, dateSet数据location使用
|
|
|
-// saveSpecialPoint(sceneCode, TypeConstant.POI_ORIGIN, null, gpsOrigin);
|
|
|
-// log.info("原点保存成功");
|
|
|
-//
|
|
|
-// try {
|
|
|
-// // 修改cloud.js文件
|
|
|
-// JSONObject info = ModifyCloud.fixCloud(path);
|
|
|
-//
|
|
|
-// cn.hutool.core.io.FileUtil.writeUtf8String(info.toString(), path);
|
|
|
-// log.info("新的cloud.js写入服务器完成:{}", path);
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 将boundingBox坐标转换成gis坐标, site_model需要
|
|
|
-// * boundingBox:虚拟点坐标,存特殊点, dataSet数据要使用
|
|
|
-// */
|
|
|
-// JSONObject boundingBox = ModifyCloud.getBoundingBox(info);
|
|
|
-// Double maxX = boundingBox.getDouble("maxX");
|
|
|
-// Double maxY = boundingBox.getDouble("maxY");
|
|
|
-// Double maxZ = boundingBox.getDouble("maxZ");
|
|
|
-//
|
|
|
-// Double minX = boundingBox.getDouble("minX");
|
|
|
-// Double minY = boundingBox.getDouble("minY");
|
|
|
-// Double minZ = boundingBox.getDouble("minZ");
|
|
|
-//
|
|
|
-// Double centreX = boundingBox.getDouble("centreX");
|
|
|
-// Double centreY = boundingBox.getDouble("centreY");
|
|
|
-// Double centreZ = boundingBox.getDouble("centreZ");
|
|
|
-//
|
|
|
-//
|
|
|
-// // 虚拟点坐标(四维看看坐标)
|
|
|
-// Double[] ageMax = {maxX,maxY,maxZ};
|
|
|
-// Double[] ageMin = {minX,minY,minZ};
|
|
|
-// Double[] ageCentre = {centreX,centreY,centreZ};
|
|
|
-//
|
|
|
-// JSONObject resJson = ModifyCloud.convertFromBoundingBox(boundingBox, dto);
|
|
|
-//
|
|
|
-// Double[] gpsMax = getKey(resJson, "max");
|
|
|
-// Double[] gpsMin = getKey(resJson, "min");
|
|
|
-// Double[] gpsCentre = getKeyZ(resJson, "centre");
|
|
|
-//
|
|
|
-// // 将数据保存到db
|
|
|
-// saveSpecialPoint(sceneCode, TypeConstant.POI_BOUNDINGBOX_MAX, ageMax, gpsMax);
|
|
|
-// saveSpecialPoint(sceneCode, TypeConstant.POI_BOUNDINGBOX_MIN, ageMin, gpsMin);
|
|
|
-// saveSpecialPoint(sceneCode, TypeConstant.POI_CENTRE, ageCentre, gpsCentre);
|
|
|
-// log.info("max、min、中心点保存成功");
|
|
|
-//
|
|
|
-//
|
|
|
-// // 创建sitModel
|
|
|
-// createSiteModel(sceneCode, gpsMax, gpsMin, gpsCentre, maxZ, minZ);
|
|
|
-//
|
|
|
-// } catch (IOException e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
|
|
|
|
|
|
- private void createSiteModel(String sceneCode, Double[] max, Double[] min, Double[] centre, Double maxZ, Double minZ){
|
|
|
+
|
|
|
+ private void createSiteModel(String sceneCode, Double[] max, Double[] min, Double[] centre, Double maxZ, Double minZ) {
|
|
|
//读取初始文件
|
|
|
String content = cn.hutool.core.io.FileUtil.readUtf8String(configConstant.templatePath + "/site_model.json");
|
|
|
List<SiteDto> siteModels = JSON.parseArray(content, SiteDto.class);
|
|
@@ -770,10 +677,10 @@ public class InitServiceImpl implements InitService {
|
|
|
// max、min四个顶点替换BUILDING、FLOOR 的coordinates,
|
|
|
// 顺时针,(x_max,y_max),(x_max,y_min),(x_min,y_min),(x_min,y_max)
|
|
|
// 一般参数1:x, 参数2:Y
|
|
|
- Double[] peak_1 = {max[0],max[1]};
|
|
|
- Double[] peak_2 = {max[0],min[1]};
|
|
|
- Double[] peak_3 = {min[0],min[1]};
|
|
|
- Double[] peak_4 = {min[0],max[1]};
|
|
|
+ Double[] peak_1 = {max[0], max[1]};
|
|
|
+ Double[] peak_2 = {max[0], min[1]};
|
|
|
+ Double[] peak_3 = {min[0], min[1]};
|
|
|
+ Double[] peak_4 = {min[0], max[1]};
|
|
|
List<List<Double[]>> doubles = Arrays.asList(Arrays.asList(peak_1, peak_2, peak_3, peak_4));
|
|
|
|
|
|
// centre 替换BUILDING、FLOOR、ROOM 的center
|
|
@@ -789,7 +696,7 @@ public class InitServiceImpl implements InitService {
|
|
|
// 第二层:FLOOR 层
|
|
|
List<SiteDto> children = p.getChildren();
|
|
|
if (children.size() > 0) {
|
|
|
- children.forEach(c ->{
|
|
|
+ children.forEach(c -> {
|
|
|
c.setCenter(centre);
|
|
|
c.setZ_max(maxZ);
|
|
|
c.setZ_min(minZ);
|
|
@@ -821,12 +728,14 @@ public class InitServiceImpl implements InitService {
|
|
|
entity.setCreateTime(LocalDateTime.now());
|
|
|
// 默认热点为空
|
|
|
entity.setData(siteModels);
|
|
|
+ // 2021-09-15 默认最大id:20
|
|
|
+ entity.setMaxId(20);
|
|
|
siteService.save(entity);
|
|
|
log.info("siteModel数据初始化创建完成");
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testSiteModel(){
|
|
|
+ public void testSiteModel() {
|
|
|
String content = MyFileUtils.getResourceContent("data/site_model.json");
|
|
|
List<SiteDto> siteModels = JSON.parseArray(content, SiteDto.class);
|
|
|
|
|
@@ -837,11 +746,12 @@ public class InitServiceImpl implements InitService {
|
|
|
/**
|
|
|
* 获取两个值的
|
|
|
* json数组转 double[]
|
|
|
+ *
|
|
|
* @param resJson
|
|
|
* @param key
|
|
|
* @return
|
|
|
*/
|
|
|
- private Double[] getKey(JSONObject resJson , String key){
|
|
|
+ private Double[] getKey(JSONObject resJson, String key) {
|
|
|
JSONArray array = resJson.getJSONArray(key);
|
|
|
Double[] res = {array.getDouble(0), array.getDouble(1)};
|
|
|
return res;
|
|
@@ -849,11 +759,12 @@ public class InitServiceImpl implements InitService {
|
|
|
|
|
|
/**
|
|
|
* 获取三个值的
|
|
|
+ *
|
|
|
* @param resJson
|
|
|
* @param key
|
|
|
* @return
|
|
|
*/
|
|
|
- private Double[] getKeyZ(JSONObject resJson , String key){
|
|
|
+ private Double[] getKeyZ(JSONObject resJson, String key) {
|
|
|
JSONArray array = resJson.getJSONArray(key);
|
|
|
Double[] res = {array.getDouble(0), array.getDouble(1), array.getDouble(2)};
|
|
|
return res;
|
|
@@ -865,7 +776,7 @@ public class InitServiceImpl implements InitService {
|
|
|
* @param poiKey key
|
|
|
* @param agePoi 虚拟点坐标(四维看看坐标)
|
|
|
*/
|
|
|
- private void saveSpecialPoint(String sceneCode, String poiKey, Double[] agePoi, Double[] gpsPoi){
|
|
|
+ private void saveSpecialPoint(String sceneCode, String poiKey, Double[] agePoi, Double[] gpsPoi) {
|
|
|
SpecialPointEntity entity = new SpecialPointEntity();
|
|
|
entity.setId(SnowFlakeUUidUtils.getUuid("SP"));
|
|
|
entity.setUpdateTime(LocalDateTime.now());
|
|
@@ -876,7 +787,7 @@ public class InitServiceImpl implements InitService {
|
|
|
specialPointService.save(entity);
|
|
|
}
|
|
|
|
|
|
- private void createPoi(String sceneCode){
|
|
|
+ private void createPoi(String sceneCode) {
|
|
|
PoiEntity entity = new PoiEntity();
|
|
|
entity.setId(sceneCode);
|
|
|
entity.setUpdateTime(LocalDateTime.now());
|
|
@@ -888,7 +799,7 @@ public class InitServiceImpl implements InitService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void createPoiType(String sceneCode){
|
|
|
+ private void createPoiType(String sceneCode) {
|
|
|
PoiTypeEntity entity = new PoiTypeEntity();
|
|
|
entity.setId(sceneCode);
|
|
|
entity.setUpdateTime(LocalDateTime.now());
|
|
@@ -900,7 +811,7 @@ public class InitServiceImpl implements InitService {
|
|
|
log.info("poiType数据初始化创建完成");
|
|
|
}
|
|
|
|
|
|
- private void createPoiTypeGroup(String sceneCode){
|
|
|
+ private void createPoiTypeGroup(String sceneCode) {
|
|
|
PoiTypeGroupEntity entity = new PoiTypeGroupEntity();
|
|
|
entity.setId(sceneCode);
|
|
|
entity.setUpdateTime(LocalDateTime.now());
|
|
@@ -914,23 +825,23 @@ public class InitServiceImpl implements InitService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 初始化DataSet
|
|
|
* location: 原点坐标(特殊点表)
|
|
|
* bounding_box_max:(特殊点表)
|
|
|
* bounding_box_min:(特殊点表)
|
|
|
* orientation : rotation2
|
|
|
+ *
|
|
|
* @param sceneCode
|
|
|
*/
|
|
|
- private void createDataSet(String sceneCode, String laserDataPath, double orientation){
|
|
|
+// private void createDataSet(String sceneCode, String laserDataPath, double orientation, String from) {
|
|
|
+ private DataSetPo createDataSet(String sceneCode, String laserDataPath, double orientation, String from) {
|
|
|
log.info("run createDataSet");
|
|
|
DataSetEntity entity = new DataSetEntity();
|
|
|
entity.setId(sceneCode);
|
|
|
entity.setUpdateTime(LocalDateTime.now());
|
|
|
// 设置原点坐标,通过场景码查询特殊点表的原点
|
|
|
- List<SpecialPointEntity> spList = specialPointService.findBySceneCode(sceneCode);
|
|
|
+ List<SpecialPointEntity> spList = specialPointService.findBySceneCode(sceneCode);
|
|
|
log.info("特殊点数量:{}", spList.size());
|
|
|
// 正常是5条记录: db.getCollection('t_special_point').find({"sceneCode":"t97"})
|
|
|
if (spList.size() != 5) {
|
|
@@ -945,7 +856,7 @@ public class InitServiceImpl implements InitService {
|
|
|
map.put(key, sp.getPoi());
|
|
|
}
|
|
|
// 使用gps坐标
|
|
|
- if (TypeConstant.POI_ORIGIN.equals(key)){
|
|
|
+ if (TypeConstant.POI_ORIGIN.equals(key)) {
|
|
|
map.put(key, sp.getGpsPoi());
|
|
|
}
|
|
|
}
|
|
@@ -957,7 +868,7 @@ public class InitServiceImpl implements InitService {
|
|
|
mergeDto.setTitle(sceneCode);
|
|
|
// Integer[] site_model_entity_ids = {10,11,12};
|
|
|
// 2021-09-06
|
|
|
- Integer[] site_model_entity_ids = {10,11};
|
|
|
+ Integer[] site_model_entity_ids = {10, 11};
|
|
|
mergeDto.setSite_model_entity_ids(site_model_entity_ids);
|
|
|
mergeDto.setSceneNum(sceneCode);
|
|
|
|
|
@@ -966,38 +877,23 @@ public class InitServiceImpl implements InitService {
|
|
|
mergeDto.setPath(laserDataPath);
|
|
|
|
|
|
// 处理弧度, 使用计算控制点的rotation2
|
|
|
- mergeDto.setOrientation(orientation);
|
|
|
+ if ("web".equals(from)) {
|
|
|
+ mergeDto.setOrientation(orientation);
|
|
|
+ } else {
|
|
|
+ // 重算默认0.0
|
|
|
+ mergeDto.setOrientation(0.0);
|
|
|
+ }
|
|
|
|
|
|
DataSetPo po = ModifyDataSets.mergeDataSetPo(map, mergeDto);
|
|
|
entity.setData(Arrays.asList(po));
|
|
|
dataSetService.save(entity);
|
|
|
log.info("DataSet数据初始化创建完成");
|
|
|
+ return po;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 处理弧度
|
|
|
- * @param controlPoint
|
|
|
- * @return
|
|
|
- */
|
|
|
-// private Double getOrientation(ControlPointEntity controlPoint){
|
|
|
-//// double angle = GisCoordinateUtil.getDataSetOrientation(controlPoint);
|
|
|
-// double angle = 0.0;
|
|
|
-// log.info("Orientation弧度:{}", angle);
|
|
|
-// return angle;
|
|
|
-// }
|
|
|
|
|
|
- /**
|
|
|
- * 处理弧度
|
|
|
- * @return
|
|
|
- */
|
|
|
- private Double getOrientation(){
|
|
|
-// double angle = GisCoordinateUtil.getDataSetOrientation(controlPoint);
|
|
|
- double angle = 0.0;
|
|
|
- log.info("Orientation弧度:{}", angle);
|
|
|
- return angle;
|
|
|
- }
|
|
|
|
|
|
- private void createConfig(String sceneCode){
|
|
|
+ private void createConfig(String sceneCode) {
|
|
|
|
|
|
// 根据场景码查询特殊点
|
|
|
SpecialPointEntity sp = specialPointService.findBySceneCodeAndPoiKey(sceneCode, TypeConstant.POI_FIRST_VIEW);
|
|
@@ -1005,24 +901,24 @@ public class InitServiceImpl implements InitService {
|
|
|
throw new BaseRuntimeException("firstView点不存在,请检查特殊点表或者检查createVisionToFilter方法初始化");
|
|
|
}
|
|
|
Double[] poi = sp.getPoi();
|
|
|
- log.info("firstView: {}" , sp.getPoi());
|
|
|
+ log.info("firstView: {}", sp.getPoi());
|
|
|
|
|
|
// String content = MyFileUtils.getResourceContent("data/config.json");
|
|
|
String content = cn.hutool.core.io.FileUtil.readUtf8String(configConstant.templatePath + "/config.json");
|
|
|
|
|
|
List<ConfigDto> dtoList = com.alibaba.fastjson.JSONArray.parseArray(content, ConfigDto.class);
|
|
|
- List<ConfigDto> resData = new ArrayList<>();
|
|
|
+ List<ConfigDto> resData = new ArrayList<>();
|
|
|
// 获取特殊点,firstView, lat:113, [0], x, lon:22, [1], y 方法参考:ModifyConfig.java
|
|
|
- dtoList.forEach(p -> {
|
|
|
- String name = p.getName();
|
|
|
- if ("core.init.map.lon".equals(name)) {
|
|
|
- p.setValue(poi[1].toString());
|
|
|
+ dtoList.forEach(p -> {
|
|
|
+ String name = p.getName();
|
|
|
+ if ("core.init.map.lon".equals(name)) {
|
|
|
+ p.setValue(poi[1].toString());
|
|
|
|
|
|
- } else if ("core.init.map.lat".equals(name)){
|
|
|
- p.setValue(poi[0].toString());
|
|
|
- }
|
|
|
- resData.add(p);
|
|
|
- });
|
|
|
+ } else if ("core.init.map.lat".equals(name)) {
|
|
|
+ p.setValue(poi[0].toString());
|
|
|
+ }
|
|
|
+ resData.add(p);
|
|
|
+ });
|
|
|
|
|
|
|
|
|
ConfigEntity entity = new ConfigEntity();
|
|
@@ -1036,17 +932,18 @@ public class InitServiceImpl implements InitService {
|
|
|
|
|
|
/**
|
|
|
* 最优路径算法-使用
|
|
|
+ *
|
|
|
* @param path F:\test\project\age_laser/final_freespace.csv
|
|
|
*/
|
|
|
- private void createRoute(String sceneCode, String path){
|
|
|
+ private void createRoute(String sceneCode, String path) {
|
|
|
List<String> list = new ArrayList<>();
|
|
|
//
|
|
|
- String routePath = path + "/final_freespace.csv";
|
|
|
- log.info("routePath: {}", routePath);
|
|
|
- if (!cn.hutool.core.io.FileUtil.isFile(routePath)){
|
|
|
- log.info("输入路径有误, path: {}", routePath);
|
|
|
- throw new BaseRuntimeException(MsgCode.e3001, "final_freespace.csv路径有误,文件不存在");
|
|
|
- }
|
|
|
+ String routePath = path + "/final_freespace.csv";
|
|
|
+ log.info("routePath: {}", routePath);
|
|
|
+ if (!cn.hutool.core.io.FileUtil.isFile(routePath)) {
|
|
|
+ log.info("输入路径有误, path: {}", routePath);
|
|
|
+ throw new BaseRuntimeException(MsgCode.e3001, "final_freespace.csv路径有误,文件不存在");
|
|
|
+ }
|
|
|
try {
|
|
|
list = FileUtil.readFileByLines2(routePath);
|
|
|
RouteEntity entity = new RouteEntity();
|
|
@@ -1060,45 +957,41 @@ public class InitServiceImpl implements InitService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
//
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
- private ControlPointEntity getControlPoint(String sceneCode){
|
|
|
- return controlPointService.findById(sceneCode);
|
|
|
+ private ControlPointEntity getControlPoint(String sceneCode) {
|
|
|
+ return controlPointService.findById(sceneCode);
|
|
|
}
|
|
|
|
|
|
|
|
|
- private ControlPointCalculateEntity getControlPointCalculate(String sceneCode){
|
|
|
+ private ControlPointCalculateEntity getControlPointCalculate(String sceneCode) {
|
|
|
return controlPointCalculateService.findById(sceneCode);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
* @param sceneCode 场景码
|
|
|
- * @param path 基础路径
|
|
|
+ * @param path 基础路径
|
|
|
* @param mergeCode 合并的场景码
|
|
|
- *
|
|
|
*/
|
|
|
@Override
|
|
|
- public void ossUploadDirByLaserData(String sceneCode, String path, String mergeCode){
|
|
|
+ public void ossUploadDirByLaserData(String sceneCode, String path, String mergeCode) {
|
|
|
String panoPath = path + "/pano";
|
|
|
String panoDepthPath = path + "/pano_depth";
|
|
|
String webCloudPath = path + "/webcloud";
|
|
|
|
|
|
|
|
|
-
|
|
|
executeCmd(sceneCode, panoPath, "pano", mergeCode);
|
|
|
log.info("pano目录上传oss完成");
|
|
|
- executeCmd(sceneCode, panoDepthPath, "pano_depth",mergeCode);
|
|
|
+ executeCmd(sceneCode, panoDepthPath, "pano_depth", mergeCode);
|
|
|
log.info("pano_depth目录上传oss完成");
|
|
|
- executeCmd(sceneCode, webCloudPath,"webcloud", mergeCode);
|
|
|
+ executeCmd(sceneCode, webCloudPath, "webcloud", mergeCode);
|
|
|
log.info("webcloud目录上传oss完成");
|
|
|
}
|
|
|
|
|
|
- private void executeCmd(String sceneCode, String uploadDir, String targetDir, String mergeCode){
|
|
|
+ private void executeCmd(String sceneCode, String uploadDir, String targetDir, String mergeCode) {
|
|
|
String cmd = CmdConstant.OSSUTIL_UPLOAD_DIR_CHUNK;
|
|
|
cmd = cmd.replaceAll("@sceneCode", sceneCode);
|
|
|
cmd = cmd.replaceAll("@mergeCode", mergeCode);
|
|
@@ -1109,7 +1002,7 @@ public class InitServiceImpl implements InitService {
|
|
|
|
|
|
|
|
|
@Test
|
|
|
- public void test1(){
|
|
|
+ public void test1() {
|
|
|
// List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6);
|
|
|
// Stream<Integer> stream = list.stream();
|
|
|
// stream = stream.filter(p -> p > 3);
|