BuildServiceImpl.java 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. package com.fdkankan.contro.service.impl;
  2. import cn.hutool.core.collection.CollUtil;
  3. import cn.hutool.core.util.StrUtil;
  4. import com.alibaba.fastjson.JSONObject;
  5. import com.fdkankan.contro.service.IBuildService;
  6. import com.fdkankan.model.enums.ModelTypeEnums;
  7. import com.fdkankan.model.utils.ComputerUtil;
  8. import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
  9. import lombok.extern.slf4j.Slf4j;
  10. import org.apache.commons.lang3.ObjectUtils;
  11. import org.springframework.stereotype.Service;
  12. import java.util.HashMap;
  13. import java.util.Map;
  14. import java.util.Objects;
  15. @Slf4j
  16. @Service
  17. public class BuildServiceImpl implements IBuildService {
  18. @Override
  19. public Map<String, String> getTypeString(String cameraType, String algorithm, String resolution, JSONObject fdageData){
  20. Map<String, String> map = new HashMap<>();
  21. String splitType = "";
  22. String skyboxType = "";
  23. if(Integer.parseInt(cameraType) >= 4){
  24. if("0".equals(resolution)){
  25. skyboxType = "SKYBOX_V7"; //high,low,2k
  26. }else {
  27. skyboxType = "SKYBOX_V1";
  28. }
  29. splitType = "SPLIT_V1";
  30. if(Integer.parseInt(cameraType) == 5){
  31. //新双目相机
  32. splitType = "SPLIT_V9";
  33. skyboxType = "SKYBOX_V1";
  34. }
  35. if(Integer.parseInt(cameraType) == 6){
  36. //小红屋新双目相机
  37. // skyboxType = "SKYBOX_V9";
  38. splitType = "SPLIT_V3";
  39. skyboxType = "SKYBOX_V7";
  40. }
  41. if(Integer.parseInt(cameraType) == 13){
  42. //转台相机
  43. skyboxType = "SKYBOX_V6";
  44. splitType = "SPLIT_V12";
  45. Integer location = fdageData.getInteger("location");//全景看看
  46. if(Objects.nonNull(location) && location == 7){
  47. splitType = "SPLIT_V26";
  48. }
  49. }
  50. if(Integer.parseInt(cameraType) == 14){
  51. Integer location = fdageData.getInteger("location");
  52. //转台相机
  53. log.info("激光转台相机调用算法");
  54. skyboxType = "SKYBOX_V11";
  55. splitType = "SPLIT_V14";
  56. if(location == 6){//slam
  57. splitType = "SPLIT_V25";
  58. }
  59. if(location == 8){//四维深巡
  60. splitType = "SPLIT_V16";
  61. if(fdageData.getIntValue("zxState") == 1){//带知象光电
  62. splitType = "SPLIT_V33";
  63. }
  64. }
  65. if (!ObjectUtils.isEmpty(fdageData)) {
  66. if ((fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)) {
  67. splitType = "SPLIT_V22";
  68. }
  69. if(fdageData.containsKey("OnlyExportMeshObj")){
  70. splitType = "SPLIT_V20";
  71. }
  72. }
  73. }
  74. }else {
  75. if("sfm".equals(algorithm)){
  76. splitType = "SPLIT_V2";
  77. skyboxType = "SKYBOX_V1";
  78. }else {
  79. splitType = "SPLIT_V3";
  80. skyboxType = "SKYBOX_V1";
  81. }
  82. }
  83. if (!ObjectUtils.isEmpty(fdageData) && !ObjectUtils.isEmpty(fdageData.getString("modelType"))) {
  84. switch (fdageData.getString("modelType")){
  85. case ModelTypeEnums.TILE_CODE:
  86. if(skyboxType.equals("SKYBOX_V6")){
  87. skyboxType = "SKYBOX_V14";
  88. }else if(skyboxType.equals("SKYBOX_V11")){
  89. skyboxType = "SKYBOX_V15";
  90. } else{
  91. skyboxType = "SKYBOX_V13";
  92. }
  93. }
  94. }
  95. if(StrUtil.isNotEmpty(resolution) && "6k".equals(resolution)){
  96. skyboxType = "SKYBOX_V16";
  97. }
  98. map.put("splitType", splitType);
  99. map.put("skyboxType", skyboxType);
  100. return map;
  101. }
  102. @Override
  103. public void writeDataJson(BuildSceneCallMessage message, JSONObject dataFdage, Map<String, String> dataMap, Map<String, Object> dataExtras) {
  104. if(CollUtil.isEmpty(dataMap)){
  105. dataMap = this.getTypeString(message.getCameraType(), message.getAlgorithm(), message.getResolution(), dataFdage);
  106. }
  107. ComputerUtil.createProjectAndDataFile(message.getPath(), message.getSceneNum(), dataMap.get("splitType"), dataMap.get("skyboxType"),null, dataExtras);
  108. }
  109. }