* @function Util.toSuperMapGeometry * @description 将 GeoJSON 对象 或 OpenaLayers 几何对象要素对象转为 SuperMap 几何对象。 * @param {GeoJSONObject|ModuleGeometry} obj - GeoJSON 对象 或 OpenaLayers 几何对象要素对象。 * @private
(obj)
| 73 | * @private |
| 74 | */ |
| 75 | toSuperMapGeometry(obj) { |
| 76 | if (!obj) { |
| 77 | return null; |
| 78 | } |
| 79 | let result = obj; |
| 80 | if (obj instanceof Geometry) { |
| 81 | result = new GeoJSON().writeGeometryObject(obj); |
| 82 | } |
| 83 | if (obj instanceof Feature) { |
| 84 | result = new GeoJSON().writeFeatureObject(obj); |
| 85 | } |
| 86 | if (GeoJSONFormat.isGeoJSON(result)) { |
| 87 | const newFeatures = new GeoJSONFormat().read(result, 'FeatureCollection'); |
| 88 | return newFeatures && newFeatures[0].geometry; |
| 89 | } |
| 90 | return null; |
| 91 | }, |
| 92 | |
| 93 | /** |
| 94 | * @function Util.resolutionToScale |