|
|
@@ -124,12 +124,12 @@ export interface AirspaceInfoPolygonServer {
|
|
|
}
|
|
|
|
|
|
// Local
|
|
|
-export interface CoordinateShortString {
|
|
|
- lat: string;
|
|
|
- lng: string;
|
|
|
+export interface CoordinateShort {
|
|
|
+ lat: number;
|
|
|
+ lng: number;
|
|
|
}
|
|
|
|
|
|
-export interface LatLngAddrLocal extends CoordinateShortString {
|
|
|
+export interface LatLngAddrLocal extends CoordinateShort {
|
|
|
addr: string;
|
|
|
}
|
|
|
|
|
|
@@ -139,7 +139,7 @@ export interface LatLngPointLocal extends LatLngAddrLocal{
|
|
|
}
|
|
|
|
|
|
// Passpoint
|
|
|
-export interface PassingPointNavLocal extends CoordinateShortString {
|
|
|
+export interface PassingPointNavLocal extends CoordinateShort {
|
|
|
pointType: 1;
|
|
|
height: string;
|
|
|
heightStandard: string;
|
|
|
@@ -159,7 +159,7 @@ export interface PassingPointAirlineLocal {
|
|
|
airlines: Array<AirRoutePoint>;
|
|
|
}
|
|
|
|
|
|
-export interface PassingPointNormalLocal extends CoordinateShortString {
|
|
|
+export interface PassingPointNormalLocal extends CoordinateShort {
|
|
|
pointType: 3;
|
|
|
height: string;
|
|
|
heightStandard: string;
|
|
|
@@ -175,8 +175,8 @@ export interface AirspaceInfoCircleLocal {
|
|
|
note: string;
|
|
|
|
|
|
addr: string;
|
|
|
- lat: string;
|
|
|
- lng: string;
|
|
|
+ lat: number;
|
|
|
+ lng: number;
|
|
|
radius: number;
|
|
|
height: string;
|
|
|
heightStandard: string;
|
|
|
@@ -269,8 +269,8 @@ export function convertAirspaceInfoServerToLocal(airspaceInfo
|
|
|
name: ai.airspace_name,
|
|
|
note: ai.note,
|
|
|
addr: ai.center_loc,
|
|
|
- lat: latLngDecimalToDegrees(ai.center_point_of_flying.lat),
|
|
|
- lng: latLngDecimalToDegrees(ai.center_point_of_flying.lng),
|
|
|
+ lat: ai.center_point_of_flying.lat,
|
|
|
+ lng: ai.center_point_of_flying.lng,
|
|
|
radius: ai.radius_of_flying,
|
|
|
height: ai.altitude + "",
|
|
|
heightStandard: Global.heightStandardsById.get(ai.unit)
|
|
|
@@ -281,16 +281,16 @@ export function convertAirspaceInfoServerToLocal(airspaceInfo
|
|
|
const ai: AirspaceInfoLineServer = <AirspaceInfoLineServer> airspaceInfo
|
|
|
let dep = {
|
|
|
addr: ai.start_loc,
|
|
|
- lat: latLngDecimalToDegrees(ai.start_point.lat),
|
|
|
- lng: latLngDecimalToDegrees(ai.start_point.lng),
|
|
|
+ lat: ai.start_point.lat,
|
|
|
+ lng: ai.start_point.lng,
|
|
|
height: ai.start_point.altitude + "",
|
|
|
heightStandard: Global.heightStandardsById.get(ai.start_point.unit)
|
|
|
}
|
|
|
|
|
|
let arrive = {
|
|
|
addr: ai.end_loc,
|
|
|
- lat: latLngDecimalToDegrees(ai.end_point.lat),
|
|
|
- lng: latLngDecimalToDegrees(ai.end_point.lng)
|
|
|
+ lat: ai.end_point.lat,
|
|
|
+ lng: ai.end_point.lng
|
|
|
}
|
|
|
|
|
|
let passPoints: (PassingPointNavLocal | PassingPointAirlineLocal | PassingPointNormalLocal)[] = []
|
|
|
@@ -300,8 +300,8 @@ export function convertAirspaceInfoServerToLocal(airspaceInfo
|
|
|
|
|
|
if (obj.point_type == Global.pointTypes.point) {
|
|
|
const pp = <PassingPointNormalServer>obj;
|
|
|
- const lat = latLngDecimalToDegrees(pp.lat)
|
|
|
- const lng = latLngDecimalToDegrees(pp.lng)
|
|
|
+ const lat = pp.lat
|
|
|
+ const lng = pp.lng
|
|
|
|
|
|
point = <PassingPointNormalLocal>{
|
|
|
pointType: pp.point_type,
|
|
|
@@ -310,8 +310,8 @@ export function convertAirspaceInfoServerToLocal(airspaceInfo
|
|
|
}
|
|
|
} else if (obj.point_type == Global.pointTypes.nav) {
|
|
|
const pp = <PassingPointNavServer>obj;
|
|
|
- const lat = latLngDecimalToDegrees(pp.lat)
|
|
|
- const lng = latLngDecimalToDegrees(pp.lng)
|
|
|
+ const lat = pp.lat
|
|
|
+ const lng = pp.lng
|
|
|
|
|
|
point = <PassingPointNavLocal>{
|
|
|
pointType: pp.point_type,
|
|
|
@@ -366,7 +366,7 @@ export function convertAirspaceInfoServerToLocal(airspaceInfo
|
|
|
defaultPointName = String.fromCharCode(defaultPointName.charCodeAt(0) + 1)
|
|
|
}
|
|
|
|
|
|
- polygonPoints.push({addr, lat: latLngDecimalToDegrees(obj.lat), lng: latLngDecimalToDegrees(obj.lng)})
|
|
|
+ polygonPoints.push({addr, lat: obj.lat, lng: obj.lng})
|
|
|
}
|
|
|
|
|
|
return <AirspaceInfoPolygonLocal>{
|
|
|
@@ -396,8 +396,8 @@ export function convertAirspaceInfoLocalToServer(airspace
|
|
|
note: isSafeString(ai.note) ? ai.note : null,
|
|
|
radius_of_flying: parseInt(ai.radius + ''),
|
|
|
center_point_of_flying: {
|
|
|
- lng: latLngDegreesToDecimal(ai.lng),
|
|
|
- lat: latLngDegreesToDecimal(ai.lat)
|
|
|
+ lng: ai.lng,
|
|
|
+ lat: ai.lat
|
|
|
},
|
|
|
center_loc: ai.addr,
|
|
|
altitude: parseInt(ai.height),
|
|
|
@@ -413,15 +413,15 @@ export function convertAirspaceInfoLocalToServer(airspace
|
|
|
note: ai.note,
|
|
|
start_loc: ai.dep.addr,
|
|
|
start_point: {
|
|
|
- lng: latLngDegreesToDecimal(ai.dep.lng),
|
|
|
- lat: latLngDegreesToDecimal(ai.dep.lat),
|
|
|
+ lng: ai.dep.lng,
|
|
|
+ lat: ai.dep.lat,
|
|
|
altitude: parseInt(ai.dep.height),
|
|
|
unit: Global.heightStandards.get(ai.dep.heightStandard)
|
|
|
},
|
|
|
end_loc: ai.arrive.addr,
|
|
|
end_point: {
|
|
|
- lng: latLngDegreesToDecimal(ai.arrive.lng),
|
|
|
- lat: latLngDegreesToDecimal(ai.arrive.lat)
|
|
|
+ lng: ai.arrive.lng,
|
|
|
+ lat: ai.arrive.lat
|
|
|
}
|
|
|
}
|
|
|
if(ai.airlineWidth) {
|
|
|
@@ -438,8 +438,8 @@ export function convertAirspaceInfoLocalToServer(airspace
|
|
|
retObj = <PassingPointNormalServer>{
|
|
|
point_type: Global.pointTypes.point,
|
|
|
point_name: pp.addr,
|
|
|
- lat: latLngDegreesToDecimal(pp.lat),
|
|
|
- lng: latLngDegreesToDecimal(pp.lng)
|
|
|
+ lat: pp.lat,
|
|
|
+ lng: pp.lng
|
|
|
};
|
|
|
} else if (obj.pointType == Global.pointTypes.nav) {
|
|
|
const pp = <PassingPointNavLocal>obj;
|
|
|
@@ -448,8 +448,8 @@ export function convertAirspaceInfoLocalToServer(airspace
|
|
|
point_name: pp.pointName,
|
|
|
point_id: pp.pointId,
|
|
|
point_code: pp.pointCode,
|
|
|
- lat: latLngDegreesToDecimal(pp.lat),
|
|
|
- lng: latLngDegreesToDecimal(pp.lng)
|
|
|
+ lat: pp.lat,
|
|
|
+ lng: pp.lng
|
|
|
};
|
|
|
} else {
|
|
|
const pp = <PassingPointAirlineLocal>obj;
|
|
|
@@ -477,11 +477,6 @@ export function convertAirspaceInfoLocalToServer(airspace
|
|
|
} else {
|
|
|
const ai = <AirspaceInfoPolygonLocal> airspace;
|
|
|
|
|
|
- let points = [];
|
|
|
- for (let obj of ai.polygonPoints) {
|
|
|
- points.push({ addr: obj.addr, lat: latLngDegreesToDecimal(obj.lat), lng: latLngDegreesToDecimal(obj.lng) })
|
|
|
- }
|
|
|
-
|
|
|
const polygon = <AirspaceInfoPolygonServer>{
|
|
|
airspace_name: ai.name,
|
|
|
airspace_id: ai.airspaceId,
|
|
|
@@ -489,7 +484,7 @@ export function convertAirspaceInfoLocalToServer(airspace
|
|
|
note: ai.note,
|
|
|
altitude: parseInt(ai.height),
|
|
|
unit: Global.heightStandards.get(ai.heightStandard),
|
|
|
- points
|
|
|
+ points: ai.polygonPoints
|
|
|
};
|
|
|
return polygon;
|
|
|
}
|
|
|
@@ -560,8 +555,8 @@ function getCirclesAndMarkers(airspaceInfos: AirspaceInfo[], setStyle: (styleNam
|
|
|
coordinate.longitude = ai.center_point_of_flying.lng;
|
|
|
} else {
|
|
|
let ai = <AirspaceInfoCircleLocal>tmpCircle;
|
|
|
- coordinate.latitude = latLngDegreesToDecimal(ai.lat);
|
|
|
- coordinate.longitude = latLngDegreesToDecimal(ai.lng);
|
|
|
+ coordinate.latitude = ai.lat;
|
|
|
+ coordinate.longitude = ai.lng;
|
|
|
}
|
|
|
|
|
|
let radius = (tmpCircle as any)[radiusFix];
|
|
|
@@ -570,8 +565,7 @@ function getCirclesAndMarkers(airspaceInfos: AirspaceInfo[], setStyle: (styleNam
|
|
|
let circle = <Circle>{lineWidth, strokeColor, fillColor, radius, coordinate}
|
|
|
circles.push(circle);
|
|
|
} else {
|
|
|
- // 这里的经纬度必定是数值, 所以最后一个参数是 2
|
|
|
- markers.push(addOvalPointConfig(coordinate.latitude, coordinate.longitude, imageName, 2));
|
|
|
+ markers.push(addOvalPointConfig(coordinate.latitude, coordinate.longitude, imageName));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -588,26 +582,19 @@ function getCircleAndMarkerSelector(airspaceInfos: () => AirspaceInfo[], setStyl
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-function getLatLng(latlng: number | string, dataType: number): number {
|
|
|
- if(dataType == 1) { // 驼峰模式,新建计划的时候的格式
|
|
|
- return latLngDegreesToDecimal(<string>latlng)
|
|
|
- } else {
|
|
|
- return <number>latlng
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
-function drawLineConfig(lat: number | string, lng: number | string, dataType: number) {
|
|
|
+function drawLineConfig(lat: number, lng: number) {
|
|
|
return {
|
|
|
- latitude: getLatLng(lat, dataType),
|
|
|
- longitude: getLatLng(lng, dataType)
|
|
|
+ latitude: lat,
|
|
|
+ longitude: lng
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-function addOvalPointConfig(lat: number | string, lng: number | string, imageName: string, dataType: number) {
|
|
|
+function addOvalPointConfig(lat: number, lng: number, imageName: string) {
|
|
|
return {
|
|
|
coordinate: {
|
|
|
- latitude: getLatLng(lat, dataType),
|
|
|
- longitude: getLatLng(lng, dataType)
|
|
|
+ latitude: lat,
|
|
|
+ longitude: lng
|
|
|
},
|
|
|
imageName: imageName
|
|
|
};
|
|
|
@@ -705,11 +692,10 @@ function getLinesRouter(lineProps: AirspaceInfoLine, lineAndMarkerStyle: ShapeSt
|
|
|
strokeColor = lineAndMarkerStyle.strokeColor
|
|
|
}
|
|
|
|
|
|
- let startPoint, passPoints, endPoint, pointTypeFix, dataType, airlineWidth
|
|
|
+ let startPoint, passPoints, endPoint, pointTypeFix, airlineWidth
|
|
|
|
|
|
if ((lineProps as any).start_point) {
|
|
|
let ll = <AirspaceInfoLineServer>lineProps;
|
|
|
- dataType = 2 // 下划线模式
|
|
|
|
|
|
startPoint = ll['start_point']
|
|
|
passPoints = ll['passing_points']
|
|
|
@@ -718,7 +704,6 @@ function getLinesRouter(lineProps: AirspaceInfoLine, lineAndMarkerStyle: ShapeSt
|
|
|
airlineWidth = parseInt(ll['airline_width'] + '', 10)
|
|
|
} else {
|
|
|
let ll = <AirspaceInfoLineLocal>lineProps;
|
|
|
- dataType = 1 // 驼峰模式
|
|
|
|
|
|
startPoint = ll['dep']
|
|
|
passPoints = ll['passPoints']
|
|
|
@@ -728,8 +713,8 @@ function getLinesRouter(lineProps: AirspaceInfoLine, lineAndMarkerStyle: ShapeSt
|
|
|
}
|
|
|
|
|
|
if (startPoint) {
|
|
|
- coordinates.push(drawLineConfig(startPoint.lat, startPoint.lng, dataType));
|
|
|
- markers.push(addOvalPointConfig(startPoint.lat, startPoint.lng, imageName, dataType));
|
|
|
+ coordinates.push(drawLineConfig(startPoint.lat, startPoint.lng));
|
|
|
+ markers.push(addOvalPointConfig(startPoint.lat, startPoint.lng, imageName));
|
|
|
}
|
|
|
|
|
|
if (Array.isArray(passPoints)) {
|
|
|
@@ -743,8 +728,8 @@ function getLinesRouter(lineProps: AirspaceInfoLine, lineAndMarkerStyle: ShapeSt
|
|
|
if ( pointType == Global.pointTypes.point
|
|
|
|| pointType == Global.pointTypes.nav) {
|
|
|
let pp = <PassingPointNav | PassingPointNormal>obj
|
|
|
- coordinates.push(drawLineConfig(pp.lat, pp.lng, dataType));
|
|
|
- markers.push(addOvalPointConfig(pp.lat, pp.lng, imageName, dataType));
|
|
|
+ coordinates.push(drawLineConfig(pp.lat, pp.lng));
|
|
|
+ markers.push(addOvalPointConfig(pp.lat, pp.lng, imageName));
|
|
|
} else {
|
|
|
// 遇到一个航线,不需要和前前面的点连起来
|
|
|
let pp = <PassingPointAirline>obj
|
|
|
@@ -763,8 +748,8 @@ function getLinesRouter(lineProps: AirspaceInfoLine, lineAndMarkerStyle: ShapeSt
|
|
|
}
|
|
|
|
|
|
if (endPoint) {
|
|
|
- coordinates.push(drawLineConfig(endPoint.lat, endPoint.lng, dataType));
|
|
|
- markers.push(addOvalPointConfig(endPoint.lat, endPoint.lng, imageName, dataType));
|
|
|
+ coordinates.push(drawLineConfig(endPoint.lat, endPoint.lng));
|
|
|
+ markers.push(addOvalPointConfig(endPoint.lat, endPoint.lng, imageName));
|
|
|
}
|
|
|
|
|
|
if (coordinates.length > 1) {
|
|
|
@@ -784,12 +769,6 @@ function getFixedLatLng(point: {lat?: string | number, lng?: string | number, la
|
|
|
let lat = pp.latitude ? pp.latitude : pp.lat
|
|
|
let lng = pp.longitude ? pp.longitude : pp.lng
|
|
|
|
|
|
- // 复制计划的数据,有的点是度数模式如 38°35′17″
|
|
|
- if(isSafeString(lat)) {
|
|
|
- lat = latLngDegreesToDecimal(<string>lat);
|
|
|
- lng = latLngDegreesToDecimal(<string>lng);
|
|
|
- }
|
|
|
-
|
|
|
return [lat, lng]
|
|
|
}
|
|
|
|
|
|
@@ -887,13 +866,11 @@ function getPolygon(polygonProps: AirspaceInfoPolygon, polygonAndMarkerStyle: Sh
|
|
|
fillColor = polygonAndMarkerStyle.fillColor
|
|
|
}
|
|
|
|
|
|
- let pointsFix, dataType;
|
|
|
+ let pointsFix;
|
|
|
if ((polygonProps as any).points) {
|
|
|
pointsFix = 'points';
|
|
|
- dataType = 2
|
|
|
} else {
|
|
|
pointsFix = 'polygonPoints';
|
|
|
- dataType = 1 // 驼峰模式
|
|
|
}
|
|
|
|
|
|
if (Array.isArray((polygonProps as any)[pointsFix])) {
|
|
|
@@ -901,8 +878,8 @@ function getPolygon(polygonProps: AirspaceInfoPolygon, polygonAndMarkerStyle: Sh
|
|
|
if (!obj) {
|
|
|
continue
|
|
|
}
|
|
|
- coordinates.push(drawLineConfig(obj.lat, obj.lng, dataType));
|
|
|
- markers.push(addOvalPointConfig(obj.lat, obj.lng, imageName, dataType));
|
|
|
+ coordinates.push(drawLineConfig(obj.lat, obj.lng));
|
|
|
+ markers.push(addOvalPointConfig(obj.lat, obj.lng, imageName));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1163,7 +1140,7 @@ export function circleContent(airspaceInfo: AirspaceInfoCircle, type=3) {
|
|
|
let content = []
|
|
|
let loc = `以${airspaceInfo.addr}`
|
|
|
if(type == 1 || type == 3)
|
|
|
- loc += `(E${airspaceInfo.lng}, N${airspaceInfo.lat})`;
|
|
|
+ loc += `(E${latLngDecimalToDegrees(airspaceInfo.lng)}, N${latLngDecimalToDegrees(airspaceInfo.lat)})`;
|
|
|
content.push(`${loc}为中心`)
|
|
|
content.push(`半径${airspaceInfo.radius}米`);
|
|
|
content.push(getHeight(airspaceInfo.height, airspaceInfo.heightStandard, type))
|
|
|
@@ -1247,7 +1224,7 @@ export function lineContent(airspaceInfo: AirspaceInfoLine, type=3): string {
|
|
|
let content = [];
|
|
|
content.push(`${airspaceInfo.dep.addr}`)
|
|
|
if(type == 1 || type == 3)
|
|
|
- content.push(`(E${airspaceInfo.dep.lng}, N${airspaceInfo.dep.lat})`)
|
|
|
+ content.push(`(E${latLngDecimalToDegrees(airspaceInfo.dep.lng)}, N${latLngDecimalToDegrees(airspaceInfo.dep.lat)})`)
|
|
|
content.push(` - ${getHeight(airspaceInfo.dep.height, airspaceInfo.dep.heightStandard, type)}`);
|
|
|
|
|
|
if (Array.isArray(airspaceInfo.passPoints)) {
|
|
|
@@ -1258,12 +1235,12 @@ export function lineContent(airspaceInfo: AirspaceInfoLine, type=3): string {
|
|
|
let pp = <PassingPointNormalLocal>obj;
|
|
|
content.push(` - ${pp.addr}`)
|
|
|
if(type == 1 || type == 3)
|
|
|
- content.push(`(E${pp.lng}, N${pp.lat})`);
|
|
|
+ content.push(`(E${latLngDecimalToDegrees(pp.lng)}, N${latLngDecimalToDegrees(pp.lat)})`);
|
|
|
} else if (obj.pointType == Global.pointTypes.nav) {
|
|
|
let pp = <PassingPointNavLocal>obj;
|
|
|
content.push(` - ${pp.pointCode}`)
|
|
|
if(type == 1 || type == 3)
|
|
|
- content.push(`(E${pp.lng}, N${pp.lat})`);
|
|
|
+ content.push(`(E${latLngDecimalToDegrees(pp.lng)}, N${latLngDecimalToDegrees(pp.lat)})`);
|
|
|
} else {
|
|
|
let pp = <PassingPointAirlineLocal>obj;
|
|
|
content.push(` - ${pp.airlineCode}`);
|
|
|
@@ -1276,7 +1253,7 @@ export function lineContent(airspaceInfo: AirspaceInfoLine, type=3): string {
|
|
|
}
|
|
|
content.push(` - ${airspaceInfo.arrive.addr}`)
|
|
|
if(type == 1 || type == 3)
|
|
|
- content.push(`(E${airspaceInfo.arrive.lng}, N${airspaceInfo.arrive.lat})`);
|
|
|
+ content.push(`(E${latLngDecimalToDegrees(airspaceInfo.arrive.lng)}, N${latLngDecimalToDegrees(airspaceInfo.arrive.lat)})`);
|
|
|
if(airspaceInfo.airlineWidth) {
|
|
|
content.push(`,宽度:${airspaceInfo.airlineWidth}米`)
|
|
|
}
|
|
|
@@ -1316,7 +1293,7 @@ export function polygonContent(airspaceInfo: AirspaceInfoPolygon, type=3): strin
|
|
|
let obj = airspaceInfo.polygonPoints[i];
|
|
|
let c = `${obj.addr ? obj.addr : ''}`
|
|
|
if(type == 1 || type == 3)
|
|
|
- c += `(E${obj.lng}, N${obj.lat})`
|
|
|
+ c += `(E${latLngDecimalToDegrees(obj.lng)}, N${latLngDecimalToDegrees(obj.lat)})`
|
|
|
content.push(c)
|
|
|
}
|
|
|
let cc = content.join('、') + `${length}点连线范围内`
|