|
@@ -4,6 +4,7 @@ package com.shkpr.service.alambizplugin.components.checker;
|
|
import com.global.base.log.LogLevelFlag;
|
|
import com.global.base.log.LogLevelFlag;
|
|
import com.global.base.log.LogPrintMgr;
|
|
import com.global.base.log.LogPrintMgr;
|
|
import com.shkpr.service.alambizplugin.commtools.BeanUtil;
|
|
import com.shkpr.service.alambizplugin.commtools.BeanUtil;
|
|
|
|
+import com.shkpr.service.alambizplugin.commtools.GeomUtil;
|
|
import com.shkpr.service.alambizplugin.components.AsyncResultManager;
|
|
import com.shkpr.service.alambizplugin.components.AsyncResultManager;
|
|
import com.shkpr.service.alambizplugin.constants.GisSurveySystemCheckKeys;
|
|
import com.shkpr.service.alambizplugin.constants.GisSurveySystemCheckKeys;
|
|
import com.shkpr.service.alambizplugin.constants.GisSurveySystemCheckResultHead;
|
|
import com.shkpr.service.alambizplugin.constants.GisSurveySystemCheckResultHead;
|
|
@@ -12,13 +13,10 @@ import com.shkpr.service.alambizplugin.constants.LogFlagBusiType;
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveyLayerApplyLine;
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveyLayerApplyLine;
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveyLayerApplyPoint;
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveyLayerApplyPoint;
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveySystemCheckDefine;
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveySystemCheckDefine;
|
|
-import com.shkpr.service.alambizplugin.dto.GisSurveySystemCheckDeviation;
|
|
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveySystemCheckElement;
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveySystemCheckElement;
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveySystemCheckId;
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveySystemCheckId;
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveySystemCheckResultDetail;
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveySystemCheckResultDetail;
|
|
import com.shkpr.service.alambizplugin.exception.UncheckedInterruptedException;
|
|
import com.shkpr.service.alambizplugin.exception.UncheckedInterruptedException;
|
|
-import org.locationtech.jts.geom.Coordinate;
|
|
|
|
-import org.locationtech.jts.util.NumberUtil;
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.scheduling.annotation.AsyncResult;
|
|
import org.springframework.scheduling.annotation.AsyncResult;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
@@ -65,17 +63,9 @@ public class IsolatedPointsFinder {
|
|
@Async
|
|
@Async
|
|
public ListenableFuture<GisSurveySystemCheckResultDetail> findIsolatedPoints(List<GisSurveyLayerApplyPoint> points
|
|
public ListenableFuture<GisSurveySystemCheckResultDetail> findIsolatedPoints(List<GisSurveyLayerApplyPoint> points
|
|
, List<GisSurveyLayerApplyLine> lines, GisSurveySystemCheckDefine define, GisSurveySystemCheckId systemCheckId) throws InterruptedException {
|
|
, List<GisSurveyLayerApplyLine> lines, GisSurveySystemCheckDefine define, GisSurveySystemCheckId systemCheckId) throws InterruptedException {
|
|
- //偏差集合
|
|
|
|
- List<GisSurveySystemCheckDeviation> deviations = define != null ? define.getDeviation() : Collections.emptyList();
|
|
|
|
//经纬度公差
|
|
//经纬度公差
|
|
- double lngTolerance = deviations.stream()
|
|
|
|
- .filter(deviation -> Objects.equals(GisSurveyTemplateDefine.LNG, deviation.getProperty()))
|
|
|
|
- .map(GisSurveySystemCheckDeviation::getTolerance)
|
|
|
|
- .findFirst().orElse(0d);
|
|
|
|
- double latTolerance = deviations.stream()
|
|
|
|
- .filter(deviation -> Objects.equals(GisSurveyTemplateDefine.LAT, deviation.getProperty()))
|
|
|
|
- .map(GisSurveySystemCheckDeviation::getTolerance)
|
|
|
|
- .findFirst().orElse(0d);
|
|
|
|
|
|
+ double lngTolerance = GeomUtil.getTolerance(define, GisSurveyTemplateDefine.LNG);
|
|
|
|
+ double latTolerance = GeomUtil.getTolerance(define, GisSurveyTemplateDefine.LAT);
|
|
|
|
|
|
LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, "开始执行寻找孤立点========>");
|
|
LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, "开始执行寻找孤立点========>");
|
|
long begin = System.currentTimeMillis();
|
|
long begin = System.currentTimeMillis();
|
|
@@ -98,8 +88,8 @@ public class IsolatedPointsFinder {
|
|
if (lines.isEmpty()) return new AsyncResult<>(createResult(Collections.emptyList(), systemCheckId, begin));
|
|
if (lines.isEmpty()) return new AsyncResult<>(createResult(Collections.emptyList(), systemCheckId, begin));
|
|
//点为空,则无孤立点
|
|
//点为空,则无孤立点
|
|
if (points.isEmpty()) return new AsyncResult<>(createResult(Collections.emptyList(), systemCheckId, begin));
|
|
if (points.isEmpty()) return new AsyncResult<>(createResult(Collections.emptyList(), systemCheckId, begin));
|
|
- //联通点线关系
|
|
|
|
- Map<String, List<GisSurveyLayerApplyLine>> connectedPoints = lines.parallelStream()
|
|
|
|
|
|
+ //联通线
|
|
|
|
+ Map<String, List<GisSurveyLayerApplyLine>> connectedLines = lines.parallelStream()
|
|
//响应中断
|
|
//响应中断
|
|
.peek(it -> {
|
|
.peek(it -> {
|
|
if (Thread.currentThread().isInterrupted())
|
|
if (Thread.currentThread().isInterrupted())
|
|
@@ -128,10 +118,10 @@ public class IsolatedPointsFinder {
|
|
//过滤连通点
|
|
//过滤连通点
|
|
.filter(point -> {
|
|
.filter(point -> {
|
|
//判断是否和线连通
|
|
//判断是否和线连通
|
|
- if (!connectedPoints.containsKey(point.getCode())) return true;
|
|
|
|
|
|
+ if (!connectedLines.containsKey(point.getCode())) return true;
|
|
//遍历连通的线,判断是否有包含关系
|
|
//遍历连通的线,判断是否有包含关系
|
|
- return connectedPoints.get(point.getCode()).stream()
|
|
|
|
- .noneMatch(line -> calcContain(line, point, lngTolerance, latTolerance));
|
|
|
|
|
|
+ return connectedLines.get(point.getCode()).stream()
|
|
|
|
+ .noneMatch(line -> GeomUtil.calcContain(line, point, lngTolerance, latTolerance));
|
|
})
|
|
})
|
|
//转为返回元素
|
|
//转为返回元素
|
|
.map(point -> BeanUtil.copy(point, GisSurveySystemCheckElement.class))
|
|
.map(point -> BeanUtil.copy(point, GisSurveySystemCheckElement.class))
|
|
@@ -143,40 +133,6 @@ public class IsolatedPointsFinder {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 计算包含
|
|
|
|
- *
|
|
|
|
- * @param line 线
|
|
|
|
- * @param point 点
|
|
|
|
- * @param lngTolerance 经度公差
|
|
|
|
- * @param latTolerance 纬度公差
|
|
|
|
- * @return 包含关系
|
|
|
|
- */
|
|
|
|
- private Boolean calcContain(GisSurveyLayerApplyLine line, GisSurveyLayerApplyPoint point, double lngTolerance, double latTolerance) {
|
|
|
|
- //上节点判断
|
|
|
|
- if (Objects.equals(point.getCode(), line.getUpNode())) {
|
|
|
|
- //线坐标
|
|
|
|
- Coordinate lineCcoordinate = line.getGis().getCoordinateN(0);
|
|
|
|
- //点坐标
|
|
|
|
- Coordinate pointCoordinate = point.getGis().getCoordinate();
|
|
|
|
- //比较x和y
|
|
|
|
- return NumberUtil.equalsWithTolerance(lineCcoordinate.x, pointCoordinate.x, lngTolerance) &&
|
|
|
|
- NumberUtil.equalsWithTolerance(lineCcoordinate.y, pointCoordinate.y, latTolerance);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- //下节点判断
|
|
|
|
- if (Objects.equals(point.getCode(), line.getDownNode())) {
|
|
|
|
- //线坐标
|
|
|
|
- Coordinate lineCcoordinate = line.getGis().getCoordinateN(line.getGis().getCoordinates().length - 1);
|
|
|
|
- //点坐标
|
|
|
|
- Coordinate pointCoordinate = point.getGis().getCoordinate();
|
|
|
|
- //比较x和y
|
|
|
|
- return NumberUtil.equalsWithTolerance(lineCcoordinate.x, pointCoordinate.x, lngTolerance) &&
|
|
|
|
- NumberUtil.equalsWithTolerance(lineCcoordinate.y, pointCoordinate.y, latTolerance);
|
|
|
|
- }
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
* 创建结果
|
|
* 创建结果
|
|
*
|
|
*
|
|
* @param data 数据
|
|
* @param data 数据
|