/// <summary> /// JSON字符串转成IGeometry /// </summary> public static IGeometry ConvertToGeometry(string strJson, esriGeometryType type, bool bHasZ, bool bHasM) { IJSONReader jsonReader = new JSONReaderClass(); jsonReader.ReadFromString(strJson); JSONConverterGeometryClass jsonCon = new JSONConverterGeometryClass(); return(jsonCon.ReadGeometry(jsonReader, type, bHasZ, bHasM)); }
/// <summary> /// 将json字符串转为Geometry对象 /// </summary> /// <param name="json"></param> /// <returns></returns> public static IGeometry Parse(string json, bool bHasZ = false, bool bHasM = false) { IGeometry result; if (string.IsNullOrWhiteSpace(json)) { return(null); } else { esriGeometryType type = GetGeometryType(json); IJSONReader jsonReader = new JSONReaderClass(); jsonReader.ReadFromString(json); JSONConverterGeometryClass jsonCon = new JSONConverterGeometryClass(); result = jsonCon.ReadGeometry(jsonReader, (esriGeometryType)type, bHasZ, bHasM); ITopologicalOperator topo = result as ITopologicalOperator; topo.Simplify(); } return(result); }