/// <summary> /// 解析字符串 /// </summary> /// <param name="str"></param> /// <returns></returns> static public ObservationCode Parse(string str) { ObservationType type = ObservationTypeHelper.RinexCodeToObservationType(str); //(ObservationType)Enum.Parse(typeof(ObservationType), str.Substring(0, 1), true); int band = int.Parse(str.Trim().Substring(1, 1)); string attribute = null; //三个则直接提取 if (str.Length > 2) { attribute = str.Substring(2, 1); } else if (type == ObservationType.C)//否则转换P1,P2为C1X,C2W { var fisrtChar = str.Trim().Substring(0, 1); if (fisrtChar == "P") { attribute = "W"; } else { attribute = "C"; } } return(new ObservationCode(type, band, attribute)); }
/// <summary> /// V2 转换为 V3 格式,列表。 /// </summary> /// <param name="codeV2"></param> /// <returns></returns> public static List <string> GetCodesV3(string codeV2) { if (codeV2.Length <= 1) { throw new Exception("RINEX 代码长度小于 2 !"); } if (codeV2.Length == 3) { return(new List <string>() { codeV2 }); } var type = ObservationTypeHelper.RinexCodeToObservationType(codeV2); int num = Gdp.Utils.StringUtil.GetNumber(codeV2); var twoCode = type + "" + num.ToString().Substring(0, 1); return(new List <string>() { twoCode + "C", twoCode + "W", twoCode + "X", twoCode + "P", }); }