|
|
@@ -36,18 +36,18 @@ function getCircles(airspaceInfos, setStyle, currentAirspaceIndex) {
|
|
|
airspaceTypeFix = 'airspace_type';
|
|
|
if (tmpCircle[airspaceTypeFix] == Global.airspaceType.circle && currentAirspaceIndex != i) {
|
|
|
let coordinate = {};
|
|
|
- if(tmpCircle.center_point_of_flying){
|
|
|
+ if (tmpCircle.center_point_of_flying) {
|
|
|
coordinate.latitude = tmpCircle.center_point_of_flying.lat;
|
|
|
coordinate.longitude = tmpCircle.center_point_of_flying.lng;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
coordinate.latitude = latLngDegreesToDecimal(tmpCircle.lat);
|
|
|
coordinate.longitude = latLngDegreesToDecimal(tmpCircle.lng);
|
|
|
}
|
|
|
let radius = tmpCircle.radius_of_flying;
|
|
|
let circle = {
|
|
|
- lineWidth: circleStyle && circleStyle.lineWidth ? circleStyle.lineWidth : Global.amapLineWidth,
|
|
|
- strokeColor: circleStyle && circleStyle.strokeColor ? circleStyle.strokeColor : Global.amapStrokeColor,
|
|
|
- fillColor: circleStyle && circleStyle.fillColor ? circleStyle.fillColor : Global.amapFillColor,
|
|
|
+ lineWidth: circleStyle.lineWidth ? circleStyle.lineWidth : Global.amapLineWidth,
|
|
|
+ strokeColor: circleStyle.strokeColor ? circleStyle.strokeColor : Global.amapStrokeColor,
|
|
|
+ fillColor: circleStyle.fillColor ? circleStyle.fillColor : Global.amapFillColor,
|
|
|
radius,
|
|
|
coordinate
|
|
|
}
|
|
|
@@ -124,22 +124,45 @@ function getLinesRouter(lineProps, lineAndMarkerStyle) {
|
|
|
let markers = new Array();
|
|
|
let lines = []
|
|
|
|
|
|
- if (hasLine(lineProps.dep)) {
|
|
|
- coordinates.push(drawLineConfig(lineProps.dep.lat, lineProps.dep.lng));
|
|
|
- markers.push(addOvalPointConfig(lineProps.dep.lat, lineProps.dep.lng, lineAndMarkerStyle.imageName ? lineAndMarkerStyle.imageName : 'BA_oval'));
|
|
|
+ let startPointFix;
|
|
|
+ if (lineProps.start_point)
|
|
|
+ startPointFix = 'start_point';
|
|
|
+ else
|
|
|
+ startPointFix = 'dep';
|
|
|
+ if (hasLine(lineProps[startPointFix])) {
|
|
|
+ coordinates.push(startPointFix == 'dep' ? drawLineConfig(lineProps[startPointFix].lat, lineProps[startPointFix].lng) : { latitude: lineProps[startPointFix].lat, longitude: lineProps[startPointFix].lng });
|
|
|
+ markers.push(startPointFix == 'dep' ? addOvalPointConfig(lineProps[startPointFix].lat, lineProps[startPointFix].lng, lineAndMarkerStyle.imageName ? lineAndMarkerStyle.imageName : 'BA_oval') : { coordinate: { latitude: lineProps[startPointFix].lat, longitude: lineProps[startPointFix].lng }, imageName: lineAndMarkerStyle.imageName ? lineAndMarkerStyle.imageName : 'BA_oval' });
|
|
|
}
|
|
|
|
|
|
- if (Array.isArray(lineProps.passPoints)) {
|
|
|
- for (let i = 0; i < lineProps.passPoints.length; i++) {
|
|
|
- let obj = lineProps.passPoints[i]
|
|
|
+ let passingPointsFix;
|
|
|
+ if (lineProps.passing_points)
|
|
|
+ passingPointsFix = 'passing_points';
|
|
|
+ else
|
|
|
+ passingPointsFix = 'passPoints';
|
|
|
+
|
|
|
+ let endPointFix;
|
|
|
+ if (lineProps.end_point)
|
|
|
+ endPointFix = 'end_point';
|
|
|
+ else
|
|
|
+ endPointFix = 'arrive'
|
|
|
+
|
|
|
+ if (Array.isArray(lineProps[passingPointsFix])) {
|
|
|
+ for (let i = 0; i < lineProps[passingPointsFix].length; i++) {
|
|
|
+ let obj = lineProps[passingPointsFix][i]
|
|
|
if (isObject(obj)) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if (obj.pointType == Global.pointTypes.point
|
|
|
- || obj.pointType == Global.pointTypes.nav) {
|
|
|
- coordinates.push(drawLineConfig(obj.lat, obj.lng));
|
|
|
- markers.push(addOvalPointConfig(obj.lat, obj.lng, lineAndMarkerStyle.imageName ? lineAndMarkerStyle.imageName : 'BA_oval'));
|
|
|
+ let pointTypeFix;
|
|
|
+ if (obj.point_type)
|
|
|
+ pointTypeFix = 'point_type';
|
|
|
+ else
|
|
|
+ pointTypeFix = 'pointType'
|
|
|
+
|
|
|
+ if (obj[pointTypeFix] == Global.pointTypes.point
|
|
|
+ || obj[pointTypeFix] == Global.pointTypes.nav) {
|
|
|
+ coordinates.push(pointTypeFix == 'pointType' ? drawLineConfig(obj.lat, obj.lng) : { latitude: obj.lat, longitude: obj.lng });
|
|
|
+ markers.push(pointTypeFix == 'pointType' ? addOvalPointConfig(obj.lat, obj.lng, lineAndMarkerStyle.imageName ? lineAndMarkerStyle.imageName : 'BA_oval') : { coordinate: { latitude: obj.lat, longitude: obj.lng }, imageName: lineAndMarkerStyle.imageName ? lineAndMarkerStyle.imageName : 'BA_oval' });
|
|
|
} else {
|
|
|
// 遇到一个航线,不需要和前前面的点连起来
|
|
|
if (coordinates.length > 1) {
|
|
|
@@ -152,17 +175,17 @@ function getLinesRouter(lineProps, lineAndMarkerStyle) {
|
|
|
|
|
|
coordinates = []
|
|
|
|
|
|
- const pointBefore = i == 0 ? lineProps.dep : lineProps.passPoints[i - 1]
|
|
|
- const pointAfter = i == lineProps.passPoints.length - 1 ? lineProps.arrive : lineProps.passPoints[i + 1]
|
|
|
+ const pointBefore = i == 0 ? lineProps[startPointFix] : lineProps[passingPointsFix][i - 1]
|
|
|
+ const pointAfter = i == lineProps[passingPointsFix].length - 1 ? lineProps[endPointFix] : lineProps[passingPointsFix][i + 1]
|
|
|
|
|
|
lines.push(getAirwayLine(obj, pointBefore, pointAfter, lineAndMarkerStyle))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (hasLine(lineProps.arrive)) {
|
|
|
- coordinates.push(drawLineConfig(lineProps.arrive.lat, lineProps.arrive.lng));
|
|
|
- markers.push(addOvalPointConfig(lineProps.arrive.lat, lineProps.arrive.lng, lineAndMarkerStyle.imageName ? lineAndMarkerStyle.imageName : 'BA_oval'));
|
|
|
+ if (hasLine(lineProps[endPointFix])) {
|
|
|
+ coordinates.push(endPointFix == 'arrive' ? drawLineConfig(lineProps[endPointFix].lat, lineProps[endPointFix].lng) : { latitude: lineProps[endPointFix].lat, longitude: lineProps[endPointFix].lng });
|
|
|
+ markers.push(endPointFix == 'arrive' ? addOvalPointConfig(lineProps[endPointFix].lat, lineProps[endPointFix].lng, lineAndMarkerStyle.imageName ? lineAndMarkerStyle.imageName : 'BA_oval') : { coordinate: { latitude: lineProps[endPointFix].lat, longitude: lineProps[endPointFix].lng }, imageName: lineAndMarkerStyle.imageName ? lineAndMarkerStyle.imageName : 'BA_oval' });
|
|
|
}
|
|
|
|
|
|
if (coordinates.length > 1) {
|
|
|
@@ -215,13 +238,19 @@ function getPolygon(polygonProps, polygonAndMarkerStyle) {
|
|
|
let coordinates = new Array();
|
|
|
let markers = new Array();
|
|
|
|
|
|
- if (Array.isArray(polygonProps.polygonPoints)) {
|
|
|
- for (let obj of polygonProps.polygonPoints) {
|
|
|
+ let pointsFix;
|
|
|
+ if (polygonProps.points)
|
|
|
+ pointsFix = 'points';
|
|
|
+ else
|
|
|
+ pointsFix = 'polygonPoints';
|
|
|
+
|
|
|
+ if (Array.isArray(polygonProps[pointsFix])) {
|
|
|
+ for (let obj of polygonProps[pointsFix]) {
|
|
|
if (!hasPoint(obj)) {
|
|
|
continue;
|
|
|
}
|
|
|
- coordinates.push(drawLineConfig(obj.lat, obj.lng));
|
|
|
- markers.push(addOvalPointConfig(obj.lat, obj.lng, polygonAndMarkerStyle.imageName ? polygonAndMarkerStyle.imageName : 'BA_oval'));
|
|
|
+ coordinates.push(pointsFix == 'polygonPoints' ? drawLineConfig(obj.lat, obj.lng) : { latitude: obj.lat, longitude: obj.lng });
|
|
|
+ markers.push(pointsFix == 'polygonPoints' ? addOvalPointConfig(obj.lat, obj.lng, polygonAndMarkerStyle.imageName ? polygonAndMarkerStyle.imageName : 'BA_oval') : { coordinate: { latitude: obj.lat, longitude: obj.lng }, imageName: polygonAndMarkerStyle.imageName ? polygonAndMarkerStyle.imageName : 'BA_oval' });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -342,7 +371,10 @@ function getPolygonSelector(polygonAndMarkers) {
|
|
|
}
|
|
|
|
|
|
let setStyle = (style) => {
|
|
|
- return (shapeName) => style[shapeName]
|
|
|
+ if (!style)
|
|
|
+ return (shapeName) => { return {} }
|
|
|
+ else
|
|
|
+ return (shapeName) => style[shapeName]
|
|
|
}
|
|
|
|
|
|
//获取selector
|