private void flipAndReverseToolStripMenuItem_Click(object sender, EventArgs e) { var selectedNode = treeViewMain.SelectedNode; var parent = treeViewMain.Nodes["NodeTilt"]; var original = selectedNode.Tag as TiltData; if (original == null) { return; } var tilt = original.Copy(); var uniqeName = FindUniqeName(selectedNode.Name + "_flippedreversed", treeViewMain.Nodes["NodeTilt"]); if (InputPrompt.InputStringBox("Flip and Reverse", "Enter a name.", ref uniqeName) != DialogResult.OK) { return; } tilt.Rename(uniqeName); tilt.FlipThenReverse(); AddNode(uniqeName, parent, tilt); var form2 = new ChartPlot(tilt.Title, tilt) { MdiParent = this }; form2.Show(); }
private void tsKarousHjelt_Click(object sender, EventArgs e) { var selectedNode = treeViewMain.SelectedNode; var tiltData = selectedNode.Tag as TiltData; if (tiltData == null) { return; } if (tiltData.Npts < 6) { MessageBox.Show(@"There should be minimum of 7 data for this filter to work."); return; } var uniqeName = FindUniqeName(selectedNode.Name, treeViewMain.Nodes["NodeKH"]); if (InputPrompt.InputStringBox("Karous Hjelt-Filter", "Enter a name.", ref uniqeName) != DialogResult.OK) { return; } var skin = 0f; if ( InputPrompt.InputNumberBox("Karous Hjelt-Filter", $"Skin depth normalization. Enter 0 to ignore skin depth", ref skin) != DialogResult.OK) { return; } var kh = VlfFilter.KarousHjelt(tiltData, skin); kh.Rename(uniqeName); AddNode(uniqeName, treeViewMain.Nodes["NodeKH"], kh); if (kh.RawLength > 150) { MessageBox.Show( @"Due to the limitation of gridding implementation in this version, the pseudosection could not be shown. However, you can still export the result into an external file.", @"Data Too Large To Grid", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } StartGriddingWorker(new Surface2D(kh)); }
private void tsbMovAvg_Click(object sender, EventArgs e) { var selectedNode = treeViewMain.SelectedNode; var parent = treeViewMain.Nodes["NodeTilt"]; var order = 3; if (InputPrompt.InputNumberBox("Moving Average Filter", "Filter Order", ref order) != DialogResult.OK) { return; } var data = selectedNode.Tag as TiltData; if (data != null && ((Math.Abs(order)) <= 1 || order > data.Npts)) { MessageBox.Show(@"Invalid filter order.", @"Error"); return; } if (data == null) { return; } var newname = FindUniqeName($"{selectedNode.Name}_MovAvg Order {Convert.ToInt32(order)}", parent); if (InputPrompt.InputStringBox("Moving Average Filter", "Enter a name.", ref newname) != DialogResult.OK) { return; } var smooth = VlfFilter.MovingAverage(data, Convert.ToInt32(order)); smooth.Rename(newname); AddNode(newname, parent, smooth); var form2 = new ChartPlot(newname, smooth) { MdiParent = this }; form2.Show(); }
private void tsFraserFilter_Click(object sender, EventArgs e) { var selectedNode = treeViewMain.SelectedNode; var tiltData = selectedNode.Tag as TiltData; if (tiltData == null) { return; } if (tiltData.Npts < 4) { MessageBox.Show(@"There should be minimum of 4 data for this filter to work."); return; } var uniqeName = FindUniqeName(selectedNode.Name, treeViewMain.Nodes["NodeFraser"]); if (InputPrompt.InputStringBox("Fraser Filter", "Enter a name.", ref uniqeName) != DialogResult.OK) { return; } // Do Fraser Filtering var fraser = VlfFilter.Fraser(tiltData); fraser.Rename(uniqeName); AddNode(uniqeName, treeViewMain.Nodes["NodeFraser"], fraser); // Plot the result var form2 = new ChartPlot(uniqeName, fraser) { MdiParent = this }; form2.Show(); }
private void usingKarousHjeltToolStripMenuItem_Click(object sender, EventArgs e) { var nodes = (from TreeNode node in treeViewMain.Nodes["NodeTilt"].Nodes select(TreeNode) node.Clone()).ToList(); var form2 = new TreeInput(nodes); var dlg = form2.ShowDialog(); if (dlg != DialogResult.OK) { return; } var nodeName = "Untitled"; if (InputPrompt.InputStringBox("2D Surface", "Enter a name.", ref nodeName) != DialogResult.OK) { return; } // Collect all tiltdata from treeview IList <TiltData> gather = (from TreeNode node in form2.treeView1.Nodes where node.Checked select node.Tag as TiltData).ToList(); //Build using Fraser filter var surf2D = new Surface2D(gather, Surface2D.FilterType.KarousHjelt) { Title = nodeName, XAxisTitle = "Easting", YAxisTitle = "Northing", XUnit = "m", YUnit = "m" }; nodeName = FindUniqeName(nodeName, treeViewMain.Nodes["Node2DSurface"]); StartGriddingWorker(surf2D); AddNode(nodeName, treeViewMain.Nodes["Node2DSurface"], surf2D); }
private void tsInterpolate_Click(object sender, EventArgs e) { var selectedNode = treeViewMain.SelectedNode; var data = selectedNode.Tag as TiltData; if (data == null) { return; } var spacing = Convert.ToSingle(Math.Floor(data.Spacing)); if (InputPrompt.InputNumberBox("Cubic Spline Interpolation", "Enter the new spacing", ref spacing) != DialogResult.OK) { return; } var npt = Convert.ToInt32(((data.Distances.Max() - data.Distances.Min()) / spacing) + 1); if ( InputPrompt.InputNumberBox("Cubic Spline Interpolation", "Enter the new npts (number of points).", ref npt) != DialogResult.OK) { return; } if ((data.Distances.Min() + ((npt - 1) * spacing) > data.Distances.Max())) { var dlg = MessageBox.Show(@"The new interpolated max distances will exceed the original max distances." + $"{Environment.NewLine}" + $"{Environment.NewLine}Original: {data.Distances.Max()} m, Interpolated: {data.Distances.Min() + ((npt - 1)*spacing)} m." + $"{Environment.NewLine}" + $"{Environment.NewLine}Do you want to continue?", @"Exceed Original Max Distances", MessageBoxButtons.YesNo, MessageBoxIcon.Question); Debug.WriteLine((data.Distances.Min() + (npt * spacing))); if (dlg == DialogResult.No) { return; } } var newname = FindUniqeName($"{selectedNode.Name}_Interpolated", treeViewMain.Nodes["NodeTilt"]); if (InputPrompt.InputStringBox("Cubic Spline Interpolation", "Enter a name.", ref newname) != DialogResult.OK) { return; } var tiltData = VlfInterpolation.CubicSplineNatural(data, Convert.ToSingle(spacing), npt); tiltData.Rename(newname); AddNode(newname, treeViewMain.Nodes["NodeTilt"], tiltData); var form2 = new ChartPlot(newname, tiltData) { MdiParent = this }; form2.Show(); }