public void AddSpans(Span[] list, double weight, double H) { Catenary last = null; if (Spans.Count > 0) { last = Spans.Last(); weight = last.CableWeight; H = last.HorizontalTension; } RaiseListChangedEvents = false; for (int i = 0; i < list.Length; i++) { var cat = new Catenary(list[i], weight, H); if (last != null) { cat.StartPosition = last.EndPosition; } Spans.Add(cat); last = cat; } RaiseListChangedEvents = true; OnRulingSpanChange(new ItemChangeEventArgs()); }
// METHODS // -> Basic section handling: public void JustAddSpan() { UserSpan newSpan = new UserSpan(); // add span at the end of current section newSpan.PropertyChanged += OnUserSpanPropertyChanged; Spans.Add(newSpan); OrderingSection(); SelectedUserSpan = Spans.Last(); }
private void OrderingSection() { int index = 0; foreach (UserSpan span in Spans) { index++; span.OrdinalIndex = index; span.IsLastSpan = false; } Spans.Last().IsLastSpan = true; }
public void JustRemoveSpan() // removes last span { if (Spans.Count <= 2) { return; } Spans.Last().PropertyChanged -= OnUserSpanPropertyChanged; Spans.Remove(Spans.Last()); OrderingSection(); if (EvaluateNeedToPerformInternalIntegrityCheck()) { CheckInternalIntegrity(); } }
public void ClearBackToBasicSection() { int index = Spans.Count - 1; UserSpan span; if (Spans.Count > 2) { do { span = Spans.Last(); span.PropertyChanged -= OnUserSpanPropertyChanged; Spans.Remove(span); index--; } while (index > 1); } foreach (UserSpan remainingSpan in Spans) { remainingSpan.Clear(); } OrderingSection(); _light = IndicatorLight.None; }