haoxinlei 7 سال پیش
والد
کامیت
4f4252dbeb
1فایلهای تغییر یافته به همراه12 افزوده شده و 21 حذف شده
  1. 12 21
      index.js

+ 12 - 21
index.js

@@ -2,12 +2,7 @@ import { createSelector } from 'reselect';
 import Global from './Common';
 import {
     latLngDegreesToDecimal,
-    isObject,
-    isUndefined,
-    isString,
-    isSafeString,
-    hasLine,
-    hasPoint
+    isObject
 } from './Utils'
 let LatLon = require('geodesy').LatLonSpherical;
 
@@ -129,7 +124,7 @@ function getLinesRouter(lineProps, lineAndMarkerStyle) {
         startPointFix = 'start_point';
     else
         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 });
         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 });
         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])) {
         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 });
             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) => {
     if (!style)
-        return (shapeName) => { return {key:0} }
+        return (shapeName) => { return { key: 0 } }
     else
         return (shapeName) => style[shapeName]
 }