|
@@ -274,6 +274,34 @@ public class FzssServiceImpl implements IFzssService {
|
|
|
return RequestResult.success(resMap);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 花落去因子的大地块
|
|
|
+ */
|
|
|
+ private String getFactorEwkt(String tableName, String ewkt, float factorRadius, float ewktRadius) {
|
|
|
+ // 0.生成范围的缓冲区
|
|
|
+ if (ewktRadius != 0) {
|
|
|
+ ewkt = createUtilsDBService.bufferEekt(ewkt, ewktRadius);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1.查询因子地块
|
|
|
+ String tempTable = createUtilsDBService.intersectionTableWkt(tableName, null, ewkt);
|
|
|
+ Integer integer = ghdkaMapper.getTableCount(tempTable);
|
|
|
+ if (integer == 0) return "";
|
|
|
+ // 2.生成因子地块缓冲区
|
|
|
+ if (factorRadius != 0) {
|
|
|
+ tempTable = createUtilsDBService.bufferTable(tempTable, factorRadius);
|
|
|
+ }
|
|
|
+ // 3.生成因子地块ewkt
|
|
|
+ TableNameIdsVo tableNameIdsVo = new TableNameIdsVo();
|
|
|
+ tableNameIdsVo.setTableName(tempTable);
|
|
|
+ String calculateEwkt = tableDateService.getGeomUnion(tableNameIdsVo);
|
|
|
+ return calculateEwkt;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // iLogService.saveLog(taskId, "辅助选址", factorUseDTO.getFactorName() + "因子影响分析完成", "info");
|
|
|
+ // iLogService.saveLog(taskId, "辅助选址", factorUseDTO.getFactorName() + "因子影响分析完成", "info");
|
|
|
+
|
|
|
/**
|
|
|
* 根据因子筛选地块
|
|
|
*
|
|
@@ -283,57 +311,39 @@ public class FzssServiceImpl implements IFzssService {
|
|
|
* @param ewkt
|
|
|
*/
|
|
|
private String factorFilter(String taskId, String rawTable, List<FactorUseDTO> factorUseDTOS, String ewkt) {
|
|
|
-
|
|
|
for (FactorUseDTO factorUseDTO : factorUseDTOS) {
|
|
|
if (factorUseDTO.getSpatialType().equals("intersect")) {
|
|
|
- // 相交判断
|
|
|
// 1.先切割因子地块
|
|
|
- String tempTable = createUtilsDBService.intersectionTableWkt(factorUseDTO.getFactorBsm(), null, ewkt);
|
|
|
- Integer integer = ghdkaMapper.getTableCount(tempTable);
|
|
|
- if (integer == 0) {
|
|
|
- // TODO 再定
|
|
|
- iLogService.saveLog(taskId, "辅助选址", factorUseDTO.getFactorName() + "因子影响分析完成", "info");
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 2.生成因子地块缓冲区
|
|
|
- if (factorUseDTO.getDefaultValue() != 0) {
|
|
|
- // 没有值直接计算
|
|
|
- tempTable = createUtilsDBService.bufferTable(tempTable, factorUseDTO.getDefaultValue());
|
|
|
-
|
|
|
- integer = ghdkaMapper.getTableCount(tempTable);
|
|
|
- if (integer == 0) {
|
|
|
- // TODO 再定
|
|
|
- iLogService.saveLog(taskId, "辅助选址", factorUseDTO.getFactorName() + "因子影响分析完成", "info");
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- // 3.地块切割
|
|
|
- // 3.1查询需要切割的地块
|
|
|
- TableNameIdsVo tableNameIdsVo = new TableNameIdsVo();
|
|
|
- tableNameIdsVo.setTableName(tempTable);
|
|
|
- String calculateEwkt = tableDateService.getGeomUnion(tableNameIdsVo);
|
|
|
-
|
|
|
- // 3.2切割
|
|
|
+ String calculateEwkt = getFactorEwkt(factorUseDTO.getFactorName(), ewkt, factorUseDTO.getDefaultValue());
|
|
|
+ // 2.切割地块
|
|
|
if (factorUseDTO.getDefaultType().equals("intersect")) {
|
|
|
- // 相交判断
|
|
|
+ // 地块与因子求交集
|
|
|
rawTable = createUtilsDBService.intersectionTableWkt(rawTable, null, calculateEwkt);
|
|
|
} else {
|
|
|
- // 不相交判断
|
|
|
+ // 地块与因子求差集
|
|
|
rawTable = createUtilsDBService.differenceTableWkt(rawTable, null, calculateEwkt);
|
|
|
}
|
|
|
} else if (factorUseDTO.getSpatialType().equals("contain")) {
|
|
|
+ // TODO 计算地块缓冲区可能有问题,但是现在包含没有缓冲区
|
|
|
+ // 1.先切割因子地块
|
|
|
+ String calculateEwkt = getFactorEwkt(factorUseDTO.getFactorName(), ewkt, factorUseDTO.getDefaultValue(), 0);
|
|
|
// 包含判断
|
|
|
- if (factorUseDTO.getDefaultValue() == 0) {
|
|
|
-
|
|
|
+ if (factorUseDTO.getDefaultType().equals("contain")) {
|
|
|
+ // 地块与因子求差集
|
|
|
+ rawTable = createUtilsDBService.intersectionTableWkt(rawTable, null, calculateEwkt);
|
|
|
} else {
|
|
|
-
|
|
|
+ // 地块与因子求差集
|
|
|
+ rawTable = createUtilsDBService.differenceTableWkt(rawTable, null, calculateEwkt);
|
|
|
}
|
|
|
} else if (factorUseDTO.getSpatialType().equals("distance")) {
|
|
|
+ String calculateEwkt = getFactorEwkt(factorUseDTO.getFactorName(), ewkt, factorUseDTO.getDefaultValue(), factorUseDTO.getDefaultValue());
|
|
|
// 距离判断
|
|
|
- if (factorUseDTO.getDefaultValue() == 0) {
|
|
|
-
|
|
|
+ if (factorUseDTO.getDefaultType().equals("lt") || factorUseDTO.getDefaultType().equals("let")) {
|
|
|
+ // 地块与因子求差集
|
|
|
+ rawTable = createUtilsDBService.intersectionTableWkt(rawTable, null, calculateEwkt);
|
|
|
} else {
|
|
|
-
|
|
|
+ // 地块与因子求差集
|
|
|
+ rawTable = createUtilsDBService.differenceTableWkt(rawTable, null, calculateEwkt);
|
|
|
}
|
|
|
}
|
|
|
if (0 == 0) {
|