|
@@ -2,12 +2,7 @@ import { createSelector } from 'reselect';
|
|
|
import Global from './Common';
|
|
import Global from './Common';
|
|
|
import {
|
|
import {
|
|
|
latLngDegreesToDecimal,
|
|
latLngDegreesToDecimal,
|
|
|
- isObject,
|
|
|
|
|
- isUndefined,
|
|
|
|
|
- isString,
|
|
|
|
|
- isSafeString,
|
|
|
|
|
- hasLine,
|
|
|
|
|
- hasPoint
|
|
|
|
|
|
|
+ isObject
|
|
|
} from './Utils'
|
|
} from './Utils'
|
|
|
let LatLon = require('geodesy').LatLonSpherical;
|
|
let LatLon = require('geodesy').LatLonSpherical;
|
|
|
|
|
|
|
@@ -129,7 +124,7 @@ function getLinesRouter(lineProps, lineAndMarkerStyle) {
|
|
|
startPointFix = 'start_point';
|
|
startPointFix = 'start_point';
|
|
|
else
|
|
else
|
|
|
startPointFix = 'dep';
|
|
startPointFix = 'dep';
|
|
|
- if (hasLine(lineProps[startPointFix])) {
|
|
|
|
|
|
|
+ if (lineProps[startPointFix]) {
|
|
|
coordinates.push(startPointFix == 'dep' ? drawLineConfig(lineProps[startPointFix].lat, lineProps[startPointFix].lng) : { latitude: lineProps[startPointFix].lat, longitude: lineProps[startPointFix].lng });
|
|
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' });
|
|
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' });
|
|
|
}
|
|
}
|
|
@@ -183,7 +178,7 @@ function getLinesRouter(lineProps, lineAndMarkerStyle) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (hasLine(lineProps[endPointFix])) {
|
|
|
|
|
|
|
+ if (lineProps[endPointFix]) {
|
|
|
coordinates.push(endPointFix == 'arrive' ? drawLineConfig(lineProps[endPointFix].lat, lineProps[endPointFix].lng) : { latitude: lineProps[endPointFix].lat, longitude: lineProps[endPointFix].lng });
|
|
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' });
|
|
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' });
|
|
|
}
|
|
}
|
|
@@ -246,24 +241,20 @@ function getPolygon(polygonProps, polygonAndMarkerStyle) {
|
|
|
|
|
|
|
|
if (Array.isArray(polygonProps[pointsFix])) {
|
|
if (Array.isArray(polygonProps[pointsFix])) {
|
|
|
for (let obj of polygonProps[pointsFix]) {
|
|
for (let obj of polygonProps[pointsFix]) {
|
|
|
- if (!hasPoint(obj)) {
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
coordinates.push(pointsFix == 'polygonPoints' ? drawLineConfig(obj.lat, obj.lng) : { latitude: obj.lat, longitude: obj.lng });
|
|
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' });
|
|
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' });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (coordinates.length > 0) {
|
|
|
|
|
- let polygon = {
|
|
|
|
|
- lineWidth: polygonAndMarkerStyle.lineWidth ? polygonAndMarkerStyle.lineWidth : Global.amapLineWidth,
|
|
|
|
|
- strokeColor: polygonAndMarkerStyle.strokeColor ? polygonAndMarkerStyle.strokeColor : Global.amapStrokeColor,
|
|
|
|
|
- fillColor: polygonAndMarkerStyle.fillColor ? polygonAndMarkerStyle.fillColor : Global.amapFillColor,
|
|
|
|
|
- coordinates: coordinates
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ let polygon = {
|
|
|
|
|
+ lineWidth: polygonAndMarkerStyle.lineWidth ? polygonAndMarkerStyle.lineWidth : Global.amapLineWidth,
|
|
|
|
|
+ strokeColor: polygonAndMarkerStyle.strokeColor ? polygonAndMarkerStyle.strokeColor : Global.amapStrokeColor,
|
|
|
|
|
+ fillColor: polygonAndMarkerStyle.fillColor ? polygonAndMarkerStyle.fillColor : Global.amapFillColor,
|
|
|
|
|
+ coordinates: coordinates
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ return { markers, polygon };
|
|
|
|
|
|
|
|
- return { markers, polygon };
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -372,7 +363,7 @@ function getPolygonSelector(polygonAndMarkers) {
|
|
|
|
|
|
|
|
let setStyle = (style) => {
|
|
let setStyle = (style) => {
|
|
|
if (!style)
|
|
if (!style)
|
|
|
- return (shapeName) => { return {key:0} }
|
|
|
|
|
|
|
+ return (shapeName) => { return { key: 0 } }
|
|
|
else
|
|
else
|
|
|
return (shapeName) => style[shapeName]
|
|
return (shapeName) => style[shapeName]
|
|
|
}
|
|
}
|