package com.fdkankan.contro.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import com.fdkankan.contro.service.IBuildService; import com.fdkankan.model.enums.ModelTypeEnums; import com.fdkankan.model.utils.ComputerUtil; import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.Map; import java.util.Objects; @Slf4j @Service public class BuildServiceImpl implements IBuildService { @Override public Map getTypeString(String cameraType, String algorithm, String resolution, JSONObject fdageData){ Map map = new HashMap<>(); String splitType = ""; String skyboxType = ""; if(Integer.parseInt(cameraType) >= 4){ if("0".equals(resolution)){ skyboxType = "SKYBOX_V7"; //high,low,2k }else { skyboxType = "SKYBOX_V1"; } splitType = "SPLIT_V1"; if(Integer.parseInt(cameraType) == 5){ //新双目相机 splitType = "SPLIT_V9"; skyboxType = "SKYBOX_V1"; } if(Integer.parseInt(cameraType) == 6){ //小红屋新双目相机 // skyboxType = "SKYBOX_V9"; splitType = "SPLIT_V3"; skyboxType = "SKYBOX_V7"; } if(Integer.parseInt(cameraType) == 13){ //转台相机 skyboxType = "SKYBOX_V6"; splitType = "SPLIT_V12"; Integer location = fdageData.getInteger("location");//全景看看 if(Objects.nonNull(location) && location == 7){ splitType = "SPLIT_V26"; } } if(Integer.parseInt(cameraType) == 14){ Integer location = fdageData.getInteger("location"); //转台相机 log.info("激光转台相机调用算法"); skyboxType = "SKYBOX_V11"; splitType = "SPLIT_V14"; if(location == 6){//slam splitType = "SPLIT_V25"; } if(location == 8){//四维深巡 splitType = "SPLIT_V16"; if(fdageData.getIntValue("zxState") == 1){//带知象光电 splitType = "SPLIT_V33"; } } if (!ObjectUtils.isEmpty(fdageData)) { if ((fdageData.containsKey("exportMeshObj") && fdageData.getIntValue("exportMeshObj") == 1)) { splitType = "SPLIT_V22"; } if(fdageData.containsKey("OnlyExportMeshObj")){ splitType = "SPLIT_V20"; } } } }else { if("sfm".equals(algorithm)){ splitType = "SPLIT_V2"; skyboxType = "SKYBOX_V1"; }else { splitType = "SPLIT_V3"; skyboxType = "SKYBOX_V1"; } } if (!ObjectUtils.isEmpty(fdageData) && !ObjectUtils.isEmpty(fdageData.getString("modelType"))) { switch (fdageData.getString("modelType")){ case ModelTypeEnums.TILE_CODE: if(skyboxType.equals("SKYBOX_V6")){ skyboxType = "SKYBOX_V14"; }else if(skyboxType.equals("SKYBOX_V11")){ skyboxType = "SKYBOX_V15"; } else{ skyboxType = "SKYBOX_V13"; } } } if(StrUtil.isNotEmpty(resolution) && "6k".equals(resolution)){ skyboxType = "SKYBOX_V16"; } map.put("splitType", splitType); map.put("skyboxType", skyboxType); return map; } @Override public void writeDataJson(BuildSceneCallMessage message, JSONObject dataFdage, Map dataMap, Map dataExtras) { if(CollUtil.isEmpty(dataMap)){ dataMap = this.getTypeString(message.getCameraType(), message.getAlgorithm(), message.getResolution(), dataFdage); } ComputerUtil.createProjectAndDataFile(message.getPath(), message.getSceneNum(), dataMap.get("splitType"), dataMap.get("skyboxType"),null, dataExtras); } }