diff --git a/WpfApp1/App.config b/WpfApp1/App.config new file mode 100644 index 0000000..016d28f --- /dev/null +++ b/WpfApp1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WpfApp1/App.xaml b/WpfApp1/App.xaml new file mode 100644 index 0000000..2e70522 --- /dev/null +++ b/WpfApp1/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/WpfApp1/App.xaml.cs b/WpfApp1/App.xaml.cs new file mode 100644 index 0000000..d58ebfa --- /dev/null +++ b/WpfApp1/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace WpfApp1 +{ + /// + /// App.xaml 的交互逻辑 + /// + public partial class App : Application + { + } +} diff --git a/WpfApp1/MainWindow.xaml b/WpfApp1/MainWindow.xaml new file mode 100644 index 0000000..1534e78 --- /dev/null +++ b/WpfApp1/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/WpfApp1/MainWindow.xaml.cs b/WpfApp1/MainWindow.xaml.cs new file mode 100644 index 0000000..4a4aa8c --- /dev/null +++ b/WpfApp1/MainWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace WpfApp1 +{ + /// + /// MainWindow.xaml 的交互逻辑 + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/WpfApp1/Properties/AssemblyInfo.cs b/WpfApp1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9fa2f3e --- /dev/null +++ b/WpfApp1/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WpfApp1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WpfApp1")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +//若要开始生成可本地化的应用程序,请设置 +//.csproj 文件中的 CultureYouAreCodingWith +//例如,如果您在源文件中使用的是美国英语, +//使用的是美国英语,请将 设置为 en-US。 然后取消 +//对以下 NeutralResourceLanguage 特性的注释。 更新 +//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //主题特定资源词典所处位置 + //(未在页面中找到资源时使用, + //或应用程序资源字典中找到时使用) + ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 + //(未在页面中找到资源时使用, + //、应用程序或任何主题专用资源字典中找到时使用) +)] + + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WpfApp1/Properties/Resources.Designer.cs b/WpfApp1/Properties/Resources.Designer.cs new file mode 100644 index 0000000..3abd32b --- /dev/null +++ b/WpfApp1/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WpfApp1.Properties +{ + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfApp1.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/WpfApp1/Properties/Resources.resx b/WpfApp1/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/WpfApp1/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WpfApp1/Properties/Settings.Designer.cs b/WpfApp1/Properties/Settings.Designer.cs new file mode 100644 index 0000000..6512fd0 --- /dev/null +++ b/WpfApp1/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WpfApp1.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/WpfApp1/Properties/Settings.settings b/WpfApp1/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/WpfApp1/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/WpfApp1/WpfApp1.csproj b/WpfApp1/WpfApp1.csproj new file mode 100644 index 0000000..94ed4bc --- /dev/null +++ b/WpfApp1/WpfApp1.csproj @@ -0,0 +1,102 @@ + + + + + Debug + AnyCPU + {92B5468F-C7FF-4295-A8D1-BE9B117C2287} + WinExe + WpfApp1 + WpfApp1 + v4.7 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\Toolbox\Wpf\Arction.Wpf.Charting.LightningChart.dll + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + \ No newline at end of file diff --git a/help.txt b/help.txt new file mode 100644 index 0000000..bb8f589 --- /dev/null +++ b/help.txt @@ -0,0 +1 @@ +FreeformPointLineSeries 可以从前一个点向任意方向绘制线点。 \ No newline at end of file diff --git a/mseedChart.Core/RegionNames.cs b/mseedChart.Core/RegionNames.cs new file mode 100644 index 0000000..dd95fd4 --- /dev/null +++ b/mseedChart.Core/RegionNames.cs @@ -0,0 +1,10 @@ +using System; + +namespace mseedChart.Core +{ + public static class RegionNames + { + public const string ContentRegion = "ContentRegion"; + } + +} diff --git a/mseedChart.Core/mseedChart.Core.csproj b/mseedChart.Core/mseedChart.Core.csproj new file mode 100644 index 0000000..8ef8970 --- /dev/null +++ b/mseedChart.Core/mseedChart.Core.csproj @@ -0,0 +1,8 @@ + + + + netstandard2.1 + enable + + + diff --git a/mseedChart.Main/MainModule.cs b/mseedChart.Main/MainModule.cs new file mode 100644 index 0000000..72dde9d --- /dev/null +++ b/mseedChart.Main/MainModule.cs @@ -0,0 +1,25 @@ +using mseedChart.Core; +using mseedChart.Main.ViewModels; +using mseedChart.Main.Views; +using Prism.Ioc; +using Prism.Modularity; +using Prism.Regions; + +namespace mseedChart.Main +{ + public class MainModule : IModule + { + public void OnInitialized(IContainerProvider containerProvider) + { + var regionManager = containerProvider.Resolve(); + regionManager.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(ViewA)); + } + + public void RegisterTypes(IContainerRegistry containerRegistry) + { + containerRegistry.Register(); + containerRegistry.RegisterSingleton(); + + } + } +} \ No newline at end of file diff --git a/mseedChart.Main/Models/LineDatas.cs b/mseedChart.Main/Models/LineDatas.cs new file mode 100644 index 0000000..b48f279 --- /dev/null +++ b/mseedChart.Main/Models/LineDatas.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace mseedChart.Main.Models +{ + public class LineDatas + { + private string lable; + + public string Lable + { + get { return lable; } + set { lable = value; } + } + + private string color; + + public string Color + { + get { return color; } + set { color = value; } + } + + private double smoothTension; + + public double SmoothTension + { + get { return smoothTension; } + set { smoothTension = value; } + } + + private double[] xData; + + public double[] XData + { + get { return xData; } + set { xData = value; } + } + + private double[] yData; + + public double[] YData + { + get { return yData; } + set { yData = value; } + } + } + +} diff --git a/mseedChart.Main/ViewModels/ChartPlotViewModel.cs b/mseedChart.Main/ViewModels/ChartPlotViewModel.cs new file mode 100644 index 0000000..4f510a4 --- /dev/null +++ b/mseedChart.Main/ViewModels/ChartPlotViewModel.cs @@ -0,0 +1,49 @@ +using mseedChart.Main.Models; +using Prism.Regions; +using ScottPlot; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Timers; +using System.Windows.Input; +using System.Windows.Shapes; + +namespace mseedChart.Main.ViewModels +{ + public class ChartPlotViewModel + { + public Action> InializeChartPlotChange; + public Action> PlotLineDataChanged; + public ChartPlotViewModel() + { + } + + public void PlotDataDemo() + { + // 生成 10天数据 + int pointCount = 10000; + double[] days = new double[pointCount]; + DateTime day1 = new DateTime(1890, 09, 24); + for (int i = 0; i < days.Length; i++) + days[i] = day1.AddDays(i).ToOADate(); + List lines = new List(); + Random random = new Random(10); + for (int i = 0; i < 3; i++) + { + lines.Add(new LineDatas + { + Lable = "line" + i, + SmoothTension = 1.0f, + YData = DataGen.RandomWalk(random, pointCount, 100), + XData = days + }); ; + } + InializeChartPlotChange?.Invoke(lines); + } + + } +} diff --git a/mseedChart.Main/ViewModels/ViewAViewModel.cs b/mseedChart.Main/ViewModels/ViewAViewModel.cs new file mode 100644 index 0000000..dd3fada --- /dev/null +++ b/mseedChart.Main/ViewModels/ViewAViewModel.cs @@ -0,0 +1,95 @@ +using mseedChart.Main.Models; +using mseedChart.Main.Views; +using Prism.Commands; +using Prism.Mvvm; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Timers; + +namespace mseedChart.Main.ViewModels +{ + public class ViewAViewModel : BindableBase + { + public ViewAViewModel(ChartPlotViewModel chartPlotViewModel) + { + this._chartPlotViewModel = chartPlotViewModel; + Message = "View A from your Prism Module"; + Timer time = new Timer(1000); + time.Elapsed += Time_Elapsed; + time.Start(); + + } + private string _message; + private ChartPlotViewModel _chartPlotViewModel; + private BlockingCollection> queueDatas = new BlockingCollection>(100); + + public string Message + { + get { return _message; } + set { SetProperty(ref _message, value); } + } + public DelegateCommand LoadedCommand => new(Loaded); + + List lines = new List(); + private void Loaded(object obj) + { + var chart = obj as ChartPlotView; + _chartPlotViewModel = chart.DataContext as ChartPlotViewModel; + DirectoryInfo root = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "data"); + FileInfo[] files = root.GetFiles(); + List SHE = new List(); + int step = 500; + for (int i = 0; i < 24; i++) + { + foreach (var file in files) + { + SHE = File.ReadAllLines(file.FullName).ToList(); + //第一个非数据移除掉 + SHE.RemoveAt(0); + var data = SHE.Select(x => Convert.ToDouble(x)+step*i); + lines.Add(new LineDatas + { + Lable = "line" + file.Name, + YData = data.ToArray(), + // XData = DateTime.Now.ToOADate() + }); + + } + } + _chartPlotViewModel.InializeChartPlotChange?.Invoke(lines); + Task.Run(() => + { + while (true) + { + + var data = lines.Select(x => x.YData).ToList(); + for (int i = 0; i < 4; i++) + { + List values = new List(); + foreach (var item in data) + { + var SH= item.Skip(i * 500).Take(500).ToArray(); + values.Add(SH); + } + queueDatas.Add(values); + } + Debug.WriteLine("start:{0}",DateTime.Now); + System.Threading.Thread.Sleep(100); + } + }); + } + + private void Time_Elapsed(object sender, ElapsedEventArgs e) + { + + _chartPlotViewModel.PlotLineDataChanged?.Invoke(queueDatas.Take()); + } + } +} diff --git a/mseedChart.Main/Views/ChartPlotView.xaml b/mseedChart.Main/Views/ChartPlotView.xaml new file mode 100644 index 0000000..be62c27 --- /dev/null +++ b/mseedChart.Main/Views/ChartPlotView.xaml @@ -0,0 +1,15 @@ + + + + + 轴自适应 + + diff --git a/mseedChart.Main/Views/ChartPlotView.xaml.cs b/mseedChart.Main/Views/ChartPlotView.xaml.cs new file mode 100644 index 0000000..157a4af --- /dev/null +++ b/mseedChart.Main/Views/ChartPlotView.xaml.cs @@ -0,0 +1,207 @@ +using ScottPlot.Plottable; +using ScottPlot; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Drawing; +using System.Reflection; +using System.Windows.Threading; +using Microsoft.Win32; +using System.Windows.Media.Imaging; +using mseedChart.Main.Models; +using mseedChart.Main.ViewModels; +using System.Security; + +namespace mseedChart.Main.Views +{ + /// + /// ChartPlot.xaml 的交互逻辑 + /// + public partial class ChartPlotView : UserControl + { + public DispatcherTimer _renderTimer = new DispatcherTimer(); + //非定时更新需停止定时器 + List scatterPlots = new List(); + //每天生成的最大点数*1天 + const int MaxPointCount = 30_000; + int nextDataIndex = 1; + WpfPlot pl; + public ChartPlotView() + { + InitializeComponent(); + //去掉右键菜单 + plt.RightClicked-=plt.DefaultRightClickEvent; + // plt.RightClicked+= RightClickEvent; + + var model = this.DataContext as ChartPlotViewModel; + model.InializeChartPlotChange = InializeChartPlotDates; + model.PlotLineDataChanged = PlotLineLiveData; + plt.Plot.Palette = new ScottPlot.Palettes.ColorblindFriendly(); + // plt.Configuration.LockVerticalAxis = true; + List lineLabels; + + lineLabels = new List(); + for (int i = 0; i < 72; i++) + { + lineLabels.Add(i.ToString()); + } + foreach (var item in lineLabels) + { + double[] data = new double[MaxPointCount]; + var line = plt.Plot.AddSignal(data); + line.Label = item; + // line.Smooth = true; + // line.SmoothTension = 0.6f; + scatterPlots.Add(line); + } + plt.Refresh(); + + plt.Plot.XAxis.Color(Color.Black); + plt.Plot.Legend(enable: false); + + // plt.Plot.Legend( false,location: Alignment.MiddleLeft); + //X轴显示格式 + // plt.Plot.XAxis.TickLabelFormat("yyyy-MM-dd HH:mm:ss", dateTimeFormat: true); + _renderTimer.Interval = TimeSpan.FromMilliseconds(1000); + _renderTimer.Tick += Render; + _renderTimer.Start(); + } + void Render(object sender, EventArgs e) + { + if (AutoAxisCbox.IsChecked == true) + { + plt.Plot.AxisAuto(); + } + plt.Refresh(); + } + int index = 1; + void PlotLineLiveData(List runData) + { + int number = runData[0].Length; + + + for (int i = 0; i < scatterPlots.Count; i++) //数组平移 + { + // Array.Copy(scatterPlots[i].Xs, 1, scatterPlots[i].Xs, 0, scatterPlots[i].Xs.Length - 1); + Array.Copy(scatterPlots[i].Ys, number, scatterPlots[i].Ys, 0, scatterPlots[i].Ys.Length - number); + + Array.Copy(runData[i], 0, scatterPlots[i].Ys, scatterPlots[i].Ys.Length - number, number); + } + } + void InializeChartPlotDates(List lineDatas) + { + nextDataIndex = lineDatas[0].YData.Length; + for (int i = 0; i < scatterPlots.Count; i++) + { + if (nextDataIndex <= MaxPointCount) + { + //内存拷贝 + Array.Copy(lineDatas[i].YData, scatterPlots[i].Ys, nextDataIndex); + scatterPlots[i].MaxRenderIndex = nextDataIndex-1; + } + else + { + // scatterPlots[i].OffsetX = lineDatas[0].XData[nextDataIndex - MaxPointCount]; // Set start date + // Array.Copy(lineDatas[i].XData, nextDataIndex - MaxPointCount, scatterPlots[i].Xs, 0, MaxPointCount); + Array.Copy(lineDatas[i].YData, nextDataIndex - MaxPointCount, scatterPlots[i].Ys, 0, MaxPointCount); + scatterPlots[i].MaxRenderIndex = MaxPointCount-1; + } + } + nextDataIndex = nextDataIndex < MaxPointCount ? nextDataIndex: MaxPointCount; //最大不能超过 MaxPointCount + // plt.Plot.AxisAuto(); + // plt.Refresh(); + } + + private void OnMouseMove(object sender, MouseEventArgs e) + { + int pixelX = (int)e.MouseDevice.GetPosition(plt).X; + int pixelY = (int)e.MouseDevice.GetPosition(plt).Y; + + (double coordinateX, double coordinateY) = plt.GetMouseCoordinates(); + + plt.Refresh(); + } + + private void wpfPlot1_MouseEnter(object sender, MouseEventArgs e) + { + // MouseTrackLabel.Content = "Mouse ENTERED the plot"; + // Crosshair.IsVisible = true; + } + + private void wpfPlot1_MouseLeave(object sender, MouseEventArgs e) + { + //MouseTrackLabel.Content = "Mouse LEFT the plot"; + //XPixelLabel.Content = "--"; + //YPixelLabel.Content = "--"; + //XCoordinateLabel.Content = "--"; + //YCoordinateLabel.Content = "--"; + + // Crosshair.IsVisible = false; + // plt.Refresh(); + } + + public void RightClickEvent(object sender, EventArgs e) + { + var cm = new ContextMenu(); + + MenuItem SaveImageMenuItem = new() { Header = "保存图片" }; + SaveImageMenuItem.Click += RightClickMenu_SaveImage_Click; + cm.Items.Add(SaveImageMenuItem); + + MenuItem CopyImageMenuItem = new() { Header = "复制图片" }; + CopyImageMenuItem.Click += RightClickMenu_Copy_Click; + cm.Items.Add(CopyImageMenuItem); + + MenuItem AutoAxisMenuItem = new() { Header = "自适应数据" }; + AutoAxisMenuItem.Click += RightClickMenu_AutoAxis_Click; + cm.Items.Add(AutoAxisMenuItem); + cm.IsOpen = true; + } + + #region 右键菜单 + private void RightClickMenu_Copy_Click(object sender, EventArgs e) => System.Windows.Clipboard.SetImage(BmpImageFromBmp(plt.Plot.Render())); + // private void RightClickMenu_Help_Click(object sender, EventArgs e) => new WPF.HelpWindow().Show(); + // private void RightClickMenu_OpenInNewWindow_Click(object sender, EventArgs e) => new WpfPlotViewer(plt.Plot).Show(); + private void RightClickMenu_AutoAxis_Click(object sender, EventArgs e) { plt.Plot.AxisAuto(); plt.Refresh(); } + private void RightClickMenu_SaveImage_Click(object sender, EventArgs e) + { + var sfd = new SaveFileDialog + { + FileName = "ScottPlot.png", + Filter = "PNG Files (*.png)|*.png;*.png" + + "|JPG Files (*.jpg, *.jpeg)|*.jpg;*.jpeg" + + "|BMP Files (*.bmp)|*.bmp;*.bmp" + + "|All files (*.*)|*.*" + }; + + if (sfd.ShowDialog() is true) + plt.Plot.SaveFig(sfd.FileName); + } + private static BitmapImage BmpImageFromBmp(System.Drawing.Bitmap bmp) + { + using var memory = new System.IO.MemoryStream(); + bmp.Save(memory, System.Drawing.Imaging.ImageFormat.Png); + memory.Position = 0; + + var bitmapImage = new BitmapImage(); + bitmapImage.BeginInit(); + bitmapImage.StreamSource = memory; + bitmapImage.CacheOption = BitmapCacheOption.OnLoad; + bitmapImage.EndInit(); + bitmapImage.Freeze(); + + return bitmapImage; + } + + #endregion + } +} diff --git a/mseedChart.Main/Views/ViewA.xaml b/mseedChart.Main/Views/ViewA.xaml new file mode 100644 index 0000000..005fb76 --- /dev/null +++ b/mseedChart.Main/Views/ViewA.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + diff --git a/mseedChart.Main/Views/ViewA.xaml.cs b/mseedChart.Main/Views/ViewA.xaml.cs new file mode 100644 index 0000000..037039f --- /dev/null +++ b/mseedChart.Main/Views/ViewA.xaml.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace mseedChart.Main.Views +{ + /// + /// Interaction logic for ViewA.xaml + /// + public partial class ViewA : UserControl + { + public ViewA() + { + InitializeComponent(); + } + + } +} diff --git a/mseedChart.Main/mseedChart.Main.csproj b/mseedChart.Main/mseedChart.Main.csproj new file mode 100644 index 0000000..37334df --- /dev/null +++ b/mseedChart.Main/mseedChart.Main.csproj @@ -0,0 +1,19 @@ + + + net5.0-windows + true + + + + + + + + + + + + C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\Toolbox\Wpf\Arction.Wpf.Charting.LightningChart.dll + + + \ No newline at end of file diff --git a/mseedChart.MainModule/MainModule.cs b/mseedChart.MainModule/MainModule.cs new file mode 100644 index 0000000..627c8ad --- /dev/null +++ b/mseedChart.MainModule/MainModule.cs @@ -0,0 +1,25 @@ +using mseedChart.Core; +using mseedChart.MainModule.ViewModels; +using mseedChart.MainModule.Views; +using Prism.Ioc; +using Prism.Modularity; +using Prism.Regions; + +namespace mseedChart.MainModule +{ + public class MainModule : IModule + { + public void OnInitialized(IContainerProvider containerProvider) + { + var regionManager = containerProvider.Resolve(); + regionManager.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(ChartPlotView)); + } + + public void RegisterTypes(IContainerRegistry containerRegistry) + { + containerRegistry.Register(); + containerRegistry.RegisterSingleton(); + + } + } +} \ No newline at end of file diff --git a/mseedChart.MainModule/Models/ChannelModel.cs b/mseedChart.MainModule/Models/ChannelModel.cs new file mode 100644 index 0000000..933ac8b --- /dev/null +++ b/mseedChart.MainModule/Models/ChannelModel.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace mseedChart.MainModule.Models +{ + public class ChannelModel + { + public string Name { get; set; } + + public double[] datas { get; set; } + + public void ReadDataFromTxt(string fn, int channelIndex) + { + datas = new double[30000]; + string allline; + + using (StreamReader streamReader = new StreamReader(fn)) + { + allline = streamReader.ReadToEnd(); + } + string[] strs = allline.Split(new char[] { '\n' }); + for (int i = 0; i < datas.Length; i++) + { + datas[i] = double.Parse(strs[channelIndex * 30001 + i + 1]); + } + } + } +} diff --git a/mseedChart.MainModule/Models/CoordBase.cs b/mseedChart.MainModule/Models/CoordBase.cs new file mode 100644 index 0000000..7e97e55 --- /dev/null +++ b/mseedChart.MainModule/Models/CoordBase.cs @@ -0,0 +1,74 @@ +#region 程序集 Txgy.Microseismic.BaseLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// E:\mingzf\txgy\Txgy.EWS\Client\output\Txgy.Microseismic.BaseLib.dll +// Decompiled with ICSharpCode.Decompiler 7.1.0.6543 +#endregion + +namespace mseedChart.MainModule.Models +{ + public class CoordBase + { + private double _x = 0.0; + + private double _y = 0.0; + + private double _z = 0.0; + + private double _md = 0.0; + + public double X + { + get + { + return _x; + } + set + { + _x = value; + } + } + + public double Y + { + get + { + return _y; + } + set + { + _y = value; + } + } + + public double Z + { + get + { + return _z; + } + set + { + _z = value; + } + } + + public double MD + { + get + { + return _md; + } + set + { + _md = value; + } + } + } + + public enum FocalMechanismType + { + strikeSlip, + dipSlip, + tensile, + unknown + } +} diff --git a/mseedChart.MainModule/Models/LineDatas.cs b/mseedChart.MainModule/Models/LineDatas.cs new file mode 100644 index 0000000..56b383b --- /dev/null +++ b/mseedChart.MainModule/Models/LineDatas.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace mseedChart.MainModule.Models +{ + public class LineDatas + { + private string lable; + + public string Lable + { + get { return lable; } + set { lable = value; } + } + + private string color; + + public string Color + { + get { return color; } + set { color = value; } + } + + private double smoothTension; + + public double SmoothTension + { + get { return smoothTension; } + set { smoothTension = value; } + } + + private double[] xData; + + public double[] XData + { + get { return xData; } + set { xData = value; } + } + + private double[] yData; + + public double[] YData + { + get { return yData; } + set { yData = value; } + } + } + +} diff --git a/mseedChart.MainModule/Models/MmEvent.cs b/mseedChart.MainModule/Models/MmEvent.cs new file mode 100644 index 0000000..b189292 --- /dev/null +++ b/mseedChart.MainModule/Models/MmEvent.cs @@ -0,0 +1,355 @@ +#region 程序集 Txgy.Microseismic.BaseLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +// E:\mingzf\txgy\Txgy.EWS\Client\output\Txgy.Microseismic.BaseLib.dll +// Decompiled with ICSharpCode.Decompiler 7.1.0.6543 +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace mseedChart.MainModule.Models +{ + public class MmEvent : CoordBase + { + private bool isShow; + + public int MoniID = 0; + + public int LayerID = 0; + + public int EventID = 0; + + private int _second; + + private int _milliSecond; + + private DateTime _eventTime; + + private double _horiError; + + private double _vertError; + + private double _cnt; + + private double _ml; + + private double _rms; + + private Dictionary _phases; + + public float[] standData; + + public float[][] nearData; + + public float minTimeDiff = 0f; + + public bool Falcone = false; + + public float errorCircularRadius = 0f; + + public float errorH = 0f; + + public int isShowed = 1; + + public float Hlen = 0f; + + public float Llen = 0f; + + public float VF = 0f; + + public List SN = new List(); + + public List PM = new List(); + + public List GCS = new List(); + + public int WorkAreaID { get; set; } = 0; + + + public bool IsShow + { + get + { + return isShow; + } + set + { + isShow = value; + } + } + + public int Second + { + get + { + return _second; + } + set + { + _second = value; + } + } + + public int Millisecond + { + get + { + return _milliSecond; + } + set + { + _milliSecond = value; + } + } + + public string EventTimeStr { get; set; } + + public DateTime EventTime + { + get + { + return _eventTime; + } + set + { + _eventTime = value; + } + } + + public double HoriError + { + get + { + return _horiError; + } + set + { + _horiError = value; + } + } + + public double VertError + { + get + { + return _vertError; + } + set + { + _vertError = value; + } + } + + public double Cnt + { + get + { + return _cnt; + } + set + { + _cnt = value; + } + } + + public double ML + { + get + { + return _ml; + } + set + { + _ml = value; + } + } + + public double RMS + { + get + { + return _rms; + } + set + { + _rms = value; + } + } + + public Dictionary Phases + { + get + { + return _phases; + } + set + { + _phases = value; + } + } + + public double Stress { get; set; } + + public double Energy { get; set; } + + public int LocSta { get; set; } + + public int MLSta { get; set; } + + public string EventTpye { get; set; } + + public int SourceChara { get; set; } + + public double Direction { get; set; } + + public double StressDrop { get; set; } + + public double DominantFreq { get; set; } + + public double MW { get; set; } + + public double Amplitude { get; set; } + + public double Semiperiod { get; set; } + + public double Coda { get; set; } + + public string JsonFile { get; set; } + + public string MseedFile { get; set; } + + public string AsciiFile { get; set; } + + public float Amp { get; set; } + + public FocalMechanismType FocalType { get; set; } + + public static void SavePos(string fn, List mMEvents) + { + StreamWriter streamWriter = new StreamWriter(fn); + try + { + if (mMEvents != null && mMEvents.Count > 0) + { + streamWriter.WriteLine(mMEvents.Count.ToString()); + List list = (from o in mMEvents + orderby o.Second, o.Millisecond + select o).ToList(); + for (int i = 0; i < list.Count; i++) + { + MmEvent mmEvent = list[i]; + streamWriter.WriteLine(Math.Round(mmEvent.X, 1) + "\t" + Math.Round(mmEvent.Y, 1) + "\t" + Math.Round(mmEvent.Z, 1) + "\t" + mmEvent.Second + "." + mmEvent.Millisecond); + } + } + } + catch (Exception) + { + throw; + } + finally + { + streamWriter.Close(); + } + } + + public static void SaveNewPin(string fn, int layerIndex, List mMEvents) + { + StreamWriter streamWriter = new StreamWriter(fn); + int num = layerIndex; + int num2 = layerIndex; + try + { + List list = (from o in mMEvents + orderby o.Second, o.Millisecond + select o).ToList(); + for (int i = 0; i < list.Count; i++) + { + MmEvent mmEvent = list[i]; + string pMStr = GetPMStr(mmEvent); + streamWriter.WriteLine(Math.Round(mmEvent.X, 1) + "\t" + Math.Round(mmEvent.Y, 1) + "\t" + Math.Round(mmEvent.Z, 1) + "\t" + mmEvent.Second + "." + mmEvent.Millisecond + "\t" + num + "\t" + num2 + "\t" + mmEvent.errorCircularRadius + "\t" + mmEvent.errorH + "\t" + 0 + "\t" + mmEvent.ML + pMStr); + } + + streamWriter.Close(); + } + catch (Exception) + { + throw; + } + finally + { + streamWriter.Close(); + } + } + + public static void SaveOldPin(string fn, int layer, List mMEvents) + { + StreamWriter streamWriter = new StreamWriter(fn); + try + { + List list = (from o in mMEvents + orderby o.Second, o.Millisecond + select o).ToList(); + for (int i = 0; i < list.Count; i++) + { + MmEvent mmEvent = list[i]; + string pMStr = GetPMStr(mmEvent); + streamWriter.WriteLine(layer + "\t" + Math.Round(mmEvent.X, 0) + "\t" + Math.Round(mmEvent.Y, 0) + "\t" + Math.Round(mmEvent.Z, 0) + "\t" + mmEvent.Second + "." + mmEvent.Millisecond + "\t" + mmEvent.ML + "\t" + mmEvent.errorCircularRadius + "\t" + mmEvent.errorH + "\t" + mmEvent.minTimeDiff + pMStr); + } + + streamWriter.Close(); + } + catch (Exception) + { + throw; + } + finally + { + streamWriter.Close(); + } + } + + public static string GetPMStr(MmEvent p) + { + string text = "\t"; + int[] mpIndex = new int[p.SN.Count]; + for (int j = 0; j < mpIndex.Length; j++) + { + mpIndex[j] = p.SN[j]; + } + + for (int k = 0; k < mpIndex.Length - 1; k++) + { + for (int l = 0; l < mpIndex.Length - 1 - k; l++) + { + if (mpIndex[l] > mpIndex[l + 1]) + { + int num = mpIndex[l]; + mpIndex[l] = mpIndex[l + 1]; + mpIndex[l + 1] = num; + } + } + } + + int i; + for (i = 0; i < p.PM.Count; i++) + { + int index = p.SN.FindIndex((int s) => s == mpIndex[i]); + text = ((p.PM.Count - 1 != i) ? (text + p.SN[index] + ":" + p.PM[index] + "\t") : (text + p.SN[index] + ":" + p.PM[index])); + } + + return text; + } + + public void SetEnergy() + { + Energy = Math.Round(63000.0 * Math.Pow(10.0, 1.47 * ML), 2); + } + + public static float SetAmp(List amps) + { + amps.Sort(); + return amps[amps.Count / 2]; + } + } +} \ No newline at end of file diff --git a/mseedChart.MainModule/Models/ShareProperty.cs b/mseedChart.MainModule/Models/ShareProperty.cs new file mode 100644 index 0000000..e539431 --- /dev/null +++ b/mseedChart.MainModule/Models/ShareProperty.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace mseedChart.MainModule.Models +{ + public class ShareProperty + { + public ShareProperty(int id, string name) + { + this.ID = id; + this.Name = name; + } + public int ID { get; set; } + public string Name { get; set; } + } +} diff --git a/mseedChart.MainModule/Models/StationModel.cs b/mseedChart.MainModule/Models/StationModel.cs new file mode 100644 index 0000000..bcd74d4 --- /dev/null +++ b/mseedChart.MainModule/Models/StationModel.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace mseedChart.MainModule.Models +{ + public class StationModel + { + public double E; + + public double N; + + public double Z; + + public double ELon; + + public double NLat; + + public DateTime BeginUseTime; + + public DateTime StopUseTime; + + public bool IsVisible = true; + + public List dz = new List(); + + public List dn = new List(); + + public List de = new List(); + + public ConcurrentQueue cz = new ConcurrentQueue(); + + public ConcurrentQueue ce = new ConcurrentQueue(); + + public ConcurrentQueue cn = new ConcurrentQueue(); + + public string Name { get; set; } + + public string FilePath { get; set; } + + public double Sens { get; set; } + } +} diff --git a/mseedChart.MainModule/Models/StationWorkModel.cs b/mseedChart.MainModule/Models/StationWorkModel.cs new file mode 100644 index 0000000..f09e590 --- /dev/null +++ b/mseedChart.MainModule/Models/StationWorkModel.cs @@ -0,0 +1,212 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + + +namespace mseedChart.MainModule.Models +{ + public class StationWorkModel + { + public static object _lock = new object(); + + public int Sampling { get; set; } + public int StationCnt { get; set; } + /// + /// 任务总数 + /// + public int TaskCnt { get; set; } + + public string[] files { get; set; } + public List Stations { get; set; } + /// + /// 单文件长度(个) + /// + public int SingleFileLength = 30000; + + + public void InitWork() + { + Stations = new List(); + TaskCnt = StationCnt = files.Length; + for (int i = 0; i < StationCnt; i++) + { + string fn = Path.GetFileNameWithoutExtension(files[i]).Substring(3, 3); + StationModel sm = new StationModel(); + sm.Name = fn; + sm.FilePath = files[i]; + Stations.Add(sm); + } + } + public void StartWriter() + { + Task[] tasks = new Task[TaskCnt]; + for (int i = 0; i < TaskCnt; i++) + { + int num = i; + //Func func = (s, ri) => + // Writer(ri); + //func.b + Func func = WriteChannelZ; + AsyncCallback asyncCallback = ar => + { + ChannelModel cm = func.EndInvoke(ar); + //Stopwatch stopWatch = new Stopwatch(); + //stopWatch.Start();//开始或继续测量某个时间间隔的运行时间 + lock (_lock) + { + for (int k = 0; k < SingleFileLength; k++) + { + int nk = k; + Stations[num].cz.Enqueue(cm.datas[nk]); + } + } + //stopWatch.Stop();//停止测量某个时间间隔的运行时间。 + //TimeSpan ts = stopWatch.Elapsed; + //Console.WriteLine("读取耗时:{0}ms",ts.TotalMilliseconds); + }; + func.BeginInvoke(Stations[num], asyncCallback, null); + //ChannelModel cm = func.EndInvoke(func.BeginInvoke(Stations[i],null,null)); + + //AsyncCallback asyncCallback = ar => + //{ + // ChannelModel cm = (ChannelModel)ar.AsyncState; + // if (cm != null) + // { + // Stopwatch stopWatch = new Stopwatch(); + // stopWatch.Start();//开始或继续测量某个时间间隔的运行时间 + // lock (_lock) + // { + // for (int k = 0; k < SingleFileLength; k++) + // { + // Stations[i].cz.Enqueue(cm.datas[k]); + // } + // } + // stopWatch.Stop();//停止测量某个时间间隔的运行时间。 + // TimeSpan ts = stopWatch.Elapsed; + // Console.WriteLine(ts.TotalMilliseconds); + // } + //}; + //func.BeginInvoke(Stations[i], asyncCallback, null); + + + //tasks[num] = Task.Run(() => + //{ Writer(Stations[num]); }); + + //Action + + } + // Task.WaitAll(tasks); + //Thread.Sleep(100); + + } + + public void StartReader() + { + //Task[] tasks2 = new Task[TaskCnt]; + //for (int i = 0; i < TaskCnt; i++) + //{ + // int num = i; + // tasks2[num] = Task.Run(() => + // { Reader(Stations[num]); }); + //} + } + public ChannelModel WriteChannelZ(StationModel sm) + { + ChannelModel cm = new ChannelModel(); + cm.Name = sm.Name; + cm.datas = new double[SingleFileLength]; + string al = new StreamReader(sm.FilePath).ReadToEnd(); + string[] als = al.Split(new char[] { '\n' }); + for (int k = 0; k < SingleFileLength; k++) + { + int num = k; + double value = (double.TryParse(als[num + 1], out double zz) ? zz : 0); + if (value < 30000) + { + cm.datas[num] = 32400; + continue; + } + + //Console.WriteLine(value); + cm.datas[k] = (value); + + } + return cm; + } + public void Writer(StationModel sm) + { + //while (true) + List data = new List(); + //{ + if (sm.cz.IsEmpty) + { + //Stopwatch stopWatch = new Stopwatch(); + //stopWatch.Start();//开始或继续测量某个时间间隔的运行时间 + string al = new StreamReader(sm.FilePath).ReadToEnd(); + string[] als = al.Split(new char[] { '\n' }); + + lock (_lock) + { + for (int k = 0; k < SingleFileLength; k++) + { + int num = k; + int value = (int)(int.TryParse(als[num + 1], out int zz) ? zz : sm.cz.Average()); + if (value < 30000) + Console.WriteLine(value); + sm.cz.Enqueue(value); + } + for (int k = 0; k < SingleFileLength; k++) + { + int num = k; + int value = (int)(int.TryParse(als[num + 30003], out int ee) ? ee : sm.ce.Average()); + sm.ce.Enqueue(value); + } + for (int k = 0; k < SingleFileLength; k++) + { + int num = k; + int value = (int)(int.TryParse(als[num + 60004], out int nn) ? nn : sm.cn.Average()); + sm.cn.Enqueue(value); + } + //Stopwatch stopWatch = new Stopwatch(); + //stopWatch.Start();//开始或继续测量某个时间间隔的运行时间 + //data.AddRange(sm.cz.ToList()); + //stopWatch.Stop();//停止测量某个时间间隔的运行时间。 + //TimeSpan ts = stopWatch.Elapsed; + //Console.WriteLine(ts.TotalMilliseconds); + // Get the elapsed time as a TimeSpan value. + //TimeSpan ts = stopWatch.Elapsed; //获取当前实例测量得出的总运行时间。 + //Console.WriteLine($"{dp.station}.{dp.channel}\t生产出:{dp.cz.Count}\t耗时:{ts.TotalMilliseconds}"); + //Console.WriteLine($"{dp.station}.{dp.channel}\t生产出:{dp.ce.Count}\t耗时:{ts.TotalMilliseconds}"); + //Console.WriteLine($"{dp.station}.{dp.channel}\t生产出:{dp.cn.Count}\t耗时:{ts.TotalMilliseconds}"); + } + } + Thread.Sleep(1); + //} + } + + public double[] Reader(StationModel sm, int cnt) + { + double[] js = new double[cnt]; + + //while (true) + //{ + //int ri = 0; + List cz = new List(); + List ce = new List(); + List cn = new List(); + lock (_lock) + { + for (int i = 0; i < js.Length; i++) + { + int index = i; + sm.cz.TryDequeue(out js[index]); + } + } + return js; + } + } +} diff --git a/mseedChart.MainModule/Models/WavesModel.cs b/mseedChart.MainModule/Models/WavesModel.cs new file mode 100644 index 0000000..aa3d0ab --- /dev/null +++ b/mseedChart.MainModule/Models/WavesModel.cs @@ -0,0 +1,445 @@ +using Arction.Wpf.ChartingMVVM.Axes; +using Arction.Wpf.ChartingMVVM.SeriesXY; +using Arction.Wpf.ChartingMVVM; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media; + + +namespace mseedChart.MainModule.Models +{ + public class WavesModel + { + // Constants + double YMin = 30000; // Minimal y-value. + double YMax = 35000; // Maximal y-value. + public AxisX GetAxisX(int XMax) + { + AxisX axisX = new AxisX(); + axisX.ScrollPosition = 0; + axisX.ScrollMode = XAxisScrollMode.Stepping; + axisX.Maximum = XMax; + axisX.SweepingGap = 1; + //axisX.AxisColor = Colors.Blue; + //axisX.LabelsColor = Colors.Black; + //axisX.GridStripColor = Colors.Black; + //axisX. + axisX.Title.Visible = false; + return axisX; + } + public List CreateYAxisPingPu(List stationModels, LightningChart curChart) + { + List axisYList = new List(); + + foreach (var item in stationModels) + { + AxisY axisYZ = new AxisY(curChart.ViewXY); + //添加Z分量波形 + if (item.dz.Count > 0) + { + axisYZ.SetRange(item.dz.Min(), item.dz.Max()); + } + axisYZ.AllowAutoYFit = false; + axisYZ.Title.Font = new WpfFont("Segoe UI", 10, false, false); + axisYZ.Title.Text = string.Format("Ch{0}.Z", item.Name); + axisYZ.Title.Angle = 0; + //axisYZ.Title.Color = Colors.Black; + //axisYZ.Title. + axisYZ.Units.Visible = false; + axisYList.Add(axisYZ); + + //添加N分量波形 + AxisY axisYN = new AxisY(curChart.ViewXY); + if (item.dn.Count > 0) + { + axisYN.SetRange(item.dn.Min(), item.dn.Max()); + } + axisYN.Title.Font = new WpfFont("Segoe UI", 10, false, false); + axisYN.Title.Text = string.Format("Ch{0}.N", item.Name); + axisYN.Title.Angle = 0; + //axisYN.Title.Color = Colors.Black; + axisYN.Units.Visible = false; + axisYList.Add(axisYN); + + //添加E分量波形 + AxisY axisYE = new AxisY(curChart.ViewXY); + if (item.de.Count > 0) + { + + axisYE.SetRange(item.de.Min(), item.de.Max()); + + } + axisYE.Title.Font = new WpfFont("Segoe UI", 10, false, false); + axisYE.Title.Text = string.Format("Ch{0}.E", item.Name); + axisYE.Title.Angle = 0; + //axisYE.Title.Color = Colors.Black; + axisYE.Units.Visible = false; + axisYList.Add(axisYE); + } + + return axisYList; + } + public List GetSampleDataSeriesPingPu(List stationModels, LightningChart curChart, AxisX xAxes, AxisYCollection axisY, double samplingFrequency) + { + List sampleList = new List(); + + for (int i = 0; i < stationModels.Count; i++) + { + //Bug,在波形数据少于台站数量时,出现错误 + if (i < axisY.Count) + { + + } + //Z + SampleDataSeries seriesZ = new SampleDataSeries(curChart.ViewXY, xAxes, axisY[i * 3]); + seriesZ.SampleFormat = SampleFormat.DoubleFloat; + //series.LineStyle.Color = DefaultColors.SeriesForBlackBackgroundWpf[i % DefaultColors.SeriesForBlackBackgroundWpf.Length]; + + seriesZ.LineStyle.Color = System.Windows.Media.Colors.Blue; + + seriesZ.SamplingFrequency = samplingFrequency; + seriesZ.FirstSampleTimeStamp = 1.0 / samplingFrequency; + seriesZ.LineStyle.Width = 1; + seriesZ.LineStyle.AntiAliasing = LineAntialias.None; + seriesZ.ScrollModePointsKeepLevel = 1; + seriesZ.ScrollingStabilizing = true; + seriesZ.AllowUserInteraction = false; + + //Set custom colored palette + System.Windows.Media.Color colorEdge = ChartTools.CalcGradient(seriesZ.LineStyle.Color, System.Windows.Media.Colors.Gray, 50); + System.Windows.Media.Color colorCenter = seriesZ.LineStyle.Color; + + seriesZ.ValueRangePalette.Steps.Clear(); //Remove existing palette steps + seriesZ.ValueRangePalette.Steps.Add(new PaletteStep(seriesZ.ValueRangePalette, colorEdge, -100)); + seriesZ.ValueRangePalette.Steps.Add(new PaletteStep(seriesZ.ValueRangePalette, colorCenter, 0)); + seriesZ.ValueRangePalette.Steps.Add(new PaletteStep(seriesZ.ValueRangePalette, colorEdge, 100)); + + sampleList.Add(seriesZ); + + //E + SampleDataSeries seriesE = new SampleDataSeries(curChart.ViewXY, xAxes, axisY[i * 3 + 1]); + seriesE.SampleFormat = SampleFormat.DoubleFloat; + //series.LineStyle.Color = DefaultColors.SeriesForBlackBackgroundWpf[i % DefaultColors.SeriesForBlackBackgroundWpf.Length]; + + seriesE.LineStyle.Color = System.Windows.Media.Colors.Red; + + seriesE.SamplingFrequency = samplingFrequency; + seriesE.FirstSampleTimeStamp = 1.0 / samplingFrequency; + seriesE.LineStyle.Width = 1; + seriesE.LineStyle.AntiAliasing = LineAntialias.None; + seriesE.ScrollModePointsKeepLevel = 1; + seriesE.ScrollingStabilizing = true; + seriesE.AllowUserInteraction = false; + + //Set custom colored palette + //System.Windows.Media.Color colorEdge = ChartTools.CalcGradient(series.LineStyle.Color, System.Windows.Media.Colors.Black, 50); + //System.Windows.Media.Color colorCenter = series.LineStyle.Color; + + //seriesE.ValueRangePalette.Steps.Clear(); //Remove existing palette steps + //seriesE.ValueRangePalette.Steps.Add(new PaletteStep(seriesE.ValueRangePalette, colorEdge, -100)); + //seriesE.ValueRangePalette.Steps.Add(new PaletteStep(seriesE.ValueRangePalette, colorCenter, 0)); + //seriesE.ValueRangePalette.Steps.Add(new PaletteStep(seriesE.ValueRangePalette, colorEdge, 100)); + + sampleList.Add(seriesE); + + //N + SampleDataSeries seriesN = new SampleDataSeries(curChart.ViewXY, xAxes, axisY[i * 3 + 2]); + seriesN.SampleFormat = SampleFormat.DoubleFloat; + //series.LineStyle.Color = DefaultColors.SeriesForBlackBackgroundWpf[i % DefaultColors.SeriesForBlackBackgroundWpf.Length]; + + seriesN.LineStyle.Color = System.Windows.Media.Colors.Green; + + seriesN.SamplingFrequency = samplingFrequency; + seriesN.FirstSampleTimeStamp = 1.0 / samplingFrequency; + seriesN.LineStyle.Width = 1; + seriesN.LineStyle.AntiAliasing = LineAntialias.None; + seriesN.ScrollModePointsKeepLevel = 1; + seriesN.ScrollingStabilizing = true; + seriesN.AllowUserInteraction = false; + + //Set custom colored palette + //System.Windows.Media.Color colorEdge = ChartTools.CalcGradient(series.LineStyle.Color, System.Windows.Media.Colors.Black, 50); + //System.Windows.Media.Color colorCenter = series.LineStyle.Color; + + //seriesN.ValueRangePalette.Steps.Clear(); //Remove existing palette steps + //seriesN.ValueRangePalette.Steps.Add(new PaletteStep(seriesN.ValueRangePalette, colorEdge, -100)); + //seriesN.ValueRangePalette.Steps.Add(new PaletteStep(seriesN.ValueRangePalette, colorCenter, 0)); + //seriesN.ValueRangePalette.Steps.Add(new PaletteStep(seriesN.ValueRangePalette, colorEdge, 100)); + + sampleList.Add(seriesN); + } + return sampleList; + } + + public List CreateYAxisPingPu(Dictionary sms, LightningChart curChart) + //public List CreateYAxisPingPu(int StationCount, LightningChart curChart) + { + List axisYList = new List(); + + foreach (var item in sms.Keys) + { + //add Z + AxisY axisYZ = new AxisY(curChart.ViewXY); + axisYZ.SetRange(YMin, YMax); + axisYZ.AllowAutoYFit = false; + axisYZ.Title.Font = new WpfFont("Segoe UI", 10, false, false); + axisYZ.Title.Text = string.Format("Ch{0}.Z", item); + axisYZ.Title.Angle = 0; + //axisYZ.Title. + axisYZ.Units.Visible = false; + axisYList.Add(axisYZ); + + //add E + AxisY axisYE = new AxisY(curChart.ViewXY); + + axisYE.SetRange(YMin, YMax); + axisYE.Title.Font = new WpfFont("Segoe UI", 10, false, false); + axisYE.Title.Text = string.Format("Ch{0}.E", item); + axisYE.Title.Angle = 0; + axisYE.Units.Visible = false; + axisYList.Add(axisYE); + + //add N + AxisY axisYN = new AxisY(curChart.ViewXY); + + axisYN.SetRange(YMin, YMax); + axisYN.Title.Font = new WpfFont("Segoe UI", 10, false, false); + axisYN.Title.Text = string.Format("Ch{0}.N", item); + axisYN.Title.Angle = 0; + axisYN.Units.Visible = false; + axisYList.Add(axisYN); + } + //for (int i = 0; i < sms.Count; i++) + //{ + + //} + return axisYList; + } + public List GetSampleDataSeriesPingPu(Dictionary sms, LightningChart curChart, AxisX xAxes, AxisYCollection axisY, double samplingFrequency) + { + List sampleList = new List(); + + for (int i = 0; i < sms.Count; i++) + { + //Z + SampleDataSeries seriesZ = new SampleDataSeries(curChart.ViewXY, xAxes, axisY[i * 3]); + seriesZ.SampleFormat = SampleFormat.DoubleFloat; + //series.LineStyle.Color = DefaultColors.SeriesForBlackBackgroundWpf[i % DefaultColors.SeriesForBlackBackgroundWpf.Length]; + + seriesZ.LineStyle.Color = System.Windows.Media.Colors.Blue; + + seriesZ.SamplingFrequency = samplingFrequency; + seriesZ.FirstSampleTimeStamp = 1.0 / samplingFrequency; + seriesZ.LineStyle.Width = 1; + seriesZ.LineStyle.AntiAliasing = LineAntialias.None; + seriesZ.ScrollModePointsKeepLevel = 1; + seriesZ.ScrollingStabilizing = true; + seriesZ.AllowUserInteraction = false; + + //Set custom colored palette + System.Windows.Media.Color colorEdge = ChartTools.CalcGradient(seriesZ.LineStyle.Color, System.Windows.Media.Colors.Black, 50); + System.Windows.Media.Color colorCenter = seriesZ.LineStyle.Color; + + seriesZ.ValueRangePalette.Steps.Clear(); //Remove existing palette steps + seriesZ.ValueRangePalette.Steps.Add(new PaletteStep(seriesZ.ValueRangePalette, colorEdge, -100)); + seriesZ.ValueRangePalette.Steps.Add(new PaletteStep(seriesZ.ValueRangePalette, colorCenter, 0)); + seriesZ.ValueRangePalette.Steps.Add(new PaletteStep(seriesZ.ValueRangePalette, colorEdge, 100)); + + sampleList.Add(seriesZ); + + //E + SampleDataSeries seriesE = new SampleDataSeries(curChart.ViewXY, xAxes, axisY[i * 3 + 1]); + seriesE.SampleFormat = SampleFormat.DoubleFloat; + //series.LineStyle.Color = DefaultColors.SeriesForBlackBackgroundWpf[i % DefaultColors.SeriesForBlackBackgroundWpf.Length]; + + seriesE.LineStyle.Color = System.Windows.Media.Colors.Red; + + seriesE.SamplingFrequency = samplingFrequency; + seriesE.FirstSampleTimeStamp = 1.0 / samplingFrequency; + seriesE.LineStyle.Width = 1; + seriesE.LineStyle.AntiAliasing = LineAntialias.None; + seriesE.ScrollModePointsKeepLevel = 1; + seriesE.ScrollingStabilizing = true; + seriesE.AllowUserInteraction = false; + + //Set custom colored palette + //System.Windows.Media.Color colorEdge = ChartTools.CalcGradient(series.LineStyle.Color, System.Windows.Media.Colors.Black, 50); + //System.Windows.Media.Color colorCenter = series.LineStyle.Color; + + seriesE.ValueRangePalette.Steps.Clear(); //Remove existing palette steps + seriesE.ValueRangePalette.Steps.Add(new PaletteStep(seriesE.ValueRangePalette, colorEdge, -100)); + seriesE.ValueRangePalette.Steps.Add(new PaletteStep(seriesE.ValueRangePalette, colorCenter, 0)); + seriesE.ValueRangePalette.Steps.Add(new PaletteStep(seriesE.ValueRangePalette, colorEdge, 100)); + + sampleList.Add(seriesE); + + //N + SampleDataSeries seriesN = new SampleDataSeries(curChart.ViewXY, xAxes, axisY[i * 3 + 2]); + seriesN.SampleFormat = SampleFormat.DoubleFloat; + //series.LineStyle.Color = DefaultColors.SeriesForBlackBackgroundWpf[i % DefaultColors.SeriesForBlackBackgroundWpf.Length]; + + seriesN.LineStyle.Color = System.Windows.Media.Colors.Green; + + seriesN.SamplingFrequency = samplingFrequency; + seriesN.FirstSampleTimeStamp = 1.0 / samplingFrequency; + seriesN.LineStyle.Width = 1; + seriesN.LineStyle.AntiAliasing = LineAntialias.None; + seriesN.ScrollModePointsKeepLevel = 1; + seriesN.ScrollingStabilizing = true; + seriesN.AllowUserInteraction = false; + + //Set custom colored palette + //System.Windows.Media.Color colorEdge = ChartTools.CalcGradient(series.LineStyle.Color, System.Windows.Media.Colors.Black, 50); + //System.Windows.Media.Color colorCenter = series.LineStyle.Color; + + seriesN.ValueRangePalette.Steps.Clear(); //Remove existing palette steps + seriesN.ValueRangePalette.Steps.Add(new PaletteStep(seriesN.ValueRangePalette, colorEdge, -100)); + seriesN.ValueRangePalette.Steps.Add(new PaletteStep(seriesN.ValueRangePalette, colorCenter, 0)); + seriesN.ValueRangePalette.Steps.Add(new PaletteStep(seriesN.ValueRangePalette, colorEdge, 100)); + + sampleList.Add(seriesN); + } + return sampleList; + } + public List GetSampleDataSeriesDieJia(List sms, LightningChart curChart, AxisX xAxes, AxisYCollection axisY, double samplingFrequency) + { + List sampleList = new List(); + + for (int i = 0; i < sms.Count; i++) + { + //Z + SampleDataSeries seriesZ = new SampleDataSeries(curChart.ViewXY, xAxes, axisY[i]); + seriesZ.SampleFormat = SampleFormat.DoubleFloat; + //series.LineStyle.Color = DefaultColors.SeriesForBlackBackgroundWpf[i % DefaultColors.SeriesForBlackBackgroundWpf.Length]; + + seriesZ.LineStyle.Color = System.Windows.Media.Colors.Blue; + + seriesZ.SamplingFrequency = samplingFrequency; + seriesZ.FirstSampleTimeStamp = 1.0 / samplingFrequency; + seriesZ.LineStyle.Width = 1; + seriesZ.LineStyle.AntiAliasing = LineAntialias.None; + seriesZ.ScrollModePointsKeepLevel = 1; + seriesZ.ScrollingStabilizing = true; + seriesZ.AllowUserInteraction = false; + + //Set custom colored palette + System.Windows.Media.Color colorEdge = ChartTools.CalcGradient(seriesZ.LineStyle.Color, System.Windows.Media.Colors.Black, 50); + System.Windows.Media.Color colorCenter = seriesZ.LineStyle.Color; + + seriesZ.ValueRangePalette.Steps.Clear(); //Remove existing palette steps + seriesZ.ValueRangePalette.Steps.Add(new PaletteStep(seriesZ.ValueRangePalette, colorEdge, -100)); + seriesZ.ValueRangePalette.Steps.Add(new PaletteStep(seriesZ.ValueRangePalette, colorCenter, 0)); + seriesZ.ValueRangePalette.Steps.Add(new PaletteStep(seriesZ.ValueRangePalette, colorEdge, 100)); + + sampleList.Add(seriesZ); + + //E + SampleDataSeries seriesE = new SampleDataSeries(curChart.ViewXY, xAxes, axisY[i]); + seriesE.SampleFormat = SampleFormat.DoubleFloat; + //series.LineStyle.Color = DefaultColors.SeriesForBlackBackgroundWpf[i % DefaultColors.SeriesForBlackBackgroundWpf.Length]; + + seriesE.LineStyle.Color = System.Windows.Media.Colors.Red; + + seriesE.SamplingFrequency = samplingFrequency; + seriesE.FirstSampleTimeStamp = 1.0 / samplingFrequency; + seriesE.LineStyle.Width = 1; + seriesE.LineStyle.AntiAliasing = LineAntialias.None; + seriesE.ScrollModePointsKeepLevel = 1; + seriesE.ScrollingStabilizing = true; + seriesE.AllowUserInteraction = false; + + //Set custom colored palette + //System.Windows.Media.Color colorEdge = ChartTools.CalcGradient(series.LineStyle.Color, System.Windows.Media.Colors.Black, 50); + //System.Windows.Media.Color colorCenter = series.LineStyle.Color; + + seriesE.ValueRangePalette.Steps.Clear(); //Remove existing palette steps + seriesE.ValueRangePalette.Steps.Add(new PaletteStep(seriesE.ValueRangePalette, colorEdge, -100)); + seriesE.ValueRangePalette.Steps.Add(new PaletteStep(seriesE.ValueRangePalette, colorCenter, 0)); + seriesE.ValueRangePalette.Steps.Add(new PaletteStep(seriesE.ValueRangePalette, colorEdge, 100)); + + sampleList.Add(seriesE); + + //N + SampleDataSeries seriesN = new SampleDataSeries(curChart.ViewXY, xAxes, axisY[i]); + seriesN.SampleFormat = SampleFormat.DoubleFloat; + //series.LineStyle.Color = DefaultColors.SeriesForBlackBackgroundWpf[i % DefaultColors.SeriesForBlackBackgroundWpf.Length]; + + seriesN.LineStyle.Color = System.Windows.Media.Colors.Green; + + seriesN.SamplingFrequency = samplingFrequency; + seriesN.FirstSampleTimeStamp = 1.0 / samplingFrequency; + seriesN.LineStyle.Width = 1; + seriesN.LineStyle.AntiAliasing = LineAntialias.None; + seriesN.ScrollModePointsKeepLevel = 1; + seriesN.ScrollingStabilizing = true; + seriesN.AllowUserInteraction = false; + + //Set custom colored palette + //System.Windows.Media.Color colorEdge = ChartTools.CalcGradient(series.LineStyle.Color, System.Windows.Media.Colors.Black, 50); + //System.Windows.Media.Color colorCenter = series.LineStyle.Color; + + seriesN.ValueRangePalette.Steps.Clear(); //Remove existing palette steps + seriesN.ValueRangePalette.Steps.Add(new PaletteStep(seriesN.ValueRangePalette, colorEdge, -100)); + seriesN.ValueRangePalette.Steps.Add(new PaletteStep(seriesN.ValueRangePalette, colorCenter, 0)); + seriesN.ValueRangePalette.Steps.Add(new PaletteStep(seriesN.ValueRangePalette, colorEdge, 100)); + + sampleList.Add(seriesN); + } + return sampleList; + } + public List CreateYAxis(int channelCount, LightningChart curChart) + { + List axisYList = new List(); + + for (int i = 0; i < channelCount; i++) + { + AxisY axisY = new AxisY(curChart.ViewXY); + //AxisY axisY = new AxisY(); + axisY.SetRange(YMin, YMax); + axisY.Title.Font = new WpfFont("Segoe UI", 10, false, false); + axisY.Title.Text = string.Format("Ch {0}", i + 1); + axisY.Title.Angle = 0; + axisY.Units.Visible = false; + axisYList.Add(axisY); + } + return axisYList; + } + public List GetSampleDataSeries(int channelCount, LightningChart curChart, AxisX xAxes, AxisYCollection axisY, double samplingFrequency) + { + List sampleList = new List(); + + for (int i = 0; i < channelCount; i++) + { + SampleDataSeries series = new SampleDataSeries(curChart.ViewXY, xAxes, axisY[i]); + series.SampleFormat = SampleFormat.DoubleFloat; + //series.LineStyle.Color = DefaultColors.SeriesForBlackBackgroundWpf[i % DefaultColors.SeriesForBlackBackgroundWpf.Length]; + + series.LineStyle.Color = DefaultColors.SeriesForBlackBackgroundWpf[i % DefaultColors.SeriesForBlackBackgroundWpf.Length]; + + series.SamplingFrequency = samplingFrequency; + series.FirstSampleTimeStamp = 1.0 / samplingFrequency; + series.LineStyle.Width = 1; + series.LineStyle.AntiAliasing = LineAntialias.None; + series.ScrollModePointsKeepLevel = 1; + series.ScrollingStabilizing = true; + series.AllowUserInteraction = false; + + //Set custom colored palette + System.Windows.Media.Color colorEdge = ChartTools.CalcGradient(series.LineStyle.Color, System.Windows.Media.Colors.Black, 50); + System.Windows.Media.Color colorCenter = series.LineStyle.Color; + + series.ValueRangePalette.Steps.Clear(); //Remove existing palette steps + series.ValueRangePalette.Steps.Add(new PaletteStep(series.ValueRangePalette, colorEdge, -100)); + series.ValueRangePalette.Steps.Add(new PaletteStep(series.ValueRangePalette, colorCenter, 0)); + series.ValueRangePalette.Steps.Add(new PaletteStep(series.ValueRangePalette, colorEdge, 100)); + + sampleList.Add(series); + } + return sampleList; + } + } +} diff --git a/mseedChart.MainModule/Properties/AssemblyInfo.cs b/mseedChart.MainModule/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f46da86 --- /dev/null +++ b/mseedChart.MainModule/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("mseedChart.MainModule")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("mseedChart.MainModule")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +//若要开始生成可本地化的应用程序,请设置 +//.csproj 文件中的 CultureYouAreCodingWith +//例如,如果您在源文件中使用的是美国英语, +//使用的是美国英语,请将 设置为 en-US。 然后取消 +//对以下 NeutralResourceLanguage 特性的注释。 更新 +//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //主题特定资源词典所处位置 + //(未在页面中找到资源时使用, + //或应用程序资源字典中找到时使用) + ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 + //(未在页面中找到资源时使用, + //、应用程序或任何主题专用资源字典中找到时使用) +)] + + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/mseedChart.MainModule/Properties/Resources.Designer.cs b/mseedChart.MainModule/Properties/Resources.Designer.cs new file mode 100644 index 0000000..85924cd --- /dev/null +++ b/mseedChart.MainModule/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace mseedChart.MainModule.Properties +{ + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("mseedChart.MainModule.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/mseedChart.MainModule/Properties/Resources.resx b/mseedChart.MainModule/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/mseedChart.MainModule/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/mseedChart.MainModule/Properties/Settings.Designer.cs b/mseedChart.MainModule/Properties/Settings.Designer.cs new file mode 100644 index 0000000..f1d6140 --- /dev/null +++ b/mseedChart.MainModule/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace mseedChart.MainModule.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/mseedChart.MainModule/Properties/Settings.settings b/mseedChart.MainModule/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/mseedChart.MainModule/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/mseedChart.MainModule/RegionNames.cs b/mseedChart.MainModule/RegionNames.cs new file mode 100644 index 0000000..3ad6d96 --- /dev/null +++ b/mseedChart.MainModule/RegionNames.cs @@ -0,0 +1,51 @@ +using mseedChart.MainModule.Models; +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Linq; + +namespace mseedChart.Core +{ + public static class RegionNames + { + public const string ContentRegion = "ContentRegion"; + + public static string MseedFilePath="D:\\EwsCache\\Mseed"; + + + public static string TxtFilePath = "D:\\EwsCache\\Txt"; + + + public static string DataTypeString = "A"; + + + public static Dictionary StationDic { get; set; } + + + public static Dictionary CreateStationFromCSV(string fn) + { + Dictionary stations = new Dictionary(); + + var datas= File.ReadLines(fn); + + foreach (var item in datas) + { + if (item.Contains("net")) continue; + string[] row = item.Split(','); + StationModel model = new StationModel(); + model.Name = row[1].ToString(); + model.E = double.Parse(row[2].ToString()); + model.N = double.Parse(row[3].ToString()); + model.Z = double.Parse(row[4].ToString()); + model.Sens = double.Parse(row[5].ToString()); + model.BeginUseTime = DateTime.Parse(row[6].ToString()); + model.StopUseTime = DateTime.Parse(row[7].ToString()); + stations.Add(model.Name, model); + } + return stations; + } + + } + +} diff --git a/mseedChart.MainModule/ViewModels/ChartPlotViewModel.cs b/mseedChart.MainModule/ViewModels/ChartPlotViewModel.cs new file mode 100644 index 0000000..e58ea29 --- /dev/null +++ b/mseedChart.MainModule/ViewModels/ChartPlotViewModel.cs @@ -0,0 +1,652 @@ +using Arction.Wpf.ChartingMVVM; +using Arction.Wpf.ChartingMVVM.Axes; +using Arction.Wpf.ChartingMVVM.Views.ViewXY; +using mseedChart.Core; +using mseedChart.MainModule.Models; +using Prism.Events; +using Prism.Mvvm; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Threading; + +namespace mseedChart.MainModule.ViewModels +{ + public class ChartPlotViewModel : BindableBase + { + #region variable + Dispatcher _dispatcher; + /// + /// Delegate for data generation. + /// + /// + /// 当前采样数 + /// + public int CurPoints; + private readonly IEventAggregator _ea; + private int _selectResult = 0; + public int SelectResult + { + get { return _selectResult; } + + set + { + SetProperty(ref _selectResult, value); + } + } + 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 + /// + /// Thread. + /// + + private delegate void ChartUpdateFromThreadHandler(double[][] samples); + + + private ChartUpdateFromThreadHandler _chartUpdate; + + private Random _rand = new Random((int)DateTime.Now.Ticks); + + #region "属性" + private int _lChartCount = 1; + /// + /// 波形控件数量 + /// + public int LChartCount + { + get { return _lChartCount; } + set { _lChartCount = value; } + } + public List WaveComList { get; set; } + private ShareProperty _wavesCombination; + /// + /// 波形组合 + /// + public ShareProperty WavesCombination + { + get { return _wavesCombination; } + set + { + _wavesCombination = value; + SetWavesCombination(); + } + } + private DataSourcesEnum _dataSources; + /// + /// 数据来源 + /// + public DataSourcesEnum DataSources + { + get { return _dataSources; } + set { _dataSources = value; } + } + + private DataTypeEnum _wavesType; + /// + /// 波形类型 + /// + public DataTypeEnum WavesType + { + get { return _wavesType; } + set { _wavesType = value; } + } + + private DisplayModeEnum _displayMode; + /// + /// 显示模式 + /// + public DisplayModeEnum DisplayMode + { + get { return _displayMode; } + set { _displayMode = value; } + } + + private ScollModeEnum _scollMode; + /// + /// 滚动方式 + /// + public ScollModeEnum ScollMode + { + get { return _scollMode; } + set { _scollMode = value; } + } + + private DateTime _startTime; + /// + /// 开始时间 + /// + public DateTime StartTime + { + get { return _startTime; } + set { _startTime = value; } + } + private DateTime _endTime; + /// + /// 开始时间 + /// + public DateTime EndTime + { + get { return _endTime; } + set { _endTime = value; } + } + + private int _sampling = 500; + /// + /// 采样频率 + /// + public int Sampling + { + get { return _sampling; } + set { _sampling = value; } + } + /// + /// 延时(min) + /// + public int DelayMin { get; set; } = 10; + /// + /// 文件数据位置 + /// + public string FileDataPath { get; set; } = @"D:\TaySystemPath\Downloads"; + private string _cachePath; + + private int _cacheSize; + /// + /// 缓存大小 + /// + public int CacheSize + { + get { return _cacheSize; } + set { _cacheSize = value; } + } + private ObservableCollection _stationList; + /// + /// 台站列表 + /// + public ObservableCollection StationList + { + get { return _stationList; } + set { _stationList = value; } + } + + private LightningChart _lChartAll; + /// + /// 所有波形 + /// + public LightningChart LChartALL + { + get { return _lChartAll; } + set { _lChartAll = value; } + } + private LightningChart _lChartZ; + /// + /// Z通道波形 + /// + public LightningChart LChartZ + { + get { return _lChartZ; } + set { _lChartZ = value; } + } + private LightningChart _lChartE; + /// + /// E通道波形 + /// + public LightningChart LChartE + { + get { return _lChartE; } + set { _lChartE = value; } + } + private LightningChart _lChartN; + /// + /// N通道波形 + /// + public LightningChart LChartN + { + get { return _lChartN; } + set { _lChartN = value; } + } + + private FrameworkElement childContent; + public FrameworkElement ChildContent + { + get { return childContent; } + set { childContent = value; } + } + + private Grid gridChart; + + public Grid GridChart + { + get { return gridChart; } + set { gridChart = value; } + } + + + public List 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); + + + _wavesModel = new WavesModel(); + LChartALL.ViewXY.XAxes = new AxisXCollection(); + LChartALL.ViewXY.XAxes.Add(_wavesModel.GetAxisX(10)); + InitData(); + (Application.Current.MainWindow as System.Windows.Window).Closing += ApplicationClosingDispose; + ShowWave(); + } + + private void ShowWave(string obj= "2023-03-29T06:41:21.348") + { + 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 (!Directory.Exists(dataFilePath)) + { + Directory.CreateDirectory(dataFilePath); + } + if (!Directory.Exists(Path.GetDirectoryName(asciiSavePath))) + { + Directory.CreateDirectory(Path.GetDirectoryName(asciiSavePath)); + } + if (!File.Exists(dataFilePath + dataFileName + mseedStr)) + { + + //TaskData taskData = new TaskData(); + //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(); + }); + } + + + + } + + 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() + { + 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(_chartUpdate, System.Windows.Threading.DispatcherPriority.ContextIdle, + multiChannelData as object); + } + catch (Exception ex) + { + throw ex; + } + + } + + public void UpdateWavesFromTxt(string fn) + { + string allStr; + smList = new List(); + using (StreamReader streamReader = new StreamReader(fn)) + { + allStr = streamReader.ReadToEnd(); + } + if (allStr.Length > 0) + { + string[] strLines = allStr.Trim().Split(new char[] { '\n' }); + List strList = strLines.ToList(); + int cnt = strList.Count; + int num = 0; + string[] snStr = strLines[0].Trim().Split(','); + string tmpName = snStr[0].Substring(14, 3); + CurPoints = int.Parse(snStr[1].Trim().Split(' ')[0]); + StationModel station = new StationModel(); + station.Name = tmpName; + station.dz = new List(); + station.dn = new List(); + station.de = new List(); + + int channelFlag = 0; + + for (int i = 1; i < strLines.Length; i++) + { + string row = strLines[i].Trim(); + if (strLines[i].Contains("HA")) + { + string[] rowStr = strLines[i].Split(','); + string chnStr1 = rowStr[0].Substring(21, 3); + if (chnStr1 == "SHZ") + { + smList.Add(station); + station = new StationModel(); + station.Name = rowStr[0].Substring(14, 3); + channelFlag = 0;//Z + } + else if (chnStr1 == "SHN") + { + channelFlag = 1;//N + } + else + { + channelFlag = 2;//E + } + } + else + { + switch (channelFlag) + { + case 0://Z + station.dz.Add(double.Parse(row)); + break; + case 1://N + station.dn.Add(double.Parse(row)); + break; + case 2://E + station.de.Add(double.Parse(row)); + break; + } + } + } + smList.Add(station); + smList.Reverse(); + } + } + public void MSeed2Asc(string filePath, string savePath) + { + using (Process compiler = new Process()) + { + compiler.StartInfo.FileName = "mseed2ascii.exe"; + compiler.StartInfo.Arguments = filePath + " -o " + savePath; + compiler.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + compiler.Start(); + compiler.WaitForExit(); + } + } + private void ApplicationClosingDispose(object sender, CancelEventArgs e) + { + if (LChartALL != null) + { + LChartALL.Dispose(); + LChartALL = null; + } + } + public void Dispose() + { + gridChart.Children.Clear(); + + if (LChartALL != null) + { + LChartALL.Dispose(); + 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.Title.Text = "事件波形"; + LChartALL.Title.Color = Colors.Black; + LChartALL.Title.Shadow.DropColor = Colors.Transparent; + LChartALL.Title.Shadow.ContrastColor = Colors.Transparent; + LChartALL.Title.Font = new WpfFont("等线", 20); + + LChartALL.ViewXY.AxisLayout.YAxesLayout = YAxesLayout.Stacked; + + LChartALL.ViewXY.AxisLayout.SegmentsGap = 0; + LChartALL.ViewXY.ZoomPanOptions.PanDirection = PanDirection.Horizontal; + LChartALL.ViewXY.ZoomPanOptions.WheelZooming = WheelZooming.Horizontal; + + //背景颜色 + LChartALL.ViewXY.GraphBackground.Color = Colors.White; + LChartALL.ViewXY.GraphBackground.GradientFill = GradientFill.Solid; + LChartALL.ViewXY.GraphBackground.GradientColor = Colors.White; + LChartALL.ChartBackground.GradientFill = GradientFill.Solid; + LChartALL.ChartBackground.Color = Color.FromArgb(0, 0, 0, 0); + + GridChart = new Grid(); + GridChart.ColumnDefinitions.Add(new ColumnDefinition()); + GridChart.Name = "chartGrid"; + GridChart.Children.Add(LChartALL); + + this.ChildContent = GridChart; + } + public void CreateGridChartDieJia() + { + if (LChartALL != null) + { + LChartALL = null; + } + LChartALL = new LightningChart(); + LChartALL.Title.Text = "叠加"; + + GridChart = new Grid(); + GridChart.ColumnDefinitions.Add(new ColumnDefinition()); + GridChart.Name = "chartGrid"; + GridChart.Children.Add(LChartALL); + + this.ChildContent = GridChart; + } + public void CreateGridChartFenLei() + { + LChartZ = new LightningChart(); + LChartALL.Title.Text = "Z"; + LChartZ.SetValue(Grid.ColumnProperty, 0); + + LChartE = new LightningChart(); + LChartALL.Title.Text = "E"; + LChartE.SetValue(Grid.ColumnProperty, 1); + + LChartN = new LightningChart(); + LChartALL.Title.Text = "N"; + LChartN.SetValue(Grid.ColumnProperty, 2); + + GridChart = new Grid(); + GridChart.ColumnDefinitions.Add(new ColumnDefinition()); + GridChart.ColumnDefinitions.Add(new ColumnDefinition()); + GridChart.ColumnDefinitions.Add(new ColumnDefinition()); + + GridChart.Name = "chartGrid"; + GridChart.Children.Add(LChartZ); + GridChart.Children.Add(LChartE); + GridChart.Children.Add(LChartN); + this.ChildContent = GridChart; + } + private void InitData() + { + LChartALL.ViewXY.YAxes = new AxisYCollection(); + 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; + 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(); + LChartALL.ViewXY.SampleDataSeries.AddRange( + _wavesModel.GetSampleDataSeriesPingPu(RegionNames.StationDic, LChartALL, LChartALL.ViewXY.XAxes[0], + LChartALL.ViewXY.YAxes, _samplingFrequency)); + //string mseedPath = FileDataPath + "\\" + StartTime.Year.ToString("D2"); + //Console.WriteLine(mseedPath); + //Start(); + } + private void FeedNewDataToChartPingPu(double[][] data) + { + LChartALL.BeginUpdate(); + + for (int channelIndex = 0; channelIndex < _channelCount; channelIndex++) + { + 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; + + LChartALL.ViewXY.XAxes[0].ScrollPosition = _previousX; + LChartALL.EndUpdate(); + + } + + } + /// + /// 波形组合 + /// + public enum WavesCombinationEnum + { + 平铺 = 0, + 叠加, + 分类 + } + /// + /// 波形类型 + /// + public enum DataTypeEnum + { + 原始数据 = 0, + 事件数据 + } + /// + /// 数据来源 + /// + public enum DataSourcesEnum + { + 文件 = 0, + 数据库 + } + /// + /// 显示模式 + /// + public enum DisplayModeEnum + { + 自动 = 0, + 手动 + } + public enum ScollModeEnum + { + Scrolling = 0, + Stepping + } +} diff --git a/mseedChart.MainModule/Views/ChartPlotView.xaml b/mseedChart.MainModule/Views/ChartPlotView.xaml new file mode 100644 index 0000000..cf543ec --- /dev/null +++ b/mseedChart.MainModule/Views/ChartPlotView.xaml @@ -0,0 +1,18 @@ + + + + + + diff --git a/mseedChart.MainModule/Views/ChartPlotView.xaml.cs b/mseedChart.MainModule/Views/ChartPlotView.xaml.cs new file mode 100644 index 0000000..1b2e113 --- /dev/null +++ b/mseedChart.MainModule/Views/ChartPlotView.xaml.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace mseedChart.MainModule.Views +{ + /// + /// Interaction logic for ViewA.xaml + /// + public partial class ChartPlotView : UserControl + { + public ChartPlotView() + { + InitializeComponent(); + } + + } +} diff --git a/mseedChart.MainModule/app.config b/mseedChart.MainModule/app.config new file mode 100644 index 0000000..106b5c4 --- /dev/null +++ b/mseedChart.MainModule/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/mseedChart.MainModule/mseedChart.MainModule.csproj b/mseedChart.MainModule/mseedChart.MainModule.csproj new file mode 100644 index 0000000..3c7d913 --- /dev/null +++ b/mseedChart.MainModule/mseedChart.MainModule.csproj @@ -0,0 +1,134 @@ + + + + + Debug + AnyCPU + {6B5392C6-3D2D-4890-A0BF-F5F9F84CD867} + Library + mseedChart.MainModule + mseedChart.MainModule + v4.7 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + False + C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LibNET4\Arction.DirectX.dll + + + False + C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LicenseManager\Arction.Licensing.dll + + + False + C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LibNET4\Arction.WinForms.Charting.LightningChart.dll + + + False + C:\Program Files (x86)\Arction\LightningChart .NET SDK v.10\LibNET4\Arction.Wpf.ChartingMVVM.LightningChart.dll + + + ..\packages\DryIoc.dll.4.7.7\lib\net45\DryIoc.dll + + + ..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.39\lib\net45\Microsoft.Xaml.Behaviors.dll + + + ..\packages\Prism.Core.8.0.0.1909\lib\net47\Prism.dll + + + ..\packages\Prism.DryIoc.8.0.0.1909\lib\net47\Prism.DryIoc.Wpf.dll + + + ..\packages\Prism.Wpf.8.0.0.1909\lib\net47\Prism.Wpf.dll + + + + + + + + + + + + 4.0 + + + + + + + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + ChartPlotView.xaml + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + MSBuild:Compile + Designer + + + + \ No newline at end of file diff --git a/mseedChart.MainModule/packages.config b/mseedChart.MainModule/packages.config new file mode 100644 index 0000000..681992f --- /dev/null +++ b/mseedChart.MainModule/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/mseedChart.sln b/mseedChart.sln new file mode 100644 index 0000000..55ed91c --- /dev/null +++ b/mseedChart.sln @@ -0,0 +1,49 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32922.545 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mseedChart", "mseedChart\mseedChart.csproj", "{7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mseedChart.Main", "mseedChart.Main\mseedChart.Main.csproj", "{3F7895B1-A41A-4245-B54E-FE65440E070B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mseedChart.Core", "mseedChart.Core\mseedChart.Core.csproj", "{4A973AC0-90A5-4652-8F8F-AB6DCA59D906}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp1", "WpfApp1\WpfApp1.csproj", "{92B5468F-C7FF-4295-A8D1-BE9B117C2287}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mseedChart.MainModule", "mseedChart.MainModule\mseedChart.MainModule.csproj", "{6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A0008BD-0B8D-41AE-AB09-36DCDA7FAF93}.Release|Any CPU.Build.0 = Release|Any CPU + {3F7895B1-A41A-4245-B54E-FE65440E070B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3F7895B1-A41A-4245-B54E-FE65440E070B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3F7895B1-A41A-4245-B54E-FE65440E070B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3F7895B1-A41A-4245-B54E-FE65440E070B}.Release|Any CPU.Build.0 = Release|Any CPU + {4A973AC0-90A5-4652-8F8F-AB6DCA59D906}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A973AC0-90A5-4652-8F8F-AB6DCA59D906}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A973AC0-90A5-4652-8F8F-AB6DCA59D906}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A973AC0-90A5-4652-8F8F-AB6DCA59D906}.Release|Any CPU.Build.0 = Release|Any CPU + {92B5468F-C7FF-4295-A8D1-BE9B117C2287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92B5468F-C7FF-4295-A8D1-BE9B117C2287}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92B5468F-C7FF-4295-A8D1-BE9B117C2287}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92B5468F-C7FF-4295-A8D1-BE9B117C2287}.Release|Any CPU.Build.0 = Release|Any CPU + {6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B5392C6-3D2D-4890-A0BF-F5F9F84CD867}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {617DC9D3-CA13-450B-9B17-161EA112D4F4} + EndGlobalSection +EndGlobal diff --git a/mseedChart/App.xaml b/mseedChart/App.xaml new file mode 100644 index 0000000..704371f --- /dev/null +++ b/mseedChart/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/mseedChart/App.xaml.cs b/mseedChart/App.xaml.cs new file mode 100644 index 0000000..1d35af5 --- /dev/null +++ b/mseedChart/App.xaml.cs @@ -0,0 +1,26 @@ +using mseedChart.Views; +using Prism.Ioc; +using Prism.Modularity; +using System.Windows; + +namespace mseedChart +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App + { + protected override Window CreateShell() + { + return Container.Resolve(); + } + + protected override void RegisterTypes(IContainerRegistry containerRegistry) + { + } + protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog) + { + moduleCatalog.AddModule(); + } + } +} diff --git a/mseedChart/ViewModels/MainWindowViewModel.cs b/mseedChart/ViewModels/MainWindowViewModel.cs new file mode 100644 index 0000000..b90900d --- /dev/null +++ b/mseedChart/ViewModels/MainWindowViewModel.cs @@ -0,0 +1,19 @@ +using Prism.Mvvm; + +namespace mseedChart.ViewModels +{ + public class MainWindowViewModel : BindableBase + { + private string _title = "Prism Application"; + public string Title + { + get { return _title; } + set { SetProperty(ref _title, value); } + } + + public MainWindowViewModel() + { + + } + } +} diff --git a/mseedChart/Views/MainWindow.xaml b/mseedChart/Views/MainWindow.xaml new file mode 100644 index 0000000..fa79034 --- /dev/null +++ b/mseedChart/Views/MainWindow.xaml @@ -0,0 +1,11 @@ + + + + + diff --git a/mseedChart/Views/MainWindow.xaml.cs b/mseedChart/Views/MainWindow.xaml.cs new file mode 100644 index 0000000..614a035 --- /dev/null +++ b/mseedChart/Views/MainWindow.xaml.cs @@ -0,0 +1,15 @@ +using System.Windows; + +namespace mseedChart.Views +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/mseedChart/mseedChart.csproj b/mseedChart/mseedChart.csproj new file mode 100644 index 0000000..9dbeaff --- /dev/null +++ b/mseedChart/mseedChart.csproj @@ -0,0 +1,20 @@ + + + WinExe + net5.0-windows + true + + + + + + + + + + + + Always + + + \ No newline at end of file diff --git a/mseedChart/resources/N3102_staion_20230312.txt b/mseedChart/resources/N3102_staion_20230312.txt new file mode 100644 index 0000000..44e29f0 --- /dev/null +++ b/mseedChart/resources/N3102_staion_20230312.txt @@ -0,0 +1,25 @@ +net,sta,x2000,y2000,z2000,sens,begin,stop +HA,N02,38397345.33,4030593.53,1074,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N03,38397862.83,4030967.95,1057.7,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N04,38396851.28,4030947.41,1054,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N05,38397197.82,4031016.84,1071,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N06,38397507.28,4030786.06,1094.7,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N07,38397699.97,4030514.93,1091.6,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N08,38398102.95,4030707.82,1047.6,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N09,38396697.57,4030703.24,1053,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N10,38397284.87,4029883.38,1028,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N11,38397556.54,4030474.46,1092,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N12,38397781.42,4030319.64,1089.2,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N13,38397278.9,4030358.92,1050,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N14,38396943.47,4030453.01,1055,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N15,38396715.18,4030230.58,1030,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N16,38397420.7,4030035.82,1033,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N17,38397876.31,4030039.78,1133.3,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N18,38398199.8,4030163.99,1031,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N19,38397094.27,4030709.07,1076,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N20,38397529.8,4029760.44,1057.9,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N22,38398196.3,4029830.94,1056.3,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N23,38398363.7,4030000.55,1066.7,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N24,38397820.92,4029713.54,1056.5,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N26,38397120.98,4029641.15,1006,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 +HA,N27,38397672.11,4031001.47,1068.1,1600000000,2023-03-12T00:00:00.000,2023-12-21T23:59:59.000 \ No newline at end of file