|
1326 | 1326 | /* 6 */ |
1327 | 1327 | /***/ (function(module, exports, __webpack_require__) { |
1328 | 1328 |
|
| 1329 | + /* COPYRIGHT 2017 SUPERMAP |
| 1330 | + * 本程序只能在有效的授权许可下使用。 |
| 1331 | + * 未经许可,不得以任何手段擅自使用或传播。*/ |
| 1332 | + |
| 1333 | + |
1329 | 1334 | /** |
1330 | 1335 | * Class: SuperMap.Format.GeoJSON |
1331 | 1336 | * GeoJSON 的读和写。使用 <SuperMap.Format.GeoJSON> 构造器创建一个GeoJSON解析器. |
1332 | 1337 | * |
1333 | 1338 | * Inherits from: |
1334 | 1339 | * - <SuperMap.Format.JSON> |
1335 | 1340 | */ |
1336 | | - |
1337 | 1341 | __webpack_require__(7); |
1338 | 1342 |
|
1339 | 1343 | SuperMap.Format.GeoJSON = SuperMap.Class(SuperMap.Format.JSON, { |
|
2074 | 2078 | return null; |
2075 | 2079 | } |
2076 | 2080 | if (len === 1) { |
2077 | | - return {type: "Point", x: geoPoints[0].x, y: geoPoints[0].y}; |
| 2081 | + return {type: "Point", x: parseFloat(geoPoints[0].x), y: parseFloat(geoPoints[0].y)}; |
2078 | 2082 | } else { |
2079 | 2083 | for (var i = 0, pointList = []; i < len; i++) { |
2080 | | - pointList.push({x: geoPoints[i].x, y: geoPoints[i].y}); |
| 2084 | + pointList.push({x: parseFloat(geoPoints[i].x), y: parseFloat(geoPoints[i].y)}); |
2081 | 2085 | } |
2082 | 2086 | return {type: "MultiPoint", components: pointList}; |
2083 | 2087 | } |
|
2098 | 2102 | } |
2099 | 2103 | if (len === 1) { |
2100 | 2104 | for (var i = 0, pointList = []; i < geoParts[0]; i++) { |
2101 | | - pointList.push({x: geoPoints[i].x, y: geoPoints[i].y}); |
| 2105 | + pointList.push({x: parseFloat(geoPoints[i].x), y: parseFloat(geoPoints[i].y)}); |
2102 | 2106 | } |
2103 | 2107 | //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString |
2104 | 2108 | if (me.isPointsEquals(pointList[0], pointList[geoParts[0] - 1])) { |
|
2109 | 2113 | } else { |
2110 | 2114 | for (var i = 0, lineList = []; i < len; i++) { |
2111 | 2115 | for (var j = 0, pointList = []; j < geoParts[i]; j++) { |
2112 | | - pointList.push({x: geoPoints[j].x, y: geoPoints[j].y}); |
| 2116 | + pointList.push({x: parseFloat(geoPoints[j].x), y: parseFloat(geoPoints[j].y)}); |
2113 | 2117 | } |
2114 | 2118 | lineList.push(pointList); |
2115 | 2119 | geoPoints.splice(0, geoParts[i]); |
|
2135 | 2139 | } |
2136 | 2140 | for (var i = 0, pointIndex = 0, pointList = []; i < len; i++) { |
2137 | 2141 | for (var j = 0; j < geoParts[i]; j++) { |
2138 | | - pointList.push({x: geoPoints[pointIndex + j].x, y: geoPoints[pointIndex + j].y}); |
| 2142 | + pointList.push({ |
| 2143 | + x: parseFloat(geoPoints[pointIndex + j].x), |
| 2144 | + y: parseFloat(geoPoints[pointIndex + j].y) |
| 2145 | + }); |
2139 | 2146 | } |
2140 | 2147 | pointIndex += geoParts[i]; |
2141 | 2148 | //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString |
|
2164 | 2171 | var polygonArray = new Array(); |
2165 | 2172 | for (var i = 0, pointIndex = 0, pointList = []; i < len; i++) { |
2166 | 2173 | for (var j = 0; j < geoParts[i]; j++) { |
2167 | | - pointList.push({x: geoPoints[pointIndex + j].x, y: geoPoints[pointIndex + j].y}); |
| 2174 | + pointList.push({ |
| 2175 | + x: parseFloat(geoPoints[pointIndex + j].x), |
| 2176 | + y: parseFloat(geoPoints[pointIndex + j].y) |
| 2177 | + }); |
2168 | 2178 | } |
2169 | 2179 |
|
2170 | 2180 | pointIndex += geoParts[i]; |
|
0 commit comments