using EWS.Models; using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Txgy.Microseismic.BaseLib { public class WaveHeader { /// /// HA /// public string Flag { get; set; } /// /// 台站名称 /// public string StationName { get; set; } /// /// 通道 /// public string Channel { get; set; } /// /// 点数 /// public int Samples { get; set; } /// /// 采样率 /// public int Sps { get; set; } /// /// 文件开始时间 /// public DateTime StartTime { get; set; } /// /// 最大值 /// public int MaxValue { get; set; } /// /// 最大值位置 /// public int MaxValueIndex { get; set; } /// /// 最大振幅 /// public double MaxAmp { get; set; } /// /// 到事件的距离 /// public double ToEventDist { get; set; } /// /// 相对于事件的角度 /// public int ToEventAngle { get; set; } public WaveHeader() { } public WaveHeader(string header) { string[] heads=header.Split(','); Flag= heads[0].Substring(11,2); StationName= heads[0].Substring(14,3); Channel= heads[0].Substring(23,1); string[] tmp = heads[1].Trim().Split(' '); Samples = int.Parse(tmp[0]); tmp = heads[2].Trim().Split(' '); Sps = int.Parse(tmp[0]); StartTime = DateTime.Parse(heads[3]).AddHours(8); } public static double CalAmp(int Value,int sens) { return Value / (PublicConfig.KW / (Math.Pow(2, sens))); } public static double CalDist(MmEvent mm,string stationName) { var sdr = PublicConfig.ProjectConfig.StationDic.Where(sd => sd.Key == stationName); if (sdr.Count() == 0) return 0; StationModel sm = sdr.First().Value; double dist = Math.Sqrt(Math.Pow(sm.E - mm.X, 2) + Math.Pow(sm.N - mm.Y, 2)); return dist; } public static double PointsAngleTool(PointF p1, PointF p2) { double angleOfLine = Math.Atan2((p2.Y - p1.Y), (p2.X - p1.X)) * 180 / Math.PI;//计算两点的正切值并获取角度 return angleOfLine; } } }