|
@@ -4,14 +4,18 @@ import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.io.watch.WatchMonitor;
|
|
|
import cn.hutool.core.io.watch.Watcher;
|
|
|
import cn.hutool.core.lang.Console;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.constant.CommonOperStatus;
|
|
|
import com.fdkankan.common.constant.ModelingBuildStatus;
|
|
|
+import com.fdkankan.common.util.CmdUtils;
|
|
|
import com.fdkankan.common.util.FileUtils;
|
|
|
+import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.model.utils.ComputerUtil;
|
|
|
import com.fdkankan.model.utils.CreateObjUtil;
|
|
|
import com.fdkankan.modeling.bean.BuildSceneResultBean;
|
|
|
+import com.fdkankan.modeling.constants.CmdConstant;
|
|
|
import com.fdkankan.modeling.constants.SysConstants;
|
|
|
import com.fdkankan.modeling.entity.BuildLog;
|
|
|
import com.fdkankan.modeling.exception.BuildException;
|
|
@@ -278,9 +282,40 @@ public class RabbitMqListener {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //平面图ai识别
|
|
|
+ boolean detFloorplan = this.detFloorplan(path);
|
|
|
+ buildSceneResult.setDetFloorplan(detFloorplan);
|
|
|
+
|
|
|
return ModelingBuildStatus.SUCCESS;
|
|
|
}
|
|
|
|
|
|
+ private boolean detFloorplan(String path) throws Exception {
|
|
|
+ String workDir = path + "/detFloorplan/";
|
|
|
+ if(FileUtil.exist(workDir)){
|
|
|
+ FileUtil.del(workDir);
|
|
|
+ }
|
|
|
+ String detectPath = workDir + "detect.json";
|
|
|
+ String imgPath = workDir + "final_freespace.png";
|
|
|
+ String keyPath = path + "/results/laserData/cover/final_freespace.png";
|
|
|
+ String floorKeyPath = path + "/results/floorplan/floor_0.png";
|
|
|
+ if(FileUtil.exist(floorKeyPath)){
|
|
|
+ FileUtil.copyContent(new File(floorKeyPath), new File(imgPath), true);
|
|
|
+ }else if(FileUtil.exist(keyPath)){
|
|
|
+ FileUtil.copyContent(new File(keyPath), new File(imgPath), true);
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ String cmd = CmdConstant.LAYOUT_DETECT;
|
|
|
+ cmd = cmd.replace("@in", imgPath);
|
|
|
+ cmd = cmd.replace("@out", detectPath);
|
|
|
+ CmdUtils.callLine(cmd, 50);
|
|
|
+ if (ComputerUtil.checkComputeCompleted(detectPath,5, 500)) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
|
File file = FileUtil.file("D:\\test\\111.txt");
|
|
|
//这里只监听文件或目录的修改事件
|
|
@@ -408,6 +443,12 @@ public class RabbitMqListener {
|
|
|
.build();
|
|
|
buildResult.setBuildContext(message.getBuildContext());
|
|
|
buildResult.setExt(message.getExt());
|
|
|
+ Map<String, Object> ext = buildResult.getExt();
|
|
|
+ if(Objects.isNull(ext)){
|
|
|
+ ext = new HashMap<>();
|
|
|
+ buildResult.setExt(ext);
|
|
|
+ }
|
|
|
+ ext.put("detFloorplan", buildSceneResult.getDetFloorplan());
|
|
|
rabbitMqProducer.sendByWorkQueue(buildSceneResult.getResultQueueName(),buildResult);
|
|
|
}
|
|
|
}
|