|
@@ -87,6 +87,9 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
@Value("${model.modelKind:3dtiles}")
|
|
|
private String modelKind;
|
|
|
|
|
|
+ @Value("#{'${model.3dtiles.sceneSource:}'.split(',')}")
|
|
|
+ private List<Integer> sdTilesSceneSourceList;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RabbitMqProducer mqProducer;
|
|
|
|
|
@@ -276,23 +279,19 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
|
|
|
Map<String,String> damFileHeaders = new HashMap<>();
|
|
|
damFileHeaders.put("Content-Encoding","gzip");
|
|
|
- if (!ObjectUtils.isEmpty(cameraType) && !cameraType.equals(14)) {
|
|
|
- if (!fYunFileService.getFyunType().equals(FYunTypeEnum.LOCAL.code())) {
|
|
|
- // dam 文件设置请求头
|
|
|
- uploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
|
|
|
- .forEach(entry -> {
|
|
|
- if (!new File(entry.getKey()).exists()) {
|
|
|
- log.error("文件不存在,不予gzip压缩,文件路径:{}", entry.getKey());
|
|
|
- return;
|
|
|
- }
|
|
|
- // gzip压缩
|
|
|
- FileUtil.writeBytes(ZipUtil.gzip(new File(entry.getKey())), entry.getKey() + ".gzip");
|
|
|
- // 重命名
|
|
|
- FileUtil.rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
|
|
|
- fYunFileService.uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ // dam 文件设置请求头
|
|
|
+ uploadFiles.entrySet().stream().filter(entry -> FileNameUtil.extName(entry.getKey()).equals("dam"))
|
|
|
+ .forEach(entry -> {
|
|
|
+ if (!new File(entry.getKey()).exists()) {
|
|
|
+ log.error("文件不存在,不予gzip压缩,文件路径:{}", entry.getKey());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // gzip压缩
|
|
|
+ FileUtil.writeBytes(ZipUtil.gzip(new File(entry.getKey())), entry.getKey() + ".gzip");
|
|
|
+ // 重命名
|
|
|
+ FileUtil.rename(new File(entry.getKey() + ".gzip"), entry.getKey(), true);
|
|
|
+ fYunFileService.uploadFile(entry.getKey(), entry.getValue(), damFileHeaders);
|
|
|
+ });
|
|
|
|
|
|
//拷贝部分文件到编辑目录,用于用户编辑
|
|
|
this.copyToEditDir(sceneCode);
|
|
@@ -467,26 +466,36 @@ public class BuildSceneServiceImpl implements IBuildSceneService {
|
|
|
}
|
|
|
|
|
|
//exportMeshObj这个是字段由app写入的
|
|
|
- if (!ObjectUtils.isEmpty(cameraType) && cameraType != 14) {
|
|
|
- CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
- CreateObjUtil.convertDamToLzma(path + File.separator + "results/");
|
|
|
- CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
- map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", imagesPath + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
- map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", imagesPath + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
- }
|
|
|
-
|
|
|
- if(this.modelKind.equals(ModelKind.THREE_D_TILE.code())
|
|
|
- && (!ObjectUtils.isEmpty(cameraType) && cameraType == 14 )//是激光场景
|
|
|
- && (fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)//选择生成obj
|
|
|
- ){
|
|
|
- List<String> list = FileUtils.list(new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
|
|
|
- if(CollUtil.isEmpty(list)){
|
|
|
- log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
|
|
|
- throw new Exception("3dtiles目录异常");
|
|
|
+ boolean genModel = true;//是否生成模型 默认生成,深时场景要根据 exportMeshObj判断是否生成
|
|
|
+ if(!ObjectUtils.isEmpty(cameraType)
|
|
|
+ && cameraType == 14
|
|
|
+ && (!fdageData.containsKey("exportMeshObj") || fdageData.getIntValue("exportMeshObj") != 1)){
|
|
|
+ genModel = false;
|
|
|
+ }
|
|
|
+ boolean gen3dTiles = true;//是否生成3dtiles模型 默认生成
|
|
|
+ if(!ModelKind.THREE_D_TILE.code().equals(modelKind)
|
|
|
+ || CollUtil.isEmpty(sdTilesSceneSourceList)
|
|
|
+ || !sdTilesSceneSourceList.contains(scenePlus.getSceneSource())){
|
|
|
+ gen3dTiles = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(genModel){
|
|
|
+ if (!gen3dTiles) {
|
|
|
+ CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
+ CreateObjUtil.convertDamToLzma(path + File.separator + "results/");
|
|
|
+ CreateObjUtil.convertTxtToDam(path + File.separator + "results" + File.separator + "tex" + File.separator + "modeldata.txt", path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
+ map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam.lzma", imagesPath + ConstantFileName.modelUUID + "_50k.dam.lzma");
|
|
|
+ map.put(path + File.separator + "results" + File.separator + ConstantFileName.modelUUID + "_50k.dam", imagesPath + ConstantFileName.modelUUID + "_50k.dam");
|
|
|
+ }else{
|
|
|
+ List<String> list = FileUtils.list(new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
|
|
|
+ if(CollUtil.isEmpty(list)){
|
|
|
+ log.error("3dtiles目录异常,3dtiles地址:{}", new File(path + File.separator + "results" + File.separator + ModelKind.THREE_D_TILE.code()));
|
|
|
+ throw new Exception("3dtiles目录异常");
|
|
|
+ }
|
|
|
+ list.stream().forEach(str->{
|
|
|
+ map.put(str, str.replace(path + File.separator + "results" + File.separator, imagesPath));
|
|
|
+ });
|
|
|
}
|
|
|
- list.stream().forEach(str->{
|
|
|
- map.put(str, str.replace(path + File.separator + "results" + File.separator, imagesPath));
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
CreateObjUtil.convertTxtToVisionmodeldata(resultsPath + "vision.txt", resultsPath + "vision.modeldata");
|