|
@@ -121,7 +121,6 @@ public class TiledMapServiceImpl extends IBaseServiceImpl implements TiledMapSer
|
|
|
log.error("文件名: {}", originalFilename);
|
|
|
return Result.failure("文件不能为空, 或者不是zip文件");
|
|
|
}
|
|
|
-// String basePath = redisPath(sceneCode) + "/laserData/upload_cover";
|
|
|
String basePath = redisPath(sceneCode) + "/upload_cover";
|
|
|
String savePath = basePath + "/cover.zip";
|
|
|
if ("dev".equals(configConstant.active)) {
|
|
@@ -213,6 +212,8 @@ public class TiledMapServiceImpl extends IBaseServiceImpl implements TiledMapSer
|
|
|
Integer width = resolution.getInteger("width");
|
|
|
Integer height = resolution.getInteger("height");
|
|
|
|
|
|
+
|
|
|
+
|
|
|
BufferedImage read = null;
|
|
|
String tiledMapPath = tiledBasePath + "/extras/final_freespace.png";
|
|
|
try {
|
|
@@ -231,13 +232,28 @@ public class TiledMapServiceImpl extends IBaseServiceImpl implements TiledMapSer
|
|
|
// 调用算法切图
|
|
|
cmdTiledMap(tiledBasePath);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// 上传平面图到download目录
|
|
|
uploadOss(tiledBasePath, sceneCode);
|
|
|
|
|
|
// 2021-12-2 更新状态为自定义平面图
|
|
|
TiledMapEntity entity = this.findById(sceneCode);
|
|
|
+
|
|
|
+ // 2021-12-03 更新quadTree, 切图后会生成新的info.json
|
|
|
+ List<TiledMapDto> data = entity.getData();
|
|
|
+ for (TiledMapDto dao : data) {
|
|
|
+ if (sceneCode.equals(dao.getSceneCode())){
|
|
|
+ dao.setQuadtree(getQuadTree(tiledBasePath));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 0 默认平面图 ,1自定义平面图
|
|
|
entity.setStatus(1);
|
|
|
+ entity.setData(data);
|
|
|
+
|
|
|
entity.setUpdateTime(LocalDateTime.now());
|
|
|
this.save(entity);
|
|
|
|
|
@@ -288,7 +304,7 @@ public class TiledMapServiceImpl extends IBaseServiceImpl implements TiledMapSer
|
|
|
// 上传切片后的平面图
|
|
|
String uploadDir = tiledBasePath + "/results/laserData/cover";
|
|
|
uploadDiyCover(sceneCode, uploadDir );
|
|
|
- log.info("切图上传oss完成");
|
|
|
+ log.info("平面图切图上传oss完成");
|
|
|
|
|
|
}
|
|
|
|
|
@@ -475,10 +491,6 @@ public class TiledMapServiceImpl extends IBaseServiceImpl implements TiledMapSer
|
|
|
dto.setMap_size_m(mapSize_m);
|
|
|
// 使用dataSet.location
|
|
|
dto.setLocation(location);
|
|
|
-// double[] quaternion = PlanGraph.getQuaternion(orientation);
|
|
|
-// Double[] calcQuaternion = {quaternion[0],quaternion[1],quaternion[2],quaternion[3]};
|
|
|
-// dto.setOrientation(calcQuaternion);
|
|
|
-
|
|
|
|
|
|
// 计算 2021-09-14
|
|
|
dto.setOrientation(PlanGraph.tiledMapOrientation(orientation));
|
|
@@ -490,13 +502,56 @@ public class TiledMapServiceImpl extends IBaseServiceImpl implements TiledMapSer
|
|
|
String uploadDir = path + "/cover";
|
|
|
ossUploadDir(ossTarget, uploadDir);
|
|
|
// 压缩并上传oss提供下载
|
|
|
-// zipAndUploadOss(path, uploadDir, sceneCode);
|
|
|
tiledMapUploadOss(path, sceneCode);
|
|
|
log.info("算法生成平面图上传oss完成");
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 2021-12-03
|
|
|
+ * 四叉树
|
|
|
+ * 图片透明度会影响这个值,上传后的平面图需要重新计算
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String getQuadTree(String basePath){
|
|
|
+
|
|
|
+ // 读取算法新生成的info.json
|
|
|
+// basePath = "/results/laserData/cover";
|
|
|
+ String infoPath = basePath + "/results/laserData/cover/info.json";
|
|
|
+ log.info("平面图info.json path: {}", infoPath);
|
|
|
+
|
|
|
+ if (!FileUtil.isFile(infoPath)){
|
|
|
+ String msg = "算法生成平面图失败, info.json不存在";
|
|
|
+ log.error(msg);
|
|
|
+ throw new BaseRuntimeException(msg);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ String str = FileUtil.readUtf8String(infoPath);
|
|
|
+ JSONObject strJson = JSONObject.parseObject(str);
|
|
|
+ JSONArray zoom = strJson.getJSONArray("zoom");
|
|
|
+ Integer maxDepth = zoom.size()-1;
|
|
|
+ log.info("平面图maxDepth: {}", maxDepth);
|
|
|
+
|
|
|
+ // 四叉树
|
|
|
+ String dirPath = basePath + "/results/laserData/cover/" + maxDepth;
|
|
|
+ log.info("平面图quadTree dirPath: {}", dirPath);
|
|
|
+ Solution solution = new Solution();
|
|
|
+ File file = solution.readFiles(dirPath);
|
|
|
+ String quadTree = "";
|
|
|
+ if(file!=null) {
|
|
|
+ quadTree = solution.getXYTiles(file);
|
|
|
+ }
|
|
|
+ log.info("平面图quadTree : {}", quadTree);
|
|
|
+ return quadTree;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 长传平面图提供下载
|
|
|
* @param basePath
|