|
@@ -326,6 +326,13 @@ function getBearingPoint(point, lastBearing, bearing, airlineWidth) {
|
|
|
return [leftPoint, rightPoint]
|
|
return [leftPoint, rightPoint]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function myRound(num, digits) {
|
|
|
|
|
+ if(digits == null)
|
|
|
|
|
+ digits = 6 // 比较的精度,经纬度会被经过度分秒方式到浮点方式的转化
|
|
|
|
|
+
|
|
|
|
|
+ return Math.round(num * Math.pow(10, digits)) / Math.pow(10, digits)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function isLineConnect(line1, line2) {
|
|
function isLineConnect(line1, line2) {
|
|
|
// 判断 line1 的终点和 line2 的起点是否相同
|
|
// 判断 line1 的终点和 line2 的起点是否相同
|
|
|
let line1LastPoint = line1.coordinates[line1.coordinates.length -1]
|
|
let line1LastPoint = line1.coordinates[line1.coordinates.length -1]
|
|
@@ -334,19 +341,14 @@ function isLineConnect(line1, line2) {
|
|
|
let [line1lat, line1lng] = getFixedLatLng(line1LastPoint)
|
|
let [line1lat, line1lng] = getFixedLatLng(line1LastPoint)
|
|
|
let [line2lat, line2lng] = getFixedLatLng(line2FirstPoint)
|
|
let [line2lat, line2lng] = getFixedLatLng(line2FirstPoint)
|
|
|
|
|
|
|
|
- let precision = 9 // 比较的精度,经纬度会被经过度分秒方式到浮点方式的转化
|
|
|
|
|
-
|
|
|
|
|
- if(line1lat.toFixed(precision) == line2lat.toFixed(precision)
|
|
|
|
|
- && line1lng.toFixed(precision) == line2lng.toFixed(precision)) {
|
|
|
|
|
|
|
+ if(myRound(line1lat) == myRound(line2lat)
|
|
|
|
|
+ && myRound(line1lng) == myRound(line2lng)) {
|
|
|
return true
|
|
return true
|
|
|
} else {
|
|
} else {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function getPolygonFromLine(line, airlineWidth) {
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
function getLinesPolygonsAndMarkers(airspaceInfos, setStyle, currentAirspaceIndex) {
|
|
function getLinesPolygonsAndMarkers(airspaceInfos, setStyle, currentAirspaceIndex) {
|
|
|
let retLines = [];
|
|
let retLines = [];
|
|
|
let retMarkers = [];
|
|
let retMarkers = [];
|