|
@@ -1,23 +1,12 @@
|
|
|
package com.fdkankan.scene.util;
|
|
|
|
|
|
-import cn.hutool.core.io.FileUtil;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
-import cn.hutool.core.util.XmlUtil;
|
|
|
-import cn.hutool.core.util.ZipUtil;
|
|
|
-import cn.hutool.extra.spring.SpringUtil;
|
|
|
import cn.hutool.system.OsInfo;
|
|
|
import cn.hutool.system.SystemUtil;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.fdkankan.common.util.FileUtils;
|
|
|
-import com.fdkankan.scene.config.FdkkLaserConfig;
|
|
|
import com.fdkankan.scene.constant.CmdConstant;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
-import org.w3c.dom.Document;
|
|
|
-import org.w3c.dom.Node;
|
|
|
|
|
|
import java.io.File;
|
|
|
-import java.io.IOException;
|
|
|
|
|
|
/**
|
|
|
* 判断是否是单机。然后调用bat或者shell
|
|
@@ -29,69 +18,8 @@ import java.io.IOException;
|
|
|
@Component
|
|
|
public class CmdBuildUtil {
|
|
|
|
|
|
+ private static final String BASH = "bash ";
|
|
|
private static final OsInfo OS = SystemUtil.getOsInfo();
|
|
|
- private static final FdkkLaserConfig fdkkLaserConfig = SpringUtil.getBean(FdkkLaserConfig.class);
|
|
|
-
|
|
|
- public static void objTOGlb(String inPath, String outPath) {
|
|
|
-
|
|
|
- String cp_folder = "";
|
|
|
- if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- cp_folder = CmdConstant.OBJ_TO_GLB
|
|
|
- .replace("@inPath", inPath)
|
|
|
- .replace("@outPath", outPath);
|
|
|
- CmdUtils.callLineSh(cp_folder);
|
|
|
-
|
|
|
- } else {
|
|
|
- cp_folder = CmdConstant.OBJ_TO_GLB_WIN
|
|
|
- .replace("@inPath", inPath)
|
|
|
- .replace("@outPath", outPath);
|
|
|
- CmdUtils.callLine(cp_folder);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static void DeleteFolder(String folder) {
|
|
|
- String rm_folder = "";
|
|
|
- if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- rm_folder = CmdConstant.RM_Folder.replace("@Folder", folder);
|
|
|
- CmdUtils.callLineSh(rm_folder);
|
|
|
-
|
|
|
- } else {
|
|
|
- rm_folder = CmdConstant.RM_Folder_WIN.replace("@Folder", folder);
|
|
|
- CmdUtils.callLine(rm_folder);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static void MoveFolder(String folder, String target) {
|
|
|
- String mv_folder = "";
|
|
|
- if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- mv_folder = CmdConstant.MV_Folder
|
|
|
- .replace("@Folder", folder)
|
|
|
- .replace("@Target", target);
|
|
|
- CmdUtils.callLineSh(mv_folder);
|
|
|
-
|
|
|
- } else {
|
|
|
- mv_folder = CmdConstant.MV_Folder_WIN
|
|
|
- .replace("@Folder", folder)
|
|
|
- .replace("@Target", target);
|
|
|
- CmdUtils.callLine(mv_folder);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static void CopyFolder(String folder, String target) {
|
|
|
- String cp_folder = "";
|
|
|
- if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- cp_folder = CmdConstant.CP_Folder
|
|
|
- .replace("@Folder", folder)
|
|
|
- .replace("@Target", target);
|
|
|
- CmdUtils.callLineSh(cp_folder);
|
|
|
-
|
|
|
- } else {
|
|
|
- cp_folder = CmdConstant.CP_Folder_WIN
|
|
|
- .replace("@Folder", folder)
|
|
|
- .replace("@Target", target);
|
|
|
- CmdUtils.callLine(cp_folder);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
public static void MkLinkDir(String Link, String target) {
|
|
|
String cp_folder = "";
|
|
@@ -125,62 +53,10 @@ public class CmdBuildUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void ZipFile(String path, String target, String inPath) {
|
|
|
- String zipCmd = "";
|
|
|
- if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- zipCmd = CmdConstant.ZIP
|
|
|
- .replace("@path", path)
|
|
|
- .replace("@target", target)
|
|
|
- .replace("@inPath", inPath);
|
|
|
- if (StrUtil.isNotEmpty(zipCmd)) {
|
|
|
- CmdUtils.callLineSh(zipCmd);
|
|
|
- }
|
|
|
- } else {
|
|
|
- ZipUtil.zip(path + File.separator + inPath, target, false);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static void MergeCutModel(String inPath, String outPath) {
|
|
|
- String mergeCutModelCmd = "";
|
|
|
- if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- mergeCutModelCmd = CmdConstant.MERGE_CUT_MODEL
|
|
|
- .replace("@inPath", inPath)
|
|
|
- .replace("@outPath", outPath);
|
|
|
- CmdUtils.callLineSh(mergeCutModelCmd);
|
|
|
-
|
|
|
- } else {
|
|
|
- mergeCutModelCmd = CmdConstant.MERGE_CUT_MODEL_WIN
|
|
|
- .replace("@inPath", inPath)
|
|
|
- .replace("@outPath", outPath);
|
|
|
- CmdUtils.callLine(mergeCutModelCmd);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public static void ConverterAddGeo(String param, String inPath, String outPath) {
|
|
|
- String converterAddGeoCmd = "";
|
|
|
- if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- converterAddGeoCmd = CmdConstant.CONVERTER_ADD_GEO
|
|
|
- .replace("@param", param)
|
|
|
- .replace("@inPath", inPath)
|
|
|
- .replace("@outPath", outPath);
|
|
|
- CmdUtils.callLineSh(converterAddGeoCmd);
|
|
|
-
|
|
|
- } else {
|
|
|
- converterAddGeoCmd = CmdConstant.CONVERTER_ADD_GEO_WIN
|
|
|
- .replace("@param", param)
|
|
|
- .replace("@inPath", inPath)
|
|
|
- .replace("@outPath", outPath);
|
|
|
- CmdUtils.callLine(converterAddGeoCmd);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
public static void BuildModelCommand(String buildCallPath, String inPath) {
|
|
|
String buildModelCommandCmd = "";
|
|
|
if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- buildModelCommandCmd = CmdConstant.BUILD_MODEL_COMMAND
|
|
|
+ buildModelCommandCmd = BASH + CmdConstant.BUILD_MODEL_COMMAND
|
|
|
.replace("@inPath", inPath);
|
|
|
CmdUtils.callLineSh(buildModelCommandCmd);
|
|
|
|
|
@@ -192,77 +68,10 @@ public class CmdBuildUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void Build3dtilesModel(String inPath) {
|
|
|
- String buildModelCommandCmd = CmdConstant.BUILD_3DTILES_MODEL_COMMAND_WIN
|
|
|
- .replace("@inPath", inPath);
|
|
|
- CmdUtils.callLineWin(buildModelCommandCmd);
|
|
|
- }
|
|
|
-
|
|
|
- static void KillBuildModelCommand() {
|
|
|
- String buildModelCommandCmd = "";
|
|
|
- if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- buildModelCommandCmd = CmdConstant.KILL_BUILD_MODEL_COMMAND;
|
|
|
- CmdUtils.callLineSh(buildModelCommandCmd);
|
|
|
-
|
|
|
- } else {
|
|
|
- buildModelCommandCmd = CmdConstant.KILL_BUILD_MODEL_COMMAND_WIN;
|
|
|
- CmdUtils.callLine(buildModelCommandCmd);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public static void TiledMap(String inPath) {
|
|
|
- String tiledMapCmd = "";
|
|
|
- if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- tiledMapCmd = CmdConstant.TILED_MAP
|
|
|
- .replace("@inPath", inPath);
|
|
|
- CmdUtils.callLineSh(tiledMapCmd);
|
|
|
-
|
|
|
- } else {
|
|
|
- tiledMapCmd = CmdConstant.TILED_MAP_WIN
|
|
|
- .replace("@inPath", inPath);
|
|
|
- CmdUtils.callLine(tiledMapCmd);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public static void LasToBin(String inPath, String outPath) {
|
|
|
- String lasToBinCmd = "";
|
|
|
- if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- lasToBinCmd = CmdConstant.LAS_TO_BIN
|
|
|
- .replace("@inPath", inPath)
|
|
|
- .replace("@outPath", outPath);
|
|
|
- CmdUtils.callLineSh(lasToBinCmd);
|
|
|
-
|
|
|
- } else {
|
|
|
- lasToBinCmd = CmdConstant.LAS_TO_BIN_WIN
|
|
|
- .replace("@inPath", inPath)
|
|
|
- .replace("@outPath", outPath);
|
|
|
- CmdUtils.callLine(lasToBinCmd);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static void CheckLaser(String inPath, String outPath) {
|
|
|
- String checkLaserCmd = "";
|
|
|
- if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- checkLaserCmd = CmdConstant.CHECK_LASER
|
|
|
- .replace("@inPath", inPath)
|
|
|
- .replace("@outPath", outPath);
|
|
|
- CmdUtils.callLineSh(checkLaserCmd);
|
|
|
- } else {
|
|
|
- checkLaserCmd = CmdConstant.CHECK_LASER_WIN
|
|
|
- .replace("@inPath", inPath)
|
|
|
- .replace("@outPath", outPath);
|
|
|
- CmdUtils.callLine(checkLaserCmd);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
public static void Obj2Tiles(String buildCallPath, String inPath) {
|
|
|
String checkLaserCmd = "";
|
|
|
if (CmdBuildUtil.OS.isLinux()) {
|
|
|
- checkLaserCmd = CmdConstant.OBJ2_TILES
|
|
|
+ checkLaserCmd = BASH + CmdConstant.OBJ2_TILES
|
|
|
.replace("@inPath", inPath);
|
|
|
CmdUtils.callLineSh(checkLaserCmd);
|
|
|
} else {
|
|
@@ -271,6 +80,18 @@ public class CmdBuildUtil {
|
|
|
CmdUtils.callLineWin(checkLaserCmd);
|
|
|
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ public static void potreeConverter(String param, String inPath, String outPath) {
|
|
|
+ String potreeConverterCmd = "";
|
|
|
+ if (CmdBuildUtil.OS.isLinux()) {
|
|
|
+ potreeConverterCmd = BASH + CmdConstant.POTREE_CONVERTER.replace("@param", param)
|
|
|
+ .replace("@inPath", inPath).replace("@outPath", outPath);
|
|
|
+ CmdUtils.callLineSh(potreeConverterCmd);
|
|
|
+ } else {
|
|
|
+ potreeConverterCmd = CmdConstant.OBJ2_TILES_WIN.replace("@param", param)
|
|
|
+ .replace("@inPath", inPath).replace("@outPath", outPath);
|
|
|
+ CmdUtils.callLineWin(potreeConverterCmd);
|
|
|
+ }
|
|
|
}
|
|
|
}
|