MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / toSuperMapGeometry

Function toSuperMapGeometry

src/openlayers/core/Util.js:75–91  ·  view source on GitHub ↗

* @function Util.toSuperMapGeometry * @description 将 GeoJSON 对象 或 OpenaLayers 几何对象要素对象转为 SuperMap 几何对象。 * @param {GeoJSONObject|ModuleGeometry} obj - GeoJSON 对象 或 OpenaLayers 几何对象要素对象。 * @private

(obj)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

isGeoJSONMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected