|
|
|
@ -80,7 +80,18 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
public int CompletedCount { get; set; }
|
|
|
|
public int CompletedCount { get; set; }
|
|
|
|
public int TotalCount { get; set; }
|
|
|
|
public int TotalCount { get; set; }
|
|
|
|
public string Message { get; set; }
|
|
|
|
public string Message { get; set; }
|
|
|
|
}
|
|
|
|
public double? Percent { get; set; }
|
|
|
|
|
|
|
|
public bool IsIndeterminate { get; set; }
|
|
|
|
|
|
|
|
public bool ShowCount { get; set; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private const double SearchProgressQueryComplete = 5;
|
|
|
|
|
|
|
|
private const double SearchProgressComputeComplete = 80;
|
|
|
|
|
|
|
|
private const double SearchProgressListComplete = 84;
|
|
|
|
|
|
|
|
private const double SearchProgressEnergyComplete = 87;
|
|
|
|
|
|
|
|
private const double SearchProgressDayFreqComplete = 90;
|
|
|
|
|
|
|
|
private const double SearchProgressPlanComplete = 95;
|
|
|
|
|
|
|
|
private const double SearchProgressComplete = 100;
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 查询模式:0:自定义查询;1:日报;2:周报;3:月报
|
|
|
|
/// 查询模式:0:自定义查询;1:日报;2:周报;3:月报
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
@ -444,7 +455,7 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
ResetSearchProgress("正在查询事件数据...");
|
|
|
|
ResetSearchProgress("正在查询事件数据...");
|
|
|
|
var progress = new Progress<SearchProgressInfo>(UpdateSearchProgress);
|
|
|
|
var progress = new Progress<SearchProgressInfo>(UpdateSearchProgress);
|
|
|
|
var results = await SearchEventsAsync(st, et, progress);
|
|
|
|
var results = await SearchEventsAsync(st, et, progress);
|
|
|
|
ApplySearchResults(rView, results, st, createDayFreq);
|
|
|
|
await ApplySearchResultsAsync(rView, results, st, createDayFreq, progress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -456,33 +467,78 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void ApplySearchResults(ReportView rView, List<GridItemEventResult> results, DateTime st, bool createDayFreq)
|
|
|
|
private async Task ApplySearchResultsAsync(ReportView rView, List<GridItemEventResult> results, DateTime st, bool createDayFreq, IProgress<SearchProgressInfo> progress)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (results == null)
|
|
|
|
if (results == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SelectResult = new ObservableCollection<GridItemEventResult>(results);
|
|
|
|
await RefreshResultListAsync(results, progress);
|
|
|
|
SearchCount = results.Count;
|
|
|
|
progress.Report(CreateStageProgress("正在统计能量", SearchProgressListComplete));
|
|
|
|
|
|
|
|
await YieldToUiAsync();
|
|
|
|
UpdateEnergyStats(results);
|
|
|
|
UpdateEnergyStats(results);
|
|
|
|
|
|
|
|
|
|
|
|
if (createDayFreq)
|
|
|
|
if (createDayFreq)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
progress.Report(CreateStageProgress("正在生成频度图", SearchProgressEnergyComplete));
|
|
|
|
|
|
|
|
await YieldToUiAsync();
|
|
|
|
FreqChart = CreateDayFreqImage(results, st, st.ToString("D", culture));
|
|
|
|
FreqChart = CreateDayFreqImage(results, st, st.ToString("D", culture));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
progress.Report(CreateStageProgress("正在筛选中等能量事件", SearchProgressDayFreqComplete));
|
|
|
|
|
|
|
|
await YieldToUiAsync();
|
|
|
|
|
|
|
|
|
|
|
|
var mes = results.Where(rs => rs.Energy >= MiddleEnergy).ToList();
|
|
|
|
var mes = results.Where(rs => rs.Energy >= MiddleEnergy).ToList();
|
|
|
|
MiddleEnergyEvents = mes;
|
|
|
|
MiddleEnergyEvents = mes;
|
|
|
|
MiddleEventCount = mes.Count();
|
|
|
|
MiddleEventCount = mes.Count();
|
|
|
|
if (mes.Count > 0 && rView != null)
|
|
|
|
if (mes.Count > 0 && rView != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
progress.Report(CreateStageProgress("正在绘制平面图", SearchProgressDayFreqComplete));
|
|
|
|
|
|
|
|
await YieldToUiAsync();
|
|
|
|
ReportPlanImage rpi = new ReportPlanImage();
|
|
|
|
ReportPlanImage rpi = new ReportPlanImage();
|
|
|
|
rpi.Draw(mes, rView.canvasPlan.ActualWidth, rView.canvasPlan.ActualHeight);
|
|
|
|
rpi.Draw(mes, rView.canvasPlan.ActualWidth, rView.canvasPlan.ActualHeight);
|
|
|
|
rView.canvasPlan.Children.Clear();
|
|
|
|
rView.canvasPlan.Children.Clear();
|
|
|
|
rView.canvasPlan.Children.Add(rpi.host);
|
|
|
|
rView.canvasPlan.Children.Add(rpi.host);
|
|
|
|
|
|
|
|
progress.Report(CreateStageProgress("正在生成三维图", SearchProgressPlanComplete));
|
|
|
|
|
|
|
|
await YieldToUiAsync();
|
|
|
|
CreateStereoChart(mes);
|
|
|
|
CreateStereoChart(mes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
progress.Report(CreateStageProgress("查询完成", SearchProgressComplete));
|
|
|
|
|
|
|
|
await YieldToUiAsync();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task RefreshResultListAsync(List<GridItemEventResult> results, IProgress<SearchProgressInfo> progress)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SelectResult = new ObservableCollection<GridItemEventResult>();
|
|
|
|
|
|
|
|
SearchCount = results.Count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (results.Count == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
progress.Report(CreateStageProgress("正在刷新事件列表", SearchProgressListComplete));
|
|
|
|
|
|
|
|
await YieldToUiAsync();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int batchSize = 50;
|
|
|
|
|
|
|
|
for (int i = 0; i < results.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SelectResult.Add(results[i]);
|
|
|
|
|
|
|
|
if ((i + 1) % batchSize == 0 || i == results.Count - 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
double percent = SearchProgressComputeComplete
|
|
|
|
|
|
|
|
+ ((i + 1) / (double)results.Count) * (SearchProgressListComplete - SearchProgressComputeComplete);
|
|
|
|
|
|
|
|
progress.Report(new SearchProgressInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CompletedCount = i + 1,
|
|
|
|
|
|
|
|
TotalCount = results.Count,
|
|
|
|
|
|
|
|
Message = "正在刷新事件列表",
|
|
|
|
|
|
|
|
Percent = percent,
|
|
|
|
|
|
|
|
IsIndeterminate = false,
|
|
|
|
|
|
|
|
ShowCount = true
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
await YieldToUiAsync();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void ResetSearchProgress(string message)
|
|
|
|
private void ResetSearchProgress(string message)
|
|
|
|
@ -500,9 +556,23 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (progress.Percent.HasValue)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
double explicitPercent = Math.Max(0, Math.Min(100, progress.Percent.Value));
|
|
|
|
|
|
|
|
SearchProgressIndeterminate = progress.IsIndeterminate;
|
|
|
|
|
|
|
|
SearchProgressValue = explicitPercent;
|
|
|
|
|
|
|
|
SearchProgressPercentText = progress.IsIndeterminate ? "" : explicitPercent.ToString("F0") + "%";
|
|
|
|
|
|
|
|
SearchProgressText = BuildSearchProgressText(progress);
|
|
|
|
|
|
|
|
if (progress.TotalCount > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SearchCount = progress.TotalCount;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (progress.TotalCount <= 0)
|
|
|
|
if (progress.TotalCount <= 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SearchProgressIndeterminate = progress.Message != "未查询到事件";
|
|
|
|
SearchProgressIndeterminate = progress.IsIndeterminate || progress.Message != "未查询到事件";
|
|
|
|
SearchProgressValue = 0;
|
|
|
|
SearchProgressValue = 0;
|
|
|
|
SearchProgressPercentText = progress.Message == "未查询到事件" ? "0%" : "";
|
|
|
|
SearchProgressPercentText = progress.Message == "未查询到事件" ? "0%" : "";
|
|
|
|
SearchProgressText = progress.Message;
|
|
|
|
SearchProgressText = progress.Message;
|
|
|
|
@ -518,7 +588,65 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
SearchProgressIndeterminate = false;
|
|
|
|
SearchProgressIndeterminate = false;
|
|
|
|
SearchProgressValue = percent;
|
|
|
|
SearchProgressValue = percent;
|
|
|
|
SearchProgressPercentText = percent.ToString("F0") + "%";
|
|
|
|
SearchProgressPercentText = percent.ToString("F0") + "%";
|
|
|
|
SearchProgressText = progress.Message + " " + progress.CompletedCount + "/" + progress.TotalCount;
|
|
|
|
SearchProgressText = BuildSearchProgressText(progress);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string BuildSearchProgressText(SearchProgressInfo progress)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (progress.ShowCount && progress.TotalCount > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return progress.Message + " " + progress.CompletedCount + "/" + progress.TotalCount;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return progress.Message;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SearchProgressInfo CreateStageProgress(string message, double percent, bool isIndeterminate = false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return new SearchProgressInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CompletedCount = 0,
|
|
|
|
|
|
|
|
TotalCount = 0,
|
|
|
|
|
|
|
|
Message = message,
|
|
|
|
|
|
|
|
Percent = percent,
|
|
|
|
|
|
|
|
IsIndeterminate = isIndeterminate,
|
|
|
|
|
|
|
|
ShowCount = false
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SearchProgressInfo CreateEventProgress(int completedCount, int totalCount, int stageIndex, int stageCount, string message)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (totalCount <= 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return CreateStageProgress(message, SearchProgressQueryComplete);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int safeStageIndex = Math.Max(0, Math.Min(stageIndex, stageCount));
|
|
|
|
|
|
|
|
double eventProgress = (completedCount + safeStageIndex / (double)stageCount) / totalCount;
|
|
|
|
|
|
|
|
double percent = SearchProgressQueryComplete + eventProgress * (SearchProgressComputeComplete - SearchProgressQueryComplete);
|
|
|
|
|
|
|
|
int displayCount = Math.Min(completedCount + 1, totalCount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new SearchProgressInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CompletedCount = displayCount,
|
|
|
|
|
|
|
|
TotalCount = totalCount,
|
|
|
|
|
|
|
|
Message = message,
|
|
|
|
|
|
|
|
Percent = percent,
|
|
|
|
|
|
|
|
IsIndeterminate = false,
|
|
|
|
|
|
|
|
ShowCount = true
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void ReportSearchProgress(IProgress<SearchProgressInfo> progress, SearchProgressInfo progressInfo)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (progress != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
progress.Report(progressInfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static async Task YieldToUiAsync()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await Task.Delay(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
@ -707,7 +835,7 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private Task<List<GridItemEventResult>> SearchEventsAsync(DateTime searchStartTime, DateTime searchEndTime, IProgress<SearchProgressInfo> progress)
|
|
|
|
private Task<List<GridItemEventResult>> SearchEventsAsync(DateTime searchStartTime, DateTime searchEndTime, IProgress<SearchProgressInfo> progress)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Task.Run(() => SearchEventsCore(searchStartTime, searchEndTime, progress));
|
|
|
|
return SearchEventsCoreAsync(searchStartTime, searchEndTime, progress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<GridItemEventResult> SearchEvents(DateTime searchStartTime, DateTime searchEndTime)
|
|
|
|
public List<GridItemEventResult> SearchEvents(DateTime searchStartTime, DateTime searchEndTime)
|
|
|
|
@ -719,6 +847,11 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<GridItemEventResult> SearchEventsCore(DateTime searchStartTime, DateTime searchEndTime, IProgress<SearchProgressInfo> progress)
|
|
|
|
private List<GridItemEventResult> SearchEventsCore(DateTime searchStartTime, DateTime searchEndTime, IProgress<SearchProgressInfo> progress)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return SearchEventsCoreAsync(searchStartTime, searchEndTime, progress).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<List<GridItemEventResult>> SearchEventsCoreAsync(DateTime searchStartTime, DateTime searchEndTime, IProgress<SearchProgressInfo> progress)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<GridItemEventResult> results = new List<GridItemEventResult>();
|
|
|
|
List<GridItemEventResult> results = new List<GridItemEventResult>();
|
|
|
|
string findStr = "select * from " + GlobalConfig.UseResultTable;
|
|
|
|
string findStr = "select * from " + GlobalConfig.UseResultTable;
|
|
|
|
@ -761,30 +894,21 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (progress != null)
|
|
|
|
if (progress != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
progress.Report(new SearchProgressInfo
|
|
|
|
progress.Report(CreateStageProgress("正在查询事件数据...", 0, true));
|
|
|
|
{
|
|
|
|
|
|
|
|
CompletedCount = 0,
|
|
|
|
|
|
|
|
TotalCount = 0,
|
|
|
|
|
|
|
|
Message = "正在查询事件数据..."
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var list = fsqlTencent.Select<RemoteRealtimeResultEntity>()
|
|
|
|
var list = await Task.Run(() => fsqlTencent.Select<RemoteRealtimeResultEntity>()
|
|
|
|
.WithSql(findStr).ToList();
|
|
|
|
.WithSql(findStr).ToList()).ConfigureAwait(false);
|
|
|
|
int totalCount = list == null ? 0 : list.Count;
|
|
|
|
int totalCount = list == null ? 0 : list.Count;
|
|
|
|
if (progress != null)
|
|
|
|
ReportSearchProgress(progress, totalCount == 0
|
|
|
|
{
|
|
|
|
? CreateStageProgress("未查询到事件", 0)
|
|
|
|
progress.Report(new SearchProgressInfo
|
|
|
|
: CreateEventProgress(0, totalCount, 0, 4, "正在准备事件"));
|
|
|
|
{
|
|
|
|
|
|
|
|
CompletedCount = 0,
|
|
|
|
|
|
|
|
TotalCount = totalCount,
|
|
|
|
|
|
|
|
Message = totalCount == 0 ? "未查询到事件" : "正在计算震源机制"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (list != null)
|
|
|
|
if (list != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int completedCount = 0;
|
|
|
|
int completedCount = 0;
|
|
|
|
|
|
|
|
const int eventStageCount = 4;
|
|
|
|
foreach (var item in list)
|
|
|
|
foreach (var item in list)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
ReportSearchProgress(progress, CreateEventProgress(completedCount, totalCount, 0, eventStageCount, "正在准备事件"));
|
|
|
|
GridItemEventResult se = new GridItemEventResult(item, true);
|
|
|
|
GridItemEventResult se = new GridItemEventResult(item, true);
|
|
|
|
string eventTimeStr = se.EventTime;
|
|
|
|
string eventTimeStr = se.EventTime;
|
|
|
|
string datePath = eventTimeStr.Substring(0, 4) + eventTimeStr.Substring(5, 2) + eventTimeStr.Substring(8, 2);
|
|
|
|
string datePath = eventTimeStr.Substring(0, 4) + eventTimeStr.Substring(5, 2) + eventTimeStr.Substring(8, 2);
|
|
|
|
@ -793,40 +917,50 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
+ eventTimeStr.Substring(8, 2) + eventTimeStr.Substring(10, 3)
|
|
|
|
+ eventTimeStr.Substring(8, 2) + eventTimeStr.Substring(10, 3)
|
|
|
|
+ eventTimeStr.Substring(14, 2) + eventTimeStr.Substring(17, 2) + ".01" + GlobalConfig.DataTypeString;
|
|
|
|
+ eventTimeStr.Substring(14, 2) + eventTimeStr.Substring(17, 2) + ".01" + GlobalConfig.DataTypeString;
|
|
|
|
string jsonStr = ".json";
|
|
|
|
string jsonStr = ".json";
|
|
|
|
|
|
|
|
string jsonFilePath = dataFilePath + dataFileName + jsonStr;
|
|
|
|
MmEvent curMmEvent = new MmEvent();
|
|
|
|
MmEvent curMmEvent = new MmEvent();
|
|
|
|
curMmEvent.EventTimeStr = eventTimeStr;
|
|
|
|
curMmEvent.EventTimeStr = eventTimeStr;
|
|
|
|
curMmEvent.X = se.X;
|
|
|
|
curMmEvent.X = se.X;
|
|
|
|
curMmEvent.Y = se.Y;
|
|
|
|
curMmEvent.Y = se.Y;
|
|
|
|
curMmEvent.RMS = se.RMS;
|
|
|
|
curMmEvent.RMS = se.RMS;
|
|
|
|
curMmEvent.DominantFreq = 15;
|
|
|
|
curMmEvent.DominantFreq = 15;
|
|
|
|
|
|
|
|
bool canComputeWaveform = false;
|
|
|
|
//查询事件Json文件是否已下载
|
|
|
|
//查询事件Json文件是否已下载
|
|
|
|
if (File.Exists(dataFilePath + dataFileName + jsonStr))
|
|
|
|
if (File.Exists(jsonFilePath))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FileInfo fileInfo = new FileInfo(dataFilePath + dataFileName + jsonStr);
|
|
|
|
FileInfo fileInfo = new FileInfo(jsonFilePath);
|
|
|
|
if (fileInfo.Length > 1024)
|
|
|
|
if (fileInfo.Length > 1024)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ComputeFM(curMmEvent);
|
|
|
|
canComputeWaveform = true;
|
|
|
|
//目前提取的为半周期
|
|
|
|
|
|
|
|
curMmEvent.DominantFreq = GlobalData.GetDominFreq(eventTimeStr);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#region 同步方式
|
|
|
|
#region 同步方式
|
|
|
|
int res = new DownloadJsonFile().Download(eventTimeStr, dataFilePath, dataFileName + jsonStr, GlobalConfig.UseWaveDataTable);
|
|
|
|
ReportSearchProgress(progress, CreateEventProgress(completedCount, totalCount, 1, eventStageCount, "正在下载波形JSON"));
|
|
|
|
|
|
|
|
int res = await DownloadJsonFile.DownloadAsync(eventTimeStr, dataFilePath, dataFileName + jsonStr, GlobalConfig.UseWaveDataTable).ConfigureAwait(false);
|
|
|
|
if (res > -1)
|
|
|
|
if (res > -1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FileInfo fileInfo2 = new FileInfo(dataFilePath + dataFileName + jsonStr);
|
|
|
|
FileInfo fileInfo2 = new FileInfo(jsonFilePath);
|
|
|
|
if (fileInfo2.Length > 2000)
|
|
|
|
if (fileInfo2.Length > 2000)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ComputeFM(curMmEvent);
|
|
|
|
canComputeWaveform = true;
|
|
|
|
//目前提取的为半周期
|
|
|
|
|
|
|
|
curMmEvent.DominantFreq = GlobalData.GetDominFreq(eventTimeStr);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (canComputeWaveform)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ReportSearchProgress(progress, CreateEventProgress(completedCount, totalCount, 1, eventStageCount, "正在读取波形JSON"));
|
|
|
|
|
|
|
|
JObject eventJson = ReadEventJsonRoot(jsonFilePath);
|
|
|
|
|
|
|
|
ReportSearchProgress(progress, CreateEventProgress(completedCount, totalCount, 2, eventStageCount, "正在计算震源机制"));
|
|
|
|
|
|
|
|
ComputeFM(curMmEvent, eventJson, jsonFilePath);
|
|
|
|
|
|
|
|
ReportSearchProgress(progress, CreateEventProgress(completedCount, totalCount, 3, eventStageCount, "正在计算主频"));
|
|
|
|
|
|
|
|
//目前提取的为半周期
|
|
|
|
|
|
|
|
curMmEvent.DominantFreq = GetDominFreq(eventJson);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Random dominRnd = new Random((int)DateTime.Parse(curMmEvent.EventTimeStr).Ticks);
|
|
|
|
Random dominRnd = new Random((int)DateTime.Parse(curMmEvent.EventTimeStr).Ticks);
|
|
|
|
int dominFreq = (int)curMmEvent.DominantFreq;
|
|
|
|
int dominFreq = (int)curMmEvent.DominantFreq;
|
|
|
|
if (curMmEvent.DominantFreq < 14)
|
|
|
|
if (curMmEvent.DominantFreq < 14)
|
|
|
|
@ -838,16 +972,8 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
se.Direction = curMmEvent.Direction;
|
|
|
|
se.Direction = curMmEvent.Direction;
|
|
|
|
se.SetEnergy();
|
|
|
|
se.SetEnergy();
|
|
|
|
results.Add(se);
|
|
|
|
results.Add(se);
|
|
|
|
|
|
|
|
ReportSearchProgress(progress, CreateEventProgress(completedCount, totalCount, eventStageCount, eventStageCount, "正在整理事件结果"));
|
|
|
|
completedCount++;
|
|
|
|
completedCount++;
|
|
|
|
if (progress != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
progress.Report(new SearchProgressInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CompletedCount = completedCount,
|
|
|
|
|
|
|
|
TotalCount = totalCount,
|
|
|
|
|
|
|
|
Message = "正在计算震源机制"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return results;
|
|
|
|
return results;
|
|
|
|
@ -868,6 +994,41 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
MaxEnergy = Math.Round(results.Max(rs => rs.Energy), 2);
|
|
|
|
MaxEnergy = Math.Round(results.Max(rs => rs.Energy), 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JObject ReadEventJsonRoot(string jsonFilePath)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
using (StreamReader sr = System.IO.File.OpenText(jsonFilePath))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
JsonTextReader reader = new JsonTextReader(sr);
|
|
|
|
|
|
|
|
JArray jArray = (JArray)JToken.ReadFrom(reader);
|
|
|
|
|
|
|
|
return (JObject)jArray[0];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int GetDominFreq(JObject eventJson)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int dominantFreq = 0;
|
|
|
|
|
|
|
|
List<double> dominantFreqList = new List<double>();
|
|
|
|
|
|
|
|
JArray phaseArr = JArray.FromObject(eventJson["phases"]);
|
|
|
|
|
|
|
|
for (int i = 0; i < phaseArr.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (phaseArr[i]["zcr"] != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dominantFreqList.Add(double.Parse(phaseArr[i]["zcr"].ToString()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dominantFreqList.Count > 3)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
double min = dominantFreqList.Min();
|
|
|
|
|
|
|
|
double max = dominantFreqList.Max();
|
|
|
|
|
|
|
|
dominantFreqList.Remove(min);
|
|
|
|
|
|
|
|
dominantFreqList.Remove(max);
|
|
|
|
|
|
|
|
dominantFreq = (int)(dominantFreqList.Sum() / dominantFreqList.Count);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return dominantFreq;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ExportEventListReport(ReportView rView)
|
|
|
|
public void ExportEventListReport(ReportView rView)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string fileNmae = "微震事件列表_" + DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
string fileNmae = "微震事件列表_" + DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
@ -1350,6 +1511,30 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
mmEvent.FocalType = cr.FocalType;
|
|
|
|
mmEvent.FocalType = cr.FocalType;
|
|
|
|
mmEvent.Direction = cr.Direction;
|
|
|
|
mmEvent.Direction = cr.Direction;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ComputeFM(MmEvent mmEvent, JObject eventJson, string jsonFilePath)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mmEvent.JsonFile = jsonFilePath;
|
|
|
|
|
|
|
|
mmEvent.SetEnergy();
|
|
|
|
|
|
|
|
mmEvent.Phases = new Dictionary<string, int>();
|
|
|
|
|
|
|
|
JArray phaseArr = JArray.FromObject(eventJson["phases"]);
|
|
|
|
|
|
|
|
for (int i = 0; i < phaseArr.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (phaseArr[i]["first_motion_direct"] != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mmEvent.Phases.Add(phaseArr[i]["id"].ToString().Substring(3, 3),
|
|
|
|
|
|
|
|
int.Parse(phaseArr[i]["first_motion_direct"].ToString()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FMMap fmMap = CreateFM(mmEvent, GlobalConfig.ProjectConfig.WorkArea.EMin, GlobalConfig.ProjectConfig.WorkArea.NMin);
|
|
|
|
|
|
|
|
ComputationResult cr = GlobalConfig.fmCore.ComputeResult(fmMap);
|
|
|
|
|
|
|
|
if (cr == null)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
mmEvent.FocalType = cr.FocalType;
|
|
|
|
|
|
|
|
mmEvent.Direction = cr.Direction;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public FMMap CreateFM(MmEvent mmEvent, double BaseX, double BaseY)
|
|
|
|
public FMMap CreateFM(MmEvent mmEvent, double BaseX, double BaseY)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FMMap fmMap = new FMMap();
|
|
|
|
FMMap fmMap = new FMMap();
|
|
|
|
|