/// <summary> /// 通过文件构建,按照文件坐标计算,按照其采样率输出。 /// </summary> /// <param name="obsFile"></param> /// <param name="EphemerisService"></param> /// <param name="tableName"></param> /// <param name="AngleCut"></param> /// <returns></returns> public static ObjectTableStorage BuildTable(RinexObsFile obsFile, double AngleCut = 12, IEphemerisService EphemerisService = null, string tableName = null) { if (String.IsNullOrWhiteSpace(tableName)) { tableName = obsFile.Header.MarkerName + "-卫星高度角"; } if (EphemerisService == null) { EphemerisService = GlobalNavEphemerisService.Instance; } var siteXyz = obsFile.Header.ApproxXyz; var ephObj = EphemerisService.Get(SatelliteNumber.G01, obsFile.Header.StartTime); if (ephObj == null) { EphemerisService = GlobalIgsEphemerisService.Instance; } var table = new ObjectTableStorage(tableName); foreach (var sec in obsFile) { var time = sec.ReceiverTime; AddRow(AngleCut, EphemerisService, siteXyz, table, time); } return(table); }
/// <summary> /// 获取卫星在指定时刻,相对于测站的信息 /// </summary> /// <param name="service"></param> /// <param name="prn"></param> /// <param name="time"></param> /// <returns></returns> public StationSatInfo GetInstantSatInfo(IEphemerisService service, SatelliteNumber prn, Time time) { Geo.Coordinates.XYZ satPos = service.Get(prn, time).XYZ; GeoCoord coord = CoordTransformer.XyzToGeoCoord(satPos); Geo.Coordinates.Polar p = CoordTransformer.XyzToGeoPolar(satPos, StationPos); if (p.Elevation < EleAngle) { return(null); } this.LonLats.Add(new Vector(coord.Lon, coord.Lat) { Tag = prn.ToString() }); //显示到表格 return(new StationSatInfo() { PRN = prn, Time = time, Azimuth = p.Azimuth, ElevatAngle = p.Elevation, Distance = p.Range, Lat = coord.Lat, Lon = coord.Lon, Height = coord.Height, X = satPos.X, Y = satPos.Y, Z = satPos.Z }); }
/// <summary> /// 生成一个表格 /// </summary> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <param name="interval"></param> /// <param name="siteXyz"></param> /// <param name="SatelliteTypes"></param> /// <param name="AngleCut"></param> /// <param name="EphemerisService"></param> /// <param name="tableName"></param> /// <returns></returns> public static ObjectTableStorage BuildTable( Time startTime, Time endTime, double interval, XYZ siteXyz, List <SatelliteType> SatelliteTypes, double AngleCut = 10, IEphemerisService EphemerisService = null, string tableName = "卫星高度角") { var table = new ObjectTableStorage(tableName); if (siteXyz == null) { return(null); } for (Time time = startTime; time <= endTime; time += interval) { table.NewRow(); table.AddItem("Epoch", time); foreach (var sat in EphemerisService.Prns) { if (!SatelliteTypes.Contains(sat.SatelliteType)) { continue; } var eph = EphemerisService.Get(sat, time); if (eph == null) { continue; } var p = CoordTransformer.XyzToGeoPolar(eph.XYZ, siteXyz); var ele = p.Elevation; if (ele >= AngleCut) { table.AddItem(sat, ele); } } table.EndRow(); } return(table); }
private static void AddRow(double AngleCut, IEphemerisService EphemerisService, XYZ siteXyz, ObjectTableStorage table, Time time) { table.NewRow(); table.AddItem("Epoch", time); foreach (var sat in EphemerisService.Prns) { var eph = EphemerisService.Get(sat, time); if (eph == null) { continue; } var p = CoordTransformer.XyzToGeoPolar(eph.XYZ, siteXyz); var ele = p.Elevation; if (ele >= AngleCut) { table.AddItem(sat, ele); } } table.EndRow(); }
/// <summary> /// 通过文件构建,按照文件坐标计算,按照其采样率输出。 /// </summary> /// <param name="oFilePath"></param> /// <param name="EphemerisService"></param> /// <param name="tableName"></param> /// <param name="AngleCut"></param> /// <returns></returns> public static ObjectTableStorage BuildTable(string oFilePath, double AngleCut = 12, IEphemerisService EphemerisService = null, string tableName = null) { if (String.IsNullOrWhiteSpace(tableName)) { tableName = Path.GetFileName(oFilePath) + "-卫星高度角"; } RinexObsFileReader reader = new RinexObsFileReader(oFilePath); var header = reader.GetHeader(); var siteXyz = header.ApproxXyz; if (EphemerisService == null) { if (File.Exists(header.NavFilePath))//优先考虑自带导航文件 { EphemerisService = EphemerisDataSourceFactory.Create(header.NavFilePath); } else { EphemerisService = GlobalNavEphemerisService.Instance; } } var ephObj = EphemerisService.Get(SatelliteNumber.G01, reader.GetHeader().StartTime); if (ephObj == null) { EphemerisService = GlobalIgsEphemerisService.Instance; } var table = new ObjectTableStorage(tableName); while (reader.MoveNext()) { var time = reader.Current.ReceiverTime; AddRow(AngleCut, EphemerisService, siteXyz, table, time); } return(table); }