|
@@ -258,6 +258,105 @@ public class CutModelServiceImpl extends IBaseServiceImpl implements CutModelSer
|
|
* @param sceneCode
|
|
* @param sceneCode
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
|
|
+// @Override
|
|
|
|
+// public Result multipleCrop(String sceneCode) {
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+// // 1. 根据dataSetId 将dataSet表location(需要转本地坐标), orientation, path, 封装到merge_cut_model.json
|
|
|
|
+// List<DataSetPo> dataSetInfos = dataSetService.getDataBySceneCode(sceneCode);
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+// String ossUrl;
|
|
|
|
+// String basePath = redisPath(sceneCode);
|
|
|
|
+// if (dataSetInfos.size() == 1) { // 只有一个数据集时
|
|
|
|
+// // 2021-10-13 把算法提供的点云直接上传oss
|
|
|
|
+//
|
|
|
|
+// String ossPath = "data/" +sceneCode + "/download/merge_cut.las";
|
|
|
|
+// String outPath = basePath + "/laser.las";
|
|
|
|
+// aliYunOssUtil.upload(outPath, ossPath);
|
|
|
|
+//
|
|
|
|
+// ossUrl = configConstant.ossDomain + ossPath + "?m=" + System.currentTimeMillis();
|
|
|
|
+// log.info("单数据集,直接上传算法提供的点云到oss");
|
|
|
|
+//
|
|
|
|
+// } else { // 多个数据集
|
|
|
|
+// // 转坐标,获取控制点计算值
|
|
|
|
+// ControlPointCalculateEntity pointCalculate = controlPointCalculateService.findById(sceneCode);
|
|
|
|
+//
|
|
|
|
+// HashMap<Object, double[] > covertPoint = new HashMap<>();
|
|
|
|
+// for (DataSetPo po : dataSetInfos) {
|
|
|
|
+// Double[] location = po.getLocation();
|
|
|
|
+// // gis坐标转本地坐标
|
|
|
|
+// double[] doubles = GisCoordinateUtil.transformBLToLocation(location[0], location[1], pointCalculate);
|
|
|
|
+//
|
|
|
|
+// Double orientation = po.getOrientation();
|
|
|
|
+//
|
|
|
|
+// // 将本地坐标, 旋转角度按顺序封装起来
|
|
|
|
+// double[] resParam = {doubles[0], doubles[1], location[2], orientation};
|
|
|
|
+// Integer id = po.getId();
|
|
|
|
+//
|
|
|
|
+// // dataSetId做为key
|
|
|
|
+// covertPoint.put(id, resParam);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+// // 2. 合并场景表(t_merge_info)获取dataSetId, 场景码
|
|
|
|
+// List<MergeInfoEntity> mergeInfo = mergeInfoService.findBySceneCode(sceneCode, 1);
|
|
|
|
+//
|
|
|
|
+// int SizeDataSet = dataSetInfos.size();
|
|
|
|
+// int SizeMergeDataSet = mergeInfo.size();
|
|
|
|
+// log.info("数据集数量:{}, 合并数据集数量: {}", SizeDataSet, SizeMergeDataSet);
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+// JSONArray models = new JSONArray();
|
|
|
|
+// for (MergeInfoEntity info : mergeInfo) {
|
|
|
|
+// // 获取本地坐标,旋转角度
|
|
|
|
+// Integer dataSetId = info.getDataSetId();
|
|
|
|
+// double[] point = covertPoint.get(dataSetId);
|
|
|
|
+//
|
|
|
|
+// JSONObject cutJson = new JSONObject();
|
|
|
|
+// cutJson.put("file", info.getPath() + "/laser.las");
|
|
|
|
+// cutJson.put("sceneCode", info.getMergeCode());
|
|
|
|
+// cutJson.put("dataSetId", dataSetId);
|
|
|
|
+// // 算法要求用空格隔开
|
|
|
|
+// cutJson.put("translation", point[0] + " " + point[1] + " " + point[2]);
|
|
|
|
+// cutJson.put("rotation", point[3]);
|
|
|
|
+// models.add(cutJson);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// // 修剪模型参数
|
|
|
|
+// JSONObject mergeCut = new JSONObject();
|
|
|
|
+// mergeCut.put("model", models);
|
|
|
|
+// // 这个值目前写死
|
|
|
|
+// mergeCut.put("aabb", "b-0.5 -0.5 -0.5 0.5 0.5 0.5");
|
|
|
|
+//
|
|
|
|
+// // 剪切模型参数json写入服务器
|
|
|
|
+//
|
|
|
|
+// if ("dev".equals(configConstant.active)){
|
|
|
|
+// basePath = configConstant.serverBasePath + "/" + sceneCode + "/results/laserData";
|
|
|
|
+// }
|
|
|
|
+// String savePath = basePath + "/merge_cut_param.json";
|
|
|
|
+// log.info("剪切参数:{}", savePath);
|
|
|
|
+// FileUtil.writeUtf8String(mergeCut.toJSONString(), savePath);
|
|
|
|
+// log.info("剪切参数json写入完成");
|
|
|
|
+//
|
|
|
|
+// // 剪切并oss上传模型
|
|
|
|
+// ossUrl = cutLas(basePath, sceneCode);
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+// // 数据更新到数据库
|
|
|
|
+// saveLasInfo(sceneCode, ossUrl);
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+// JSONObject result = new JSONObject();
|
|
|
|
+// // 返回值id, 默认1
|
|
|
|
+// result.put("job_id", 1);
|
|
|
|
+// return Result.success(result);
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Result multipleCrop(String sceneCode) {
|
|
public Result multipleCrop(String sceneCode) {
|
|
|
|
|
|
@@ -268,62 +367,73 @@ public class CutModelServiceImpl extends IBaseServiceImpl implements CutModelSer
|
|
|
|
|
|
String ossUrl;
|
|
String ossUrl;
|
|
String basePath = redisPath(sceneCode);
|
|
String basePath = redisPath(sceneCode);
|
|
- if (dataSetInfos.size() == 1) { // 只有一个数据集时
|
|
|
|
- // 2021-10-13 把算法提供的点云直接上传oss
|
|
|
|
-
|
|
|
|
- String ossPath = "data/" +sceneCode + "/download/merge_cut.las";
|
|
|
|
- String outPath = basePath + "/laser.las";
|
|
|
|
- aliYunOssUtil.upload(outPath, ossPath);
|
|
|
|
-
|
|
|
|
- ossUrl = configConstant.ossDomain + ossPath + "?m=" + System.currentTimeMillis();
|
|
|
|
- log.info("单数据集,直接上传算法提供的点云到oss");
|
|
|
|
|
|
|
|
- } else { // 多个数据集
|
|
|
|
// 转坐标,获取控制点计算值
|
|
// 转坐标,获取控制点计算值
|
|
ControlPointCalculateEntity pointCalculate = controlPointCalculateService.findById(sceneCode);
|
|
ControlPointCalculateEntity pointCalculate = controlPointCalculateService.findById(sceneCode);
|
|
|
|
|
|
HashMap<Object, double[] > covertPoint = new HashMap<>();
|
|
HashMap<Object, double[] > covertPoint = new HashMap<>();
|
|
- for (DataSetPo po : dataSetInfos) {
|
|
|
|
- Double[] location = po.getLocation();
|
|
|
|
- // gis坐标转本地坐标
|
|
|
|
- double[] doubles = GisCoordinateUtil.transformBLToLocation(location[0], location[1], pointCalculate);
|
|
|
|
|
|
|
|
- Double orientation = po.getOrientation();
|
|
|
|
|
|
+ for (DataSetPo po : dataSetInfos) {
|
|
|
|
+ Double[] location = po.getLocation();
|
|
|
|
+ // gis坐标转本地坐标
|
|
|
|
+ double[] doubles = GisCoordinateUtil.transformBLToLocation(location[0], location[1], pointCalculate);
|
|
|
|
|
|
- // 将本地坐标, 旋转角度按顺序封装起来
|
|
|
|
- double[] resParam = {doubles[0], doubles[1], location[2], orientation};
|
|
|
|
- Integer id = po.getId();
|
|
|
|
-
|
|
|
|
- // dataSetId做为key
|
|
|
|
- covertPoint.put(id, resParam);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // 2. 合并场景表(t_merge_info)获取dataSetId, 场景码
|
|
|
|
- List<MergeInfoEntity> mergeInfo = mergeInfoService.findBySceneCode(sceneCode, 1);
|
|
|
|
-
|
|
|
|
- int SizeDataSet = dataSetInfos.size();
|
|
|
|
- int SizeMergeDataSet = mergeInfo.size();
|
|
|
|
- log.info("数据集数量:{}, 合并数据集数量: {}", SizeDataSet, SizeMergeDataSet);
|
|
|
|
|
|
+ Double orientation = po.getOrientation();
|
|
|
|
|
|
|
|
+ // 将本地坐标, 旋转角度按顺序封装起来
|
|
|
|
+ double[] resParam = {doubles[0], doubles[1], location[2], orientation};
|
|
|
|
+ Integer id = po.getId();
|
|
|
|
|
|
|
|
+ // dataSetId做为key
|
|
|
|
+ covertPoint.put(id, resParam);
|
|
|
|
+ }
|
|
|
|
|
|
JSONArray models = new JSONArray();
|
|
JSONArray models = new JSONArray();
|
|
- for (MergeInfoEntity info : mergeInfo) {
|
|
|
|
|
|
+ if (dataSetInfos.size() == 1) { // 只有一个数据集时
|
|
|
|
+ DataSetPo dataSetPo = dataSetInfos.get(0);
|
|
// 获取本地坐标,旋转角度
|
|
// 获取本地坐标,旋转角度
|
|
- Integer dataSetId = info.getDataSetId();
|
|
|
|
|
|
+ Integer dataSetId = dataSetPo.getId();
|
|
double[] point = covertPoint.get(dataSetId);
|
|
double[] point = covertPoint.get(dataSetId);
|
|
|
|
|
|
JSONObject cutJson = new JSONObject();
|
|
JSONObject cutJson = new JSONObject();
|
|
- cutJson.put("file", info.getPath() + "/laser.las");
|
|
|
|
- cutJson.put("sceneCode", info.getMergeCode());
|
|
|
|
|
|
+ // 这两个参数算法不用,后端自己看
|
|
|
|
+ cutJson.put("sceneCode", sceneCode);
|
|
cutJson.put("dataSetId", dataSetId);
|
|
cutJson.put("dataSetId", dataSetId);
|
|
// 算法要求用空格隔开
|
|
// 算法要求用空格隔开
|
|
|
|
+ cutJson.put("file", basePath + "/laser.las");
|
|
cutJson.put("translation", point[0] + " " + point[1] + " " + point[2]);
|
|
cutJson.put("translation", point[0] + " " + point[1] + " " + point[2]);
|
|
cutJson.put("rotation", point[3]);
|
|
cutJson.put("rotation", point[3]);
|
|
models.add(cutJson);
|
|
models.add(cutJson);
|
|
|
|
+ } else { // 多数据集
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 2. 合并场景表(t_merge_info)获取dataSetId, 场景码
|
|
|
|
+ List<MergeInfoEntity> mergeInfo = mergeInfoService.findBySceneCode(sceneCode, 1);
|
|
|
|
+ int SizeDataSet = dataSetInfos.size();
|
|
|
|
+ int SizeMergeDataSet = mergeInfo.size();
|
|
|
|
+ log.info("数据集数量:{}, 合并数据集数量: {}", SizeDataSet, SizeMergeDataSet);
|
|
|
|
+
|
|
|
|
+ for (MergeInfoEntity info : mergeInfo) {
|
|
|
|
+ // 获取本地坐标,旋转角度
|
|
|
|
+ Integer dataSetId = info.getDataSetId();
|
|
|
|
+ double[] point = covertPoint.get(dataSetId);
|
|
|
|
+
|
|
|
|
+ JSONObject cutJson = new JSONObject();
|
|
|
|
+ // 这两个参数算法不用,后端自己看
|
|
|
|
+ cutJson.put("sceneCode", info.getMergeCode());
|
|
|
|
+ cutJson.put("dataSetId", dataSetId);
|
|
|
|
+ // 算法要求用空格隔开
|
|
|
|
+ cutJson.put("file", info.getPath() + "/laser.las");
|
|
|
|
+ cutJson.put("translation", point[0] + " " + point[1] + " " + point[2]);
|
|
|
|
+ cutJson.put("rotation", point[3]);
|
|
|
|
+ models.add(cutJson);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
// 修剪模型参数
|
|
// 修剪模型参数
|
|
JSONObject mergeCut = new JSONObject();
|
|
JSONObject mergeCut = new JSONObject();
|
|
mergeCut.put("model", models);
|
|
mergeCut.put("model", models);
|
|
@@ -341,9 +451,9 @@ public class CutModelServiceImpl extends IBaseServiceImpl implements CutModelSer
|
|
log.info("剪切参数json写入完成");
|
|
log.info("剪切参数json写入完成");
|
|
|
|
|
|
// 剪切并oss上传模型
|
|
// 剪切并oss上传模型
|
|
- ossUrl = cutLas(basePath, sceneCode);
|
|
|
|
|
|
+ ossUrl = cutLas(basePath, sceneCode);
|
|
|
|
+
|
|
|
|
|
|
- }
|
|
|
|
// 数据更新到数据库
|
|
// 数据更新到数据库
|
|
saveLasInfo(sceneCode, ossUrl);
|
|
saveLasInfo(sceneCode, ossUrl);
|
|
|
|
|
|
@@ -358,6 +468,31 @@ public class CutModelServiceImpl extends IBaseServiceImpl implements CutModelSer
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 2021-11-04
|
|
|
|
+ * 处理剪切模型参数并剪切模型,结果上传oss
|
|
|
|
+ */
|
|
|
|
+ private void handleCutLas(){
|
|
|
|
+// JSONObject mergeCut = new JSONObject();
|
|
|
|
+// mergeCut.put("model", models);
|
|
|
|
+// // 这个值目前写死
|
|
|
|
+// mergeCut.put("aabb", "b-0.5 -0.5 -0.5 0.5 0.5 0.5");
|
|
|
|
+//
|
|
|
|
+// // 剪切模型参数json写入服务器
|
|
|
|
+//
|
|
|
|
+// if ("dev".equals(configConstant.active)){
|
|
|
|
+// basePath = configConstant.serverBasePath + "/" + sceneCode + "/results/laserData";
|
|
|
|
+// }
|
|
|
|
+// String savePath = basePath + "/merge_cut_param.json";
|
|
|
|
+// log.info("剪切参数:{}", savePath);
|
|
|
|
+// FileUtil.writeUtf8String(mergeCut.toJSONString(), savePath);
|
|
|
|
+// log.info("剪切参数json写入完成");
|
|
|
|
+//
|
|
|
|
+// // 剪切并oss上传模型
|
|
|
|
+// ossUrl = cutLas(basePath, sceneCode);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 模型剪切信息保存数据库
|
|
* 模型剪切信息保存数据库
|
|
*/
|
|
*/
|
|
private void saveLasInfo(String sceneCode, String ossUrl){
|
|
private void saveLasInfo(String sceneCode, String ossUrl){
|