internal static bool UpdateZΔ(TopoPoint3 tp3, TopoPoint3 precedingTp3) { if (!tp3.XYZ.NeedsUpdatingZ && !precedingTp3.XYZ.NeedsUpdatingZ ) { return(false); } tp3.ZΔ = tp3.Z - precedingTp3.Z; return(true); }
internal static bool UpdateYΔ(TopoPoint3 tp3, TopoPoint3 precedingTp3) { if (!tp3.XYZ.NeedsUpdatingY && !precedingTp3.XYZ.NeedsUpdatingY ) { return(false); } tp3.YΔ = tp3.Y - precedingTp3.Y; return(true); }
internal static bool UpdateXΔ(TopoPoint3 tp3, TopoPoint3 precedingTp3) { if (!tp3.XYZ.NeedsUpdatingX && !precedingTp3.XYZ.NeedsUpdatingX ) { return(false); } tp3.XΔ = tp3.X - precedingTp3.X; return(true); }
private void ClickInfo(object sender, RoutedEventArgs e, string fromWho) { ListBox lb = MainWindow.Lb3; TopoPoint3 tp = (TopoPoint3)MainWindow.Lb3.Items[lb.SelectedIndex]; Debug.WriteLine("\n@ MainResource3| @button pressed|" + " from| " + fromWho + " selected idx| " + lb.SelectedIndex + " xyz| " + tp.ToString() + "\n" ); }
private void ListBox3_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox lb3 = sender as ListBox; if (lb3.SelectedIndex < 0) { return; } TopoPoint3 tpt = (TopoPoint3)lb3.Items[lb3.SelectedIndex]; Debug.WriteLine("@ MainResource3| @selectionChanged|" + " selected count| " + e.AddedItems.Count + " selected idx| " + lb3.SelectedIndex ); ((TopoPoint3)lb3.Items[PriorRowBeingEdited]).IsBeingEdited = false; tpt.IsBeingEdited = true; PriorRowBeingEdited = lb3.SelectedIndex; }
internal static void CalcXYΔ(TopoPoint3 tp3) { if (double.IsNaN(tp3.XΔ) || double.IsNaN(tp3.YΔ)) { tp3.XYΔ = double.NaN; return; } if (tp3.XΔ.Equals(0)) { tp3.XYΔ = tp3.YΔ; } else if (tp3.YΔ.Equals(0)) { tp3.XYΔ = tp3.XΔ; } else { tp3.XYΔ = Math.Sqrt(tp3.XΔ * tp3.XΔ + tp3.YΔ * tp3.YΔ); } }
internal static void CalcSlope(TopoPoint3 tp3) { if (double.IsNaN(tp3.ZΔ) || double.IsNaN(tp3.XYΔ) || tp3.XYΔ.Equals(0) ) { tp3.XYZΔ = tp3.XYΔ; tp3.Slope = double.NaN; return; } if (tp3.ZΔ.Equals(0)) { tp3.XYZΔ = tp3.XYΔ; tp3.Slope = 0; return; } tp3.XYZΔ = Math.Sqrt(tp3.XYΔ * tp3.XYΔ + tp3.ZΔ * tp3.ZΔ); tp3.Slope = tp3.ZΔ / tp3.XYΔ; }
private void reindexUpdateItem(int idx, TopoPoint3 precedingtpt3) { Tpts3.Append = "\nafter| @TopoPts3Mgr| got updateItemAfterReindex" + " (" + idx + ")\n"; if (Tpts3[idx].XYZ.NeedsUpdatingX) { Tpts3.Append = "after| @TopoPts3Mgr| (" + idx + ")" + " X | needs updating\n"; } if (Tpts3[idx].XYZ.NeedsUpdatingY) { Tpts3.Append = "after| @TopoPts3Mgr| (" + idx + ")" + " Y | needs updating\n"; } if (Tpts3[idx].XYZ.NeedsUpdatingZ) { Tpts3.Append = "after| @TopoPts3Mgr| (" + idx + ")" + " Z | needs updating\n"; } TopoPoint3 tp3 = Tpts3[idx]; if (double.IsNaN(tp3.X) || double.IsNaN(precedingtpt3.X) || double.IsNaN(tp3.Y) || double.IsNaN(precedingtpt3.Y) || double.IsNaN(tp3.Z) || double.IsNaN(precedingtpt3.Z)) { tp3.Clear(); return; } // update the index if (tp3.Index != idx) { tp3.Index = idx; } // update XΔ bool resultX = Update.UpdateXΔ(tp3, Tpts3[idx - 1]); // updateYΔ bool resultY = Update.UpdateYΔ(tp3, Tpts3[idx - 1]); // updateZΔ Update.UpdateZΔ(tp3, Tpts3[idx - 1]); // XYZ3 updated, XΔ, YΔ, ZΔ updated // need to update XYΔ? if (resultX || resultY) { Update.CalcXYΔ(tp3); } // assumption is that at least one // X or Y or Z changed Update.CalcSlope(tp3); // all updated - adjust flags Tpts3[idx - 1].XYZ.NeedsUpdatingX = false; Tpts3[idx - 1].XYZ.NeedsUpdatingY = false; Tpts3[idx - 1].XYZ.NeedsUpdatingZ = false; Tpts3.Append = "\n"; }