|
|
@ -1,10 +1,13 @@
|
|
|
|
using Arction.Wpf.ChartingMVVM;
|
|
|
|
using Arction.Wpf.Charting;
|
|
|
|
using Arction.Wpf.ChartingMVVM.Axes;
|
|
|
|
using Arction.Wpf.Charting.Axes;
|
|
|
|
using Arction.Wpf.ChartingMVVM.Views.ViewXY;
|
|
|
|
using Arction.Wpf.Charting.Views.ViewXY;
|
|
|
|
|
|
|
|
using Microsoft.Win32;
|
|
|
|
using mseedChart.Core;
|
|
|
|
using mseedChart.Core;
|
|
|
|
using mseedChart.MainModule.Models;
|
|
|
|
using mseedChart.MainModule.Models;
|
|
|
|
|
|
|
|
using Prism.Commands;
|
|
|
|
using Prism.Events;
|
|
|
|
using Prism.Events;
|
|
|
|
using Prism.Mvvm;
|
|
|
|
using Prism.Mvvm;
|
|
|
|
|
|
|
|
using SharpDX.DirectWrite;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
@ -17,59 +20,47 @@ using System.Threading.Tasks;
|
|
|
|
using System.Windows;
|
|
|
|
using System.Windows;
|
|
|
|
using System.Windows.Controls;
|
|
|
|
using System.Windows.Controls;
|
|
|
|
using System.Windows.Media;
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
using System.Windows.Threading;
|
|
|
|
using System.Windows.Threading;
|
|
|
|
|
|
|
|
|
|
|
|
namespace mseedChart.MainModule.ViewModels
|
|
|
|
namespace mseedChart.MainModule.ViewModels
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class ChartPlotViewModel : BindableBase
|
|
|
|
public class ChartPlotViewModel : BindableBase
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#region variable
|
|
|
|
|
|
|
|
Dispatcher _dispatcher;
|
|
|
|
public ChartPlotViewModel()
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Delegate for data generation.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 当前采样数
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public int CurPoints;
|
|
|
|
|
|
|
|
private readonly IEventAggregator _ea;
|
|
|
|
|
|
|
|
private int _selectResult = 0;
|
|
|
|
|
|
|
|
public int SelectResult
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get { return _selectResult; }
|
|
|
|
_dispatcher = Application.Current.Dispatcher;
|
|
|
|
|
|
|
|
_wavesModel = new WavesModel();
|
|
|
|
|
|
|
|
CreateChart();
|
|
|
|
|
|
|
|
(Application.Current.MainWindow as System.Windows.Window).Closing += ApplicationClosingDispose;
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
string fileName = "2023-03-31T07:43:15.464036";
|
|
|
|
{
|
|
|
|
ShowWave(null,obj:fileName);
|
|
|
|
SetProperty(ref _selectResult, value);
|
|
|
|
string eventTimeStr = fileName;
|
|
|
|
}
|
|
|
|
string datePath = eventTimeStr.Substring(0, 4) + eventTimeStr.Substring(5, 2) + eventTimeStr.Substring(8, 2);
|
|
|
|
|
|
|
|
string dataFilePath = RegionNames.MseedFilePath + "\\" + datePath + "\\";
|
|
|
|
|
|
|
|
string dataFileName = "HA." + eventTimeStr.Substring(0, 4) + eventTimeStr.Substring(5, 2)
|
|
|
|
|
|
|
|
+ eventTimeStr.Substring(8, 2) + eventTimeStr.Substring(10, 3)
|
|
|
|
|
|
|
|
+ eventTimeStr.Substring(14, 2) + eventTimeStr.Substring(17, 2) + ".01" + RegionNames.DataTypeString;
|
|
|
|
|
|
|
|
string jsonStr = ".json";
|
|
|
|
|
|
|
|
_wavesModel.Json2MmEvent(dataFilePath+dataFileName+jsonStr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int _channelCount = 60; // Channel count.
|
|
|
|
|
|
|
|
double _samplingFrequency = 500; // Sampling frequency (Hz).
|
|
|
|
|
|
|
|
double _xLength = 10; // X axis length.
|
|
|
|
|
|
|
|
double _previousX = 0; // Latest X value on axis.
|
|
|
|
|
|
|
|
long _now; // Latest time stamp.
|
|
|
|
|
|
|
|
long _startTicks; // Controls timing.
|
|
|
|
|
|
|
|
long _samplesOutput; // Generated samples quantity.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Constants
|
|
|
|
|
|
|
|
const double YMin = 30000; // Minimal y-value.
|
|
|
|
|
|
|
|
const double YMax = 33000; // Maximal y-value.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WavesModel _wavesModel;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Thread.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private delegate void ChartUpdateFromThreadHandler(double[][] samples);
|
|
|
|
#region 字段
|
|
|
|
|
|
|
|
Dispatcher _dispatcher;
|
|
|
|
|
|
|
|
public int CurPoints;
|
|
|
|
private ChartUpdateFromThreadHandler _chartUpdate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Random _rand = new Random((int)DateTime.Now.Ticks);
|
|
|
|
int _channelCount = 0;
|
|
|
|
|
|
|
|
double _samplingFrequency = 500; // 采样频率 (Hz).
|
|
|
|
|
|
|
|
double _previousX = 0;
|
|
|
|
|
|
|
|
|
|
|
|
#region "属性"
|
|
|
|
WavesModel _wavesModel;
|
|
|
|
private int _lChartCount = 1;
|
|
|
|
private int _lChartCount = 1;
|
|
|
|
|
|
|
|
public List<StationModel> smList;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 属性
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 波形控件数量
|
|
|
|
/// 波形控件数量
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -78,117 +69,6 @@ namespace mseedChart.MainModule.ViewModels
|
|
|
|
get { return _lChartCount; }
|
|
|
|
get { return _lChartCount; }
|
|
|
|
set { _lChartCount = value; }
|
|
|
|
set { _lChartCount = value; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public List<ShareProperty> WaveComList { get; set; }
|
|
|
|
|
|
|
|
private ShareProperty _wavesCombination;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 波形组合
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public ShareProperty WavesCombination
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _wavesCombination; }
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_wavesCombination = value;
|
|
|
|
|
|
|
|
SetWavesCombination();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private DataSourcesEnum _dataSources;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 数据来源
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public DataSourcesEnum DataSources
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _dataSources; }
|
|
|
|
|
|
|
|
set { _dataSources = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DataTypeEnum _wavesType;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 波形类型
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public DataTypeEnum WavesType
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _wavesType; }
|
|
|
|
|
|
|
|
set { _wavesType = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DisplayModeEnum _displayMode;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 显示模式
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public DisplayModeEnum DisplayMode
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _displayMode; }
|
|
|
|
|
|
|
|
set { _displayMode = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ScollModeEnum _scollMode;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 滚动方式
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public ScollModeEnum ScollMode
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _scollMode; }
|
|
|
|
|
|
|
|
set { _scollMode = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DateTime _startTime;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 开始时间
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public DateTime StartTime
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _startTime; }
|
|
|
|
|
|
|
|
set { _startTime = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private DateTime _endTime;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 开始时间
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public DateTime EndTime
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _endTime; }
|
|
|
|
|
|
|
|
set { _endTime = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int _sampling = 500;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 采样频率
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public int Sampling
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _sampling; }
|
|
|
|
|
|
|
|
set { _sampling = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 延时(min)
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public int DelayMin { get; set; } = 10;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 文件数据位置
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public string FileDataPath { get; set; } = @"D:\TaySystemPath\Downloads";
|
|
|
|
|
|
|
|
private string _cachePath;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int _cacheSize;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 缓存大小
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public int CacheSize
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _cacheSize; }
|
|
|
|
|
|
|
|
set { _cacheSize = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private ObservableCollection<int> _stationList;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 台站列表
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public ObservableCollection<int> StationList
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _stationList; }
|
|
|
|
|
|
|
|
set { _stationList = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private LightningChart _lChartAll;
|
|
|
|
private LightningChart _lChartAll;
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 所有波形
|
|
|
|
/// 所有波形
|
|
|
@ -198,33 +78,6 @@ namespace mseedChart.MainModule.ViewModels
|
|
|
|
get { return _lChartAll; }
|
|
|
|
get { return _lChartAll; }
|
|
|
|
set { _lChartAll = value; }
|
|
|
|
set { _lChartAll = value; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private LightningChart _lChartZ;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Z通道波形
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public LightningChart LChartZ
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _lChartZ; }
|
|
|
|
|
|
|
|
set { _lChartZ = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private LightningChart _lChartE;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// E通道波形
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public LightningChart LChartE
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _lChartE; }
|
|
|
|
|
|
|
|
set { _lChartE = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private LightningChart _lChartN;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// N通道波形
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public LightningChart LChartN
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _lChartN; }
|
|
|
|
|
|
|
|
set { _lChartN = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private FrameworkElement childContent;
|
|
|
|
private FrameworkElement childContent;
|
|
|
|
public FrameworkElement ChildContent
|
|
|
|
public FrameworkElement ChildContent
|
|
|
@ -240,140 +93,76 @@ namespace mseedChart.MainModule.ViewModels
|
|
|
|
get { return gridChart; }
|
|
|
|
get { return gridChart; }
|
|
|
|
set { gridChart = value; }
|
|
|
|
set { gridChart = value; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private MmEvent _eventTime;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MmEvent EventTime
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get { return _eventTime; }
|
|
|
|
|
|
|
|
set { _eventTime = value; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<StationModel> smList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ChartPlotViewModel()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_dispatcher = Application.Current.Dispatcher;
|
|
|
|
|
|
|
|
SelectResult = 10;
|
|
|
|
|
|
|
|
var wcList = (WavesCombinationEnum[])Enum.GetValues(typeof(WavesCombinationEnum));
|
|
|
|
|
|
|
|
WaveComList = wcList.Select(value => new ShareProperty((int)value, value.ToString())).ToList();
|
|
|
|
|
|
|
|
WavesCombination = WaveComList.SingleOrDefault(wc => wc.ID == 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_chartUpdate = new ChartUpdateFromThreadHandler(FeedNewDataToChartPingPu);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
_wavesModel = new WavesModel();
|
|
|
|
#region 事件
|
|
|
|
LChartALL.ViewXY.XAxes = new AxisXCollection();
|
|
|
|
public DelegateCommand<object> AxesYVisibleCommand => new DelegateCommand<object>(AxesYVisible);
|
|
|
|
LChartALL.ViewXY.XAxes.Add(_wavesModel.GetAxisX(10));
|
|
|
|
public DelegateCommand FileSelectorCommand => new DelegateCommand(FileSelector);
|
|
|
|
InitData();
|
|
|
|
|
|
|
|
(Application.Current.MainWindow as System.Windows.Window).Closing += ApplicationClosingDispose;
|
|
|
|
|
|
|
|
ShowWave();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void ShowWave(string obj= "2023-03-29T06:41:21.348")
|
|
|
|
private void AxesYVisible(object isCheck)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string EventTimeStr = obj;
|
|
|
|
if (_lChartAll != null)
|
|
|
|
string datePath = EventTimeStr.Substring(0, 4) + EventTimeStr.Substring(5, 2) + EventTimeStr.Substring(8, 2);
|
|
|
|
|
|
|
|
string dataFilePath = RegionNames.MseedFilePath + "\\" + datePath + "\\";
|
|
|
|
|
|
|
|
string dataFileName = "HA." + EventTimeStr.Substring(0, 4) + EventTimeStr.Substring(5, 2)
|
|
|
|
|
|
|
|
+ EventTimeStr.Substring(8, 2) + EventTimeStr.Substring(10, 3)
|
|
|
|
|
|
|
|
+ EventTimeStr.Substring(14, 2) + EventTimeStr.Substring(17, 2) + ".01" + RegionNames.DataTypeString;
|
|
|
|
|
|
|
|
string mseedStr = ".mseed";
|
|
|
|
|
|
|
|
string asciiSavePath = RegionNames.TxtFilePath + "\\" + datePath + "\\" + dataFileName + ".txt";
|
|
|
|
|
|
|
|
if (!Directory.Exists(dataFilePath))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Directory.CreateDirectory(dataFilePath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Directory.Exists(Path.GetDirectoryName(asciiSavePath)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Directory.CreateDirectory(Path.GetDirectoryName(asciiSavePath));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//if (!File.Exists(dataFilePath + dataFileName + mseedStr))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
bool yAxesVisible = ((bool)isCheck == true);
|
|
|
|
|
|
|
|
_lChartAll.BeginUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
//TaskData taskData = new TaskData();
|
|
|
|
AxisY lastYAxis = _lChartAll.ViewXY.YAxes.Last();
|
|
|
|
//taskData.EventTimeStr = EventTimeStr;
|
|
|
|
|
|
|
|
//taskData.Tasks = new Task(() =>
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// int res = new DownloadWavedata().Download(EventTimeStr, dataFilePath, dataFileName + mseedStr, GlobalConfig.UseWaveDataTable);
|
|
|
|
|
|
|
|
// if (res > -1)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// MSeed2Asc(dataFilePath + dataFileName + mseedStr, asciiSavePath);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// //Console.WriteLine(taskData.IsComplete);
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
//taskData.CallBack = (string res) =>
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// _dispatcher.Invoke(() =>
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// UpdateWavesFromTxt(asciiSavePath);
|
|
|
|
|
|
|
|
// _channelCount = smList.Count * 3;
|
|
|
|
|
|
|
|
// UpdateChart();
|
|
|
|
|
|
|
|
// UpdateChartData();
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//};
|
|
|
|
|
|
|
|
//TaskQueue.Instance.AddTaskAndRuning(taskData);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!File.Exists(asciiSavePath))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MSeed2Asc(dataFilePath + dataFileName + mseedStr, asciiSavePath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_dispatcher.Invoke(() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
UpdateWavesFromTxt(asciiSavePath);
|
|
|
|
|
|
|
|
_channelCount = smList.Count * 3;
|
|
|
|
|
|
|
|
UpdateChart();
|
|
|
|
|
|
|
|
UpdateChartData();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_lChartAll.ViewXY.AxisLayout.AutoAdjustMargins = false;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
foreach (AxisY yAxis in _lChartAll.ViewXY.YAxes)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (yAxis != lastYAxis)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
yAxis.Visible = yAxesVisible;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
yAxis.Visible = true;
|
|
|
|
|
|
|
|
yAxis.LabelsVisible = yAxesVisible;
|
|
|
|
|
|
|
|
//yAxis.MajorDivTickStyle.Visible = yAxesVisible;
|
|
|
|
|
|
|
|
//yAxis.MinorDivTickStyle.Visible = yAxesVisible;
|
|
|
|
|
|
|
|
yAxis.Title.Visible = yAxesVisible;
|
|
|
|
|
|
|
|
if (yAxesVisible)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
yAxis.AxisThickness = 3;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
yAxis.AxisThickness = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// lastYAxis.MiniScale.Visible = !yAxesVisible;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_lChartAll.EndUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
private void UpdateChart()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//线程问题
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes = new AxisYCollection();
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes.Clear();
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes.AddRange(_wavesModel.CreateYAxisPingPu(smList, LChartALL));
|
|
|
|
|
|
|
|
for (int i = 0; i < LChartALL.ViewXY.YAxes.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes[i].LabelsColor = Colors.Black;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes[i].AxisColor = Colors.Black;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes[i].GridStripColor = Colors.Black;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes[i].Title.Color = Colors.Black;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes[i].Title.Shadow.DropColor = Colors.Transparent;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes[i].Title.Shadow.ContrastColor = Colors.Transparent;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LChartALL.ViewXY.XAxes = new AxisXCollection();
|
|
|
|
|
|
|
|
LChartALL.ViewXY.XAxes.Add(_wavesModel.GetAxisX(CurPoints / Sampling));
|
|
|
|
|
|
|
|
LChartALL.ViewXY.XAxes[0].LabelsColor = Colors.Black;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LChartALL.ViewXY.SampleDataSeries = new SampleDataSeriesCollection();
|
|
|
|
|
|
|
|
LChartALL.ViewXY.SampleDataSeries.AddRange(
|
|
|
|
|
|
|
|
_wavesModel.GetSampleDataSeriesPingPu(smList, LChartALL, LChartALL.ViewXY.XAxes[0],
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes, _samplingFrequency));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void UpdateChartData()
|
|
|
|
|
|
|
|
|
|
|
|
private void FileSelector()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
double[][] multiChannelData = new double[smList.Count * 3][];
|
|
|
|
OpenFileDialog openFileDialog = new OpenFileDialog
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int channelIndex = 0; channelIndex < smList.Count; channelIndex++)
|
|
|
|
RestoreDirectory = true,
|
|
|
|
{
|
|
|
|
Filter = ".json|*.json|.mseed|*.mseed|.txt|*.txt",
|
|
|
|
multiChannelData[channelIndex * 3] = smList[channelIndex].dz.ToArray();
|
|
|
|
};
|
|
|
|
multiChannelData[channelIndex * 3 + 1] = smList[channelIndex].dn.ToArray();
|
|
|
|
if (openFileDialog.ShowDialog() == true)
|
|
|
|
multiChannelData[channelIndex * 3 + 2] = smList[channelIndex].de.ToArray();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Invoke FeedNewDataToChart.
|
|
|
|
|
|
|
|
_dispatcher.Invoke(_chartUpdate, System.Windows.Threading.DispatcherPriority.ContextIdle,
|
|
|
|
|
|
|
|
multiChannelData as object);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw ex;
|
|
|
|
ShowWave(openFileDialog.FileName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
public void UpdateWavesFromTxt(string fn)
|
|
|
|
public void UpdateWavesFromTxt(string fn)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string allStr;
|
|
|
|
string allStr;
|
|
|
@ -387,7 +176,6 @@ namespace mseedChart.MainModule.ViewModels
|
|
|
|
string[] strLines = allStr.Trim().Split(new char[] { '\n' });
|
|
|
|
string[] strLines = allStr.Trim().Split(new char[] { '\n' });
|
|
|
|
List<string> strList = strLines.ToList();
|
|
|
|
List<string> strList = strLines.ToList();
|
|
|
|
int cnt = strList.Count;
|
|
|
|
int cnt = strList.Count;
|
|
|
|
int num = 0;
|
|
|
|
|
|
|
|
string[] snStr = strLines[0].Trim().Split(',');
|
|
|
|
string[] snStr = strLines[0].Trim().Split(',');
|
|
|
|
string tmpName = snStr[0].Substring(14, 3);
|
|
|
|
string tmpName = snStr[0].Substring(14, 3);
|
|
|
|
CurPoints = int.Parse(snStr[1].Trim().Split(' ')[0]);
|
|
|
|
CurPoints = int.Parse(snStr[1].Trim().Split(' ')[0]);
|
|
|
@ -453,69 +241,50 @@ namespace mseedChart.MainModule.ViewModels
|
|
|
|
compiler.WaitForExit();
|
|
|
|
compiler.WaitForExit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void ApplicationClosingDispose(object sender, CancelEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
private void CreateChart()
|
|
|
|
if (LChartALL != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
LChartALL.Dispose();
|
|
|
|
|
|
|
|
LChartALL = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
gridChart.Children.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (LChartALL != null)
|
|
|
|
if (LChartALL != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LChartALL.Dispose();
|
|
|
|
|
|
|
|
LChartALL = null;
|
|
|
|
LChartALL = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void SetWavesCombination()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (WavesCombination.Name)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case "平铺":
|
|
|
|
|
|
|
|
LChartCount = 1;
|
|
|
|
|
|
|
|
CreateGridChartPingPu();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "叠加":
|
|
|
|
|
|
|
|
LChartCount = 1;
|
|
|
|
|
|
|
|
CreateGridChartDieJia();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "分类":
|
|
|
|
|
|
|
|
LChartCount = 3;
|
|
|
|
|
|
|
|
CreateGridChartFenLei();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CreateGridChartPingPu()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (LChartALL != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
LChartALL = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LChartALL = new LightningChart();
|
|
|
|
LChartALL = new LightningChart();
|
|
|
|
|
|
|
|
LChartALL.Title.Align = ChartTitleAlignment.TopCenter;
|
|
|
|
|
|
|
|
LChartALL.ChartRenderOptions.DeviceType = RendererDeviceType.AutoPreferD11;
|
|
|
|
|
|
|
|
LChartALL.ChartRenderOptions.LineAAType2D = LineAntiAliasingType.QLAA;
|
|
|
|
|
|
|
|
|
|
|
|
LChartALL.Title.Text = "事件波形";
|
|
|
|
LChartALL.Title.Text = "事件波形";
|
|
|
|
LChartALL.Title.Color = Colors.Black;
|
|
|
|
// LChartALL.Title.Color = Colors.Red;
|
|
|
|
LChartALL.Title.Shadow.DropColor = Colors.Transparent;
|
|
|
|
|
|
|
|
LChartALL.Title.Shadow.ContrastColor = Colors.Transparent;
|
|
|
|
|
|
|
|
LChartALL.Title.Font = new WpfFont("等线", 20);
|
|
|
|
LChartALL.Title.Font = new WpfFont("等线", 20);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//轴属性和布局
|
|
|
|
LChartALL.ViewXY.AxisLayout.YAxesLayout = YAxesLayout.Stacked;
|
|
|
|
LChartALL.ViewXY.AxisLayout.YAxesLayout = YAxesLayout.Stacked;
|
|
|
|
|
|
|
|
|
|
|
|
LChartALL.ViewXY.AxisLayout.SegmentsGap = 0;
|
|
|
|
LChartALL.ViewXY.AxisLayout.SegmentsGap = 0;
|
|
|
|
LChartALL.ViewXY.ZoomPanOptions.PanDirection = PanDirection.Horizontal;
|
|
|
|
LChartALL.ViewXY.ZoomPanOptions.PanDirection = PanDirection.Horizontal;
|
|
|
|
LChartALL.ViewXY.ZoomPanOptions.WheelZooming = WheelZooming.Horizontal;
|
|
|
|
LChartALL.ViewXY.ZoomPanOptions.WheelZooming = WheelZooming.Horizontal;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.AllLeft;
|
|
|
|
//背景颜色
|
|
|
|
LChartALL.ViewXY.AxisLayout.YAxisTitleAutoPlacement = true;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.AxisLayout.AutoAdjustMargins = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LChartALL.ViewXY.ZoomPanOptions.DevicePrimaryButtonAction = UserInteractiveDeviceButtonAction.None;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.ZoomPanOptions.DeviceSecondaryButtonAction = UserInteractiveDeviceButtonAction.None;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.ZoomPanOptions.WheelZooming = WheelZooming.Off;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//X轴设置
|
|
|
|
|
|
|
|
LChartALL.ViewXY.XAxes[0].AllowScrolling = false;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.XAxes[0].PanningEnabled = false;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.XAxes[0].SweepingGap = 0;
|
|
|
|
|
|
|
|
// LChartALL.ViewXY.XAxes[0].ValueType = AxisValueType.Number;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.XAxes[0].AutoFormatLabels = false;
|
|
|
|
|
|
|
|
// LChartALL.ViewXY.XAxes[0].LabelsNumberFormat = "N0";
|
|
|
|
|
|
|
|
// LChartALL.ViewXY.XAxes[0].MajorGrid.Pattern = LinePattern.Solid;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//图表背景颜色
|
|
|
|
LChartALL.ViewXY.GraphBackground.Color = Colors.White;
|
|
|
|
LChartALL.ViewXY.GraphBackground.Color = Colors.White;
|
|
|
|
LChartALL.ViewXY.GraphBackground.GradientFill = GradientFill.Solid;
|
|
|
|
//LChartALL.ViewXY.GraphBackground.GradientFill = GradientFill.Solid;
|
|
|
|
LChartALL.ViewXY.GraphBackground.GradientColor = Colors.White;
|
|
|
|
LChartALL.ViewXY.GraphBackground.GradientColor = Colors.White;
|
|
|
|
LChartALL.ChartBackground.GradientFill = GradientFill.Solid;
|
|
|
|
LChartALL.ChartBackground.GradientFill = GradientFill.Solid;
|
|
|
|
LChartALL.ChartBackground.Color = Color.FromArgb(0, 0, 0, 0);
|
|
|
|
LChartALL.ChartBackground.Color = Color.FromArgb(0, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
GridChart = new Grid();
|
|
|
|
GridChart = new Grid();
|
|
|
|
GridChart.ColumnDefinitions.Add(new ColumnDefinition());
|
|
|
|
GridChart.ColumnDefinitions.Add(new ColumnDefinition());
|
|
|
|
GridChart.Name = "chartGrid";
|
|
|
|
GridChart.Name = "chartGrid";
|
|
|
@ -523,130 +292,171 @@ namespace mseedChart.MainModule.ViewModels
|
|
|
|
|
|
|
|
|
|
|
|
this.ChildContent = GridChart;
|
|
|
|
this.ChildContent = GridChart;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void CreateGridChartDieJia()
|
|
|
|
private void ShowWave(string filePath, string obj = "2023-03-29T06:41:21.348")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (LChartALL != null)
|
|
|
|
string EventTimeStr = obj;
|
|
|
|
|
|
|
|
string datePath = EventTimeStr.Substring(0, 4) + EventTimeStr.Substring(5, 2) + EventTimeStr.Substring(8, 2);
|
|
|
|
|
|
|
|
string dataFilePath = RegionNames.MseedFilePath + "\\" + datePath + "\\";
|
|
|
|
|
|
|
|
string dataFileName = "HA." + EventTimeStr.Substring(0, 4) + EventTimeStr.Substring(5, 2)
|
|
|
|
|
|
|
|
+ EventTimeStr.Substring(8, 2) + EventTimeStr.Substring(10, 3)
|
|
|
|
|
|
|
|
+ EventTimeStr.Substring(14, 2) + EventTimeStr.Substring(17, 2) + ".01" + RegionNames.DataTypeString;
|
|
|
|
|
|
|
|
string mseedStr = ".mseed";
|
|
|
|
|
|
|
|
string asciiSavePath = RegionNames.TxtFilePath + "\\" + datePath + "\\" + dataFileName + ".txt";
|
|
|
|
|
|
|
|
if (filePath != null) asciiSavePath = filePath;
|
|
|
|
|
|
|
|
if (!Directory.Exists(dataFilePath))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LChartALL = null;
|
|
|
|
Directory.CreateDirectory(dataFilePath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Directory.Exists(Path.GetDirectoryName(asciiSavePath)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Directory.CreateDirectory(Path.GetDirectoryName(asciiSavePath));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LChartALL = new LightningChart();
|
|
|
|
|
|
|
|
LChartALL.Title.Text = "叠加";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GridChart = new Grid();
|
|
|
|
|
|
|
|
GridChart.ColumnDefinitions.Add(new ColumnDefinition());
|
|
|
|
|
|
|
|
GridChart.Name = "chartGrid";
|
|
|
|
|
|
|
|
GridChart.Children.Add(LChartALL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.ChildContent = GridChart;
|
|
|
|
if (!File.Exists(asciiSavePath))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MSeed2Asc(dataFilePath + dataFileName + mseedStr, asciiSavePath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdateWavesFromTxt(asciiSavePath);
|
|
|
|
|
|
|
|
_channelCount = smList.Count * 3;
|
|
|
|
|
|
|
|
UpdateChart();
|
|
|
|
|
|
|
|
UpdateChartData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void CreateGridChartFenLei()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void UpdateChart()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LChartZ = new LightningChart();
|
|
|
|
|
|
|
|
LChartALL.Title.Text = "Z";
|
|
|
|
DisposeAllAndClear(LChartALL.ViewXY.YAxes);
|
|
|
|
LChartZ.SetValue(Grid.ColumnProperty, 0);
|
|
|
|
DisposeAllAndClear(LChartALL.ViewXY.SampleDataSeries);
|
|
|
|
|
|
|
|
|
|
|
|
LChartE = new LightningChart();
|
|
|
|
LChartALL.ViewXY.YAxes.AddRange(_wavesModel.CreateYAxisChart(smList, LChartALL));
|
|
|
|
LChartALL.Title.Text = "E";
|
|
|
|
int seriesIndex = 0;
|
|
|
|
LChartE.SetValue(Grid.ColumnProperty, 1);
|
|
|
|
foreach (var axisY in LChartALL.ViewXY.YAxes)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
axisY.LabelsColor = Colors.Black;
|
|
|
|
|
|
|
|
// axisY.AxisColor = Colors.Black;
|
|
|
|
|
|
|
|
axisY.Title.Shadow.DropColor = Colors.Transparent;
|
|
|
|
|
|
|
|
axisY.Title.Shadow.ContrastColor = Colors.Transparent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
axisY.AllowAutoYFit = false;
|
|
|
|
|
|
|
|
axisY.Units.Visible = false;
|
|
|
|
|
|
|
|
axisY.LabelsAngle = 0;
|
|
|
|
|
|
|
|
axisY.LabelsFont.Size = 8;
|
|
|
|
|
|
|
|
axisY.Title.Angle = 0;
|
|
|
|
|
|
|
|
axisY.MajorGrid.Visible = true;
|
|
|
|
|
|
|
|
axisY.MinorGrid.Visible = false;
|
|
|
|
|
|
|
|
axisY.MajorGrid.Pattern = LinePattern.Solid;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
axisY.AutoDivSpacing = false;
|
|
|
|
|
|
|
|
// axisY.AutoDivSeparationPercent = 100;
|
|
|
|
|
|
|
|
axisY.Visible = true;
|
|
|
|
|
|
|
|
// axisY.MajorDiv = 1;
|
|
|
|
|
|
|
|
axisY.MajorDivCount = 2;
|
|
|
|
|
|
|
|
axisY.MajorDivTickStyle.Visible = true;
|
|
|
|
|
|
|
|
axisY.MinorDivTickStyle.Visible = false;
|
|
|
|
|
|
|
|
axisY.MajorDivTickStyle.Alignment = seriesIndex % 2 == 0 ? Alignment.Near : Alignment.Far;
|
|
|
|
|
|
|
|
axisY.MajorDivTickStyle.LineLength = 6;
|
|
|
|
|
|
|
|
axisY.MajorDivTickStyle.Color = Colors.Black;
|
|
|
|
|
|
|
|
axisY.Title.Color = Colors.Black;
|
|
|
|
|
|
|
|
axisY.Title.Font = new WpfFont("Segoe UI", 10, false, false);
|
|
|
|
|
|
|
|
// axisY.Title.HorizontalAlign = seriesIndex % 2 == 0 ? YAxisTitleAlignmentHorizontal.Left : YAxisTitleAlignmentHorizontal.Right;
|
|
|
|
|
|
|
|
axisY.PanningEnabled = false;
|
|
|
|
|
|
|
|
axisY.AllowScrolling = false;
|
|
|
|
|
|
|
|
axisY.AllowScaling = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
seriesIndex++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LChartN = new LightningChart();
|
|
|
|
LChartALL.ViewXY.LegendBoxes[0].Position = LegendBoxPositionXY.RightCenter;
|
|
|
|
LChartALL.Title.Text = "N";
|
|
|
|
LChartALL.ViewXY.LegendBoxes[0].Offset.SetValues(-10, 180);
|
|
|
|
LChartN.SetValue(Grid.ColumnProperty, 2);
|
|
|
|
LChartALL.ViewXY.LegendBoxes[0].Layout = LegendBoxLayout.Vertical;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.LegendBoxes[0].ShowIcons = false;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.AutoSpaceLegendBoxes = true;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.AxisLayout.SegmentsGap = 3;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.LegendBoxes[0].Shadow.Visible =false;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.XAxes[0].Maximum = CurPoints / _samplingFrequency;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.XAxes[0].LabelsColor = Colors.Black;
|
|
|
|
|
|
|
|
|
|
|
|
GridChart = new Grid();
|
|
|
|
LChartALL.ViewXY.SampleDataSeries.AddRange(
|
|
|
|
GridChart.ColumnDefinitions.Add(new ColumnDefinition());
|
|
|
|
_wavesModel.GetSampleDataSeriesPingPu(smList, LChartALL, LChartALL.ViewXY.XAxes[0],
|
|
|
|
GridChart.ColumnDefinitions.Add(new ColumnDefinition());
|
|
|
|
LChartALL.ViewXY.YAxes, _samplingFrequency));
|
|
|
|
GridChart.ColumnDefinitions.Add(new ColumnDefinition());
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateChartData()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
double[][] multiChannelData = new double[smList.Count * 3][];
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (int channelIndex = 0; channelIndex < smList.Count; channelIndex++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
multiChannelData[channelIndex * 3] = smList[channelIndex].dz.ToArray();
|
|
|
|
|
|
|
|
multiChannelData[channelIndex * 3 + 1] = smList[channelIndex].dn.ToArray();
|
|
|
|
|
|
|
|
multiChannelData[channelIndex * 3 + 2] = smList[channelIndex].de.ToArray();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Invoke FeedNewDataToChart.
|
|
|
|
|
|
|
|
_dispatcher.Invoke(() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
FeedNewDataToChar(multiChannelData);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw ex;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GridChart.Name = "chartGrid";
|
|
|
|
private void ApplicationClosingDispose(object sender, CancelEventArgs e)
|
|
|
|
GridChart.Children.Add(LChartZ);
|
|
|
|
{
|
|
|
|
GridChart.Children.Add(LChartE);
|
|
|
|
if (LChartALL != null)
|
|
|
|
GridChart.Children.Add(LChartN);
|
|
|
|
{
|
|
|
|
this.ChildContent = GridChart;
|
|
|
|
LChartALL.Dispose();
|
|
|
|
|
|
|
|
LChartALL = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void InitData()
|
|
|
|
|
|
|
|
|
|
|
|
private void DisposeAllAndClear<T>(List<T> list) where T : IDisposable
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LChartALL.ViewXY.YAxes = new AxisYCollection();
|
|
|
|
if (list == null)
|
|
|
|
LChartALL.ViewXY.YAxes.Clear();
|
|
|
|
|
|
|
|
RegionNames.StationDic= RegionNames.CreateStationFromCSV(AppDomain.CurrentDomain.BaseDirectory + @"resources/N3102_staion_20230312.txt");
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes.AddRange(_wavesModel.CreateYAxisPingPu(RegionNames.StationDic, LChartALL));
|
|
|
|
|
|
|
|
for (int i = 0; i < LChartALL.ViewXY.YAxes.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LChartALL.ViewXY.YAxes[i].LabelsColor = Colors.Black;
|
|
|
|
return;
|
|
|
|
LChartALL.ViewXY.YAxes[i].AxisColor = Colors.Black;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes[i].GridStripColor = Colors.Black;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes[i].Title.Color = Colors.Black;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes[i].Title.Shadow.DropColor = Colors.Transparent;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes[i].Title.Shadow.ContrastColor = Colors.Transparent;
|
|
|
|
|
|
|
|
LChartALL.ViewXY.YAxes[i].Title.Font = new WpfFont("Calibri", 12);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LChartALL.ViewXY.XAxes = new AxisXCollection();
|
|
|
|
|
|
|
|
LChartALL.ViewXY.XAxes.Add(_wavesModel.GetAxisX(CurPoints / Sampling));
|
|
|
|
|
|
|
|
LChartALL.ViewXY.XAxes[0].LabelsColor = Colors.Black;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LChartALL.ViewXY.SampleDataSeries = new SampleDataSeriesCollection();
|
|
|
|
while (list.Count > 0)
|
|
|
|
LChartALL.ViewXY.SampleDataSeries.AddRange(
|
|
|
|
{
|
|
|
|
_wavesModel.GetSampleDataSeriesPingPu(RegionNames.StationDic, LChartALL, LChartALL.ViewXY.XAxes[0],
|
|
|
|
int lastInd = list.Count - 1;
|
|
|
|
LChartALL.ViewXY.YAxes, _samplingFrequency));
|
|
|
|
T item = list[lastInd]; // take item ref from list.
|
|
|
|
//string mseedPath = FileDataPath + "\\" + StartTime.Year.ToString("D2");
|
|
|
|
list.RemoveAt(lastInd); // remove item first
|
|
|
|
//Console.WriteLine(mseedPath);
|
|
|
|
if (item != null)
|
|
|
|
//Start();
|
|
|
|
{
|
|
|
|
|
|
|
|
(item as IDisposable).Dispose(); // then dispose it.
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
gridChart.Children.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (LChartALL != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
LChartALL.Dispose();
|
|
|
|
|
|
|
|
LChartALL = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void FeedNewDataToChartPingPu(double[][] data)
|
|
|
|
|
|
|
|
|
|
|
|
private void FeedNewDataToChar(double[][] data)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LChartALL.BeginUpdate();
|
|
|
|
LChartALL.BeginUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_wavesModel.CreateAxisYEventTime(EventTime, LChartALL.ViewXY);
|
|
|
|
for (int channelIndex = 0; channelIndex < _channelCount; channelIndex++)
|
|
|
|
for (int channelIndex = 0; channelIndex < _channelCount; channelIndex++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LChartALL.ViewXY.SampleDataSeries[channelIndex].AddSamples(data[channelIndex], true);
|
|
|
|
LChartALL.ViewXY.SampleDataSeries[channelIndex].AddSamples(data[channelIndex], true);
|
|
|
|
//LChartALL.ViewXY.YAxes[channelIndex].Minimum = data[channelIndex].Min();
|
|
|
|
|
|
|
|
//LChartALL.ViewXY.YAxes[channelIndex].Maximum = data[channelIndex].Max();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// _previousX = (double)_samplesOutput / _samplingFrequency;
|
|
|
|
|
|
|
|
|
|
|
|
_previousX = (double)_samplesOutput / _samplingFrequency;
|
|
|
|
// LChartALL.ViewXY.XAxes[0].ScrollPosition = _previousX;
|
|
|
|
|
|
|
|
|
|
|
|
LChartALL.ViewXY.XAxes[0].ScrollPosition = _previousX;
|
|
|
|
|
|
|
|
LChartALL.EndUpdate();
|
|
|
|
LChartALL.EndUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 波形组合
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public enum WavesCombinationEnum
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
平铺 = 0,
|
|
|
|
|
|
|
|
叠加,
|
|
|
|
|
|
|
|
分类
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 波形类型
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public enum DataTypeEnum
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
原始数据 = 0,
|
|
|
|
|
|
|
|
事件数据
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 数据来源
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public enum DataSourcesEnum
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
文件 = 0,
|
|
|
|
|
|
|
|
数据库
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 显示模式
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public enum DisplayModeEnum
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
自动 = 0,
|
|
|
|
|
|
|
|
手动
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum ScollModeEnum
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Scrolling = 0,
|
|
|
|
|
|
|
|
Stepping
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|