|
|
|
@ -75,6 +75,12 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
public int dayFreqImageHeight = 585;
|
|
|
|
public int dayFreqImageHeight = 585;
|
|
|
|
public int reportDayListFirstRow = 35;
|
|
|
|
public int reportDayListFirstRow = 35;
|
|
|
|
public int reportEventListCols = 10;
|
|
|
|
public int reportEventListCols = 10;
|
|
|
|
|
|
|
|
private class SearchProgressInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public int CompletedCount { get; set; }
|
|
|
|
|
|
|
|
public int TotalCount { get; set; }
|
|
|
|
|
|
|
|
public string Message { get; set; }
|
|
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 查询模式:0:自定义查询;1:日报;2:周报;3:月报
|
|
|
|
/// 查询模式:0:自定义查询;1:日报;2:周报;3:月报
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
@ -260,6 +266,80 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
SetProperty(ref _maxEnergy, value);
|
|
|
|
SetProperty(ref _maxEnergy, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private bool _isSearching;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsSearching
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _isSearching; }
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (SetProperty(ref _isSearching, value))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SearchProgressVisibility = value ? Visibility.Visible : Visibility.Collapsed;
|
|
|
|
|
|
|
|
RaisePropertyChanged(nameof(IsSearchEnabled));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsSearchEnabled
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return !IsSearching; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Visibility _searchProgressVisibility = Visibility.Collapsed;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Visibility SearchProgressVisibility
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _searchProgressVisibility; }
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetProperty(ref _searchProgressVisibility, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool _searchProgressIndeterminate = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool SearchProgressIndeterminate
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _searchProgressIndeterminate; }
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetProperty(ref _searchProgressIndeterminate, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private double _searchProgressValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public double SearchProgressValue
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _searchProgressValue; }
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetProperty(ref _searchProgressValue, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string _searchProgressText = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string SearchProgressText
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _searchProgressText; }
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetProperty(ref _searchProgressText, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string _searchProgressPercentText = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string SearchProgressPercentText
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _searchProgressPercentText; }
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetProperty(ref _searchProgressPercentText, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
private string _likeCondition;
|
|
|
|
private string _likeCondition;
|
|
|
|
|
|
|
|
|
|
|
|
public string LikeCondition
|
|
|
|
public string LikeCondition
|
|
|
|
@ -325,78 +405,123 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public ICommand SelectEventListCommand
|
|
|
|
public ICommand SelectEventListCommand
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => new DelegateCommand<ReportView>((rView) =>
|
|
|
|
get => new DelegateCommand<ReportView>(async (rView) => await ExecuteSelectEventListAsync(rView));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public ICommand SelectDayCommand
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SelectType = 0;
|
|
|
|
get => new DelegateCommand<ReportView>(async (rView) => await ExecuteSelectDayAsync(rView));
|
|
|
|
DateTime st = TimeFC.Cond1;
|
|
|
|
}
|
|
|
|
DateTime et = TimeFC.Cond2;
|
|
|
|
|
|
|
|
var results = SearchEvents(st, et);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (results != null)
|
|
|
|
private async Task ExecuteSelectEventListAsync(ReportView rView)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SelectResult = new ObservableCollection<GridItemEventResult>(results);
|
|
|
|
if (IsSearching)
|
|
|
|
//FreqChart = CreateDayFreqImage(results, st, st.ToString("D", culture));
|
|
|
|
|
|
|
|
//freqBytes = BitmapHelper.ConvertToBytes(ExportToBitmap(FreqChart, dayFreqImageWidth, dayFreqImageHeight));
|
|
|
|
|
|
|
|
var mes = results.Where(rs => rs.Energy >= MiddleEnergy).ToList();
|
|
|
|
|
|
|
|
//new ReportPlanImage().DrawPlanClipToFile(mes);
|
|
|
|
|
|
|
|
MiddleEnergyEvents = mes;
|
|
|
|
|
|
|
|
MiddleEventCount = mes.Count();
|
|
|
|
|
|
|
|
if (mes.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ReportPlanImage rpi = new ReportPlanImage();
|
|
|
|
return;
|
|
|
|
//rpi.DrawPlanClipToDrawVisual(mes, (int)rView.canvasPlan.ActualWidth, (int)rView.canvasPlan.ActualHeight);
|
|
|
|
|
|
|
|
rpi.Draw(mes, rView.canvasPlan.ActualWidth, rView.canvasPlan.ActualHeight);
|
|
|
|
|
|
|
|
//rView.canvasPlan = rpi.host;
|
|
|
|
|
|
|
|
rView.canvasPlan.Children.Clear();
|
|
|
|
|
|
|
|
rView.canvasPlan.Children.Add(rpi.host);
|
|
|
|
|
|
|
|
CreateStereoChart(mes);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
SelectType = 0;
|
|
|
|
|
|
|
|
DateTime st = TimeFC.Cond1;
|
|
|
|
|
|
|
|
DateTime et = TimeFC.Cond2;
|
|
|
|
|
|
|
|
await ExecuteSearchAsync(rView, st, et, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public ICommand SelectDayCommand
|
|
|
|
|
|
|
|
|
|
|
|
private async Task ExecuteSelectDayAsync(ReportView rView)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => new DelegateCommand<ReportView>((rView) =>
|
|
|
|
if (IsSearching)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SelectType = 1;
|
|
|
|
SelectType = 1;
|
|
|
|
//日报起始时刻
|
|
|
|
|
|
|
|
DateTime drstarttime = GlobalConfig.DailyReportStartTime;
|
|
|
|
DateTime drstarttime = GlobalConfig.DailyReportStartTime;
|
|
|
|
Console.WriteLine(GlobalConfig.DailyReportStartTime.ToString());
|
|
|
|
|
|
|
|
DateTime st = new DateTime(TimeFC.Cond1.Year, TimeFC.Cond1.Month, TimeFC.Cond1.Day,
|
|
|
|
DateTime st = new DateTime(TimeFC.Cond1.Year, TimeFC.Cond1.Month, TimeFC.Cond1.Day,
|
|
|
|
drstarttime.Hour, drstarttime.Minute, drstarttime.Second);
|
|
|
|
drstarttime.Hour, drstarttime.Minute, drstarttime.Second);
|
|
|
|
|
|
|
|
await ExecuteSearchAsync(rView, st, st.AddSeconds(86399), true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var results = SearchEvents(st, st.AddSeconds(86399));
|
|
|
|
private async Task ExecuteSearchAsync(ReportView rView, DateTime st, DateTime et, bool createDayFreq)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IsSearching = true;
|
|
|
|
|
|
|
|
ResetSearchProgress("正在查询事件数据...");
|
|
|
|
|
|
|
|
var progress = new Progress<SearchProgressInfo>(UpdateSearchProgress);
|
|
|
|
|
|
|
|
var results = await SearchEventsAsync(st, et, progress);
|
|
|
|
|
|
|
|
ApplySearchResults(rView, results, st, createDayFreq);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
HandyControl.Controls.MessageBox.Show("查询失败:" + ex.Message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IsSearching = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (results != null)
|
|
|
|
private void ApplySearchResults(ReportView rView, List<GridItemEventResult> results, DateTime st, bool createDayFreq)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (results == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SelectResult = new ObservableCollection<GridItemEventResult>(results);
|
|
|
|
SelectResult = new ObservableCollection<GridItemEventResult>(results);
|
|
|
|
|
|
|
|
SearchCount = results.Count;
|
|
|
|
|
|
|
|
UpdateEnergyStats(results);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (createDayFreq)
|
|
|
|
|
|
|
|
{
|
|
|
|
FreqChart = CreateDayFreqImage(results, st, st.ToString("D", culture));
|
|
|
|
FreqChart = CreateDayFreqImage(results, st, st.ToString("D", culture));
|
|
|
|
//freqBytes = BitmapHelper.ConvertToBytes(ExportToBitmap(FreqChart, dayFreqImageWidth, dayFreqImageHeight));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var mes = results.Where(rs => rs.Energy >= MiddleEnergy).ToList();
|
|
|
|
var mes = results.Where(rs => rs.Energy >= MiddleEnergy).ToList();
|
|
|
|
//new ReportPlanImage().DrawPlanClipToFile(mes);
|
|
|
|
|
|
|
|
MiddleEnergyEvents = mes;
|
|
|
|
MiddleEnergyEvents = mes;
|
|
|
|
MiddleEventCount = mes.Count();
|
|
|
|
MiddleEventCount = mes.Count();
|
|
|
|
if (mes.Count > 0)
|
|
|
|
if (mes.Count > 0 && rView != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ReportPlanImage rpi = new ReportPlanImage();
|
|
|
|
ReportPlanImage rpi = new ReportPlanImage();
|
|
|
|
//rpi.DrawPlanClipToDrawVisual(mes, (int)rView.canvasPlan.ActualWidth, (int)rView.canvasPlan.ActualHeight);
|
|
|
|
|
|
|
|
rpi.Draw(mes, rView.canvasPlan.ActualWidth, rView.canvasPlan.ActualHeight);
|
|
|
|
rpi.Draw(mes, rView.canvasPlan.ActualWidth, rView.canvasPlan.ActualHeight);
|
|
|
|
//rView.canvasPlan = rpi.host;
|
|
|
|
|
|
|
|
rView.canvasPlan.Children.Clear();
|
|
|
|
rView.canvasPlan.Children.Clear();
|
|
|
|
rView.canvasPlan.Children.Add(rpi.host);
|
|
|
|
rView.canvasPlan.Children.Add(rpi.host);
|
|
|
|
|
|
|
|
|
|
|
|
CreateStereoChart(mes);
|
|
|
|
CreateStereoChart(mes);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//rView.canvasPlan.
|
|
|
|
private void ResetSearchProgress(string message)
|
|
|
|
//dayMiddleEventPlanBytes = new ReportPlanImage().DrawPlanClipToFile(mes);
|
|
|
|
{
|
|
|
|
|
|
|
|
SearchProgressIndeterminate = true;
|
|
|
|
|
|
|
|
SearchProgressValue = 0;
|
|
|
|
|
|
|
|
SearchProgressPercentText = "";
|
|
|
|
|
|
|
|
SearchProgressText = message;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void UpdateSearchProgress(SearchProgressInfo progress)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (progress == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (progress.TotalCount <= 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SearchProgressIndeterminate = progress.Message != "未查询到事件";
|
|
|
|
|
|
|
|
SearchProgressValue = 0;
|
|
|
|
|
|
|
|
SearchProgressPercentText = progress.Message == "未查询到事件" ? "0%" : "";
|
|
|
|
|
|
|
|
SearchProgressText = progress.Message;
|
|
|
|
|
|
|
|
if (progress.Message == "未查询到事件")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SearchCount = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double percent = Math.Round(progress.CompletedCount * 100.0 / progress.TotalCount, 0);
|
|
|
|
|
|
|
|
SearchCount = progress.TotalCount;
|
|
|
|
|
|
|
|
SearchProgressIndeterminate = false;
|
|
|
|
|
|
|
|
SearchProgressValue = percent;
|
|
|
|
|
|
|
|
SearchProgressPercentText = percent.ToString("F0") + "%";
|
|
|
|
|
|
|
|
SearchProgressText = progress.Message + " " + progress.CompletedCount + "/" + progress.TotalCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
@ -583,7 +708,20 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
StereoChart.View3D.PointLineSeries3D.Add(plsEvent3d);
|
|
|
|
StereoChart.View3D.PointLineSeries3D.Add(plsEvent3d);
|
|
|
|
stereoChart.EndUpdate();
|
|
|
|
stereoChart.EndUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private Task<List<GridItemEventResult>> SearchEventsAsync(DateTime searchStartTime, DateTime searchEndTime, IProgress<SearchProgressInfo> progress)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return Task.Run(() => SearchEventsCore(searchStartTime, searchEndTime, progress));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<GridItemEventResult> SearchEvents(DateTime searchStartTime, DateTime searchEndTime)
|
|
|
|
public List<GridItemEventResult> SearchEvents(DateTime searchStartTime, DateTime searchEndTime)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var results = SearchEventsCore(searchStartTime, searchEndTime, null);
|
|
|
|
|
|
|
|
SearchCount = results.Count;
|
|
|
|
|
|
|
|
UpdateEnergyStats(results);
|
|
|
|
|
|
|
|
return results;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<GridItemEventResult> SearchEventsCore(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;
|
|
|
|
@ -624,10 +762,30 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
{
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (progress != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
progress.Report(new SearchProgressInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CompletedCount = 0,
|
|
|
|
|
|
|
|
TotalCount = 0,
|
|
|
|
|
|
|
|
Message = "正在查询事件数据..."
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
var list = fsqlTencent.Select<RemoteRealtimeResultEntity>()
|
|
|
|
var list = fsqlTencent.Select<RemoteRealtimeResultEntity>()
|
|
|
|
.WithSql(findStr).ToList();
|
|
|
|
.WithSql(findStr).ToList();
|
|
|
|
|
|
|
|
int totalCount = list == null ? 0 : list.Count;
|
|
|
|
|
|
|
|
if (progress != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
progress.Report(new SearchProgressInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CompletedCount = 0,
|
|
|
|
|
|
|
|
TotalCount = totalCount,
|
|
|
|
|
|
|
|
Message = totalCount == 0 ? "未查询到事件" : "正在计算震源机制"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
if (list != null)
|
|
|
|
if (list != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
int completedCount = 0;
|
|
|
|
foreach (var item in list)
|
|
|
|
foreach (var item in list)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GridItemEventResult se = new GridItemEventResult(item, true);
|
|
|
|
GridItemEventResult se = new GridItemEventResult(item, true);
|
|
|
|
@ -683,10 +841,18 @@ namespace Txgy.EWS.Client.PageModule.ViewModels
|
|
|
|
se.Direction = curMmEvent.Direction;
|
|
|
|
se.Direction = curMmEvent.Direction;
|
|
|
|
se.SetEnergy();
|
|
|
|
se.SetEnergy();
|
|
|
|
results.Add(se);
|
|
|
|
results.Add(se);
|
|
|
|
|
|
|
|
completedCount++;
|
|
|
|
|
|
|
|
if (progress != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
progress.Report(new SearchProgressInfo
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CompletedCount = completedCount,
|
|
|
|
|
|
|
|
TotalCount = totalCount,
|
|
|
|
|
|
|
|
Message = "正在计算震源机制"
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SearchCount = results.Count;
|
|
|
|
|
|
|
|
UpdateEnergyStats(results);
|
|
|
|
|
|
|
|
return results;
|
|
|
|
return results;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|