/* * private void AddNullVectorBtn_Click(object sender, RoutedEventArgs e) * { * var x = ParseVectorDouble(this.NullVectorX.Text); * var y = ParseVectorDouble(this.NullVectorY.Text); * var z = ParseVectorDouble(this.NullVectorZ.Text); * * this.ValidateAndAddVector(x, y, z, x, y, z); * } */ private void ValidateAndAddVector(double x1, double y1, double z1, double x2, double y2, double z2) { var vector = new VectorUI(_VectorFactor) { BeginningX = x1, BeginningY = y1, BeginningZ = z1, EndX = x2, EndY = y2, EndZ = z2, }; if (vector.HasValuesExceeding(_VectorLimit)) { Debug.WriteLine(SR.VectorCannotHaveValueBiggerThan.Args(vector, _VectorLimit, _VectorLimit * -1)); return; } foreach (var item in this.Visualizer.Vectors) { var vUI = item as VectorUI; if (vUI.Equals(vector)) { Debug.WriteLine(SR.VectorIsAlreadyDefined.Args(vector)); return; } } vector.Brush = this.NextColor; this.AddVector(vector); }
public bool Equals(VectorUI vector) { return(this.BeginningX == vector.BeginningX && this.BeginningY == vector.BeginningY && this.BeginningZ == vector.BeginningZ && this.EndX == vector.EndX && this.EndY == vector.EndY && this.EndZ == vector.EndZ); }
public void AddVector(VectorUI vector) { foreach (var v in this.Vectors) { var item = v as VectorUI; if (item.Equals(vector)) { throw new Exception(SR.VectorIsAlreadyDefined.Args(vector)); } } vector.ID = "Vector" + this.Vectors.Count; this.Vectors.Add(vector); this.Lines.AddLine(vector); this.UpdateCurrentPage(); this.Lines.ReDraw(); }
private void AddVector(VectorUI vector) { this.Visualizer.AddVector(vector); }