private void UpdateNumberOfWhiskers() { int startIndex = 1; if (ViewModel.IncludeNosePoint) { startIndex = -1; } ObservableCollection <IWhiskerClipSettings> whiskers = new ObservableCollection <IWhiskerClipSettings>(); for (int index = startIndex; index <= ViewModel.NumberOfWhiskers; index++) { string name; bool isGeneric; int numberOfPoints = SelectedNumberOfPointsPerWhisker; if (index == -1) { name = "Nose Point"; isGeneric = true; numberOfPoints = 1; } else if (index == 0) { if (!ViewModel.IncludeOrientationPoint) { continue; } name = "Orientation Point"; isGeneric = true; numberOfPoints = 1; } else { name = "Whisker " + index; isGeneric = false; } IWhiskerClipSettings whisker = ModelResolver.Resolve <IWhiskerClipSettings>(); whisker.WhiskerId = index; whisker.WhiskerName = name; whisker.IsGenericPoint = isGeneric; whisker.NumberOfPoints = numberOfPoints; whiskers.Add(whisker); } if (GenericPoints.Count > 0) { int genericStartId = ViewModel.NumberOfWhiskers + 1; int delta = genericStartId - GenericPoints.Min(x => x.WhiskerId); foreach (IWhiskerClipSettings genericWhisker in GenericPoints) { genericWhisker.WhiskerId += delta; whiskers.Add(genericWhisker); } } Whiskers = whiskers; }
public WhiskerClipSettingsXml(IWhiskerClipSettings whiskerClipSettings) { WhiskerId = whiskerClipSettings.WhiskerId; WhiskerName = whiskerClipSettings.WhiskerName; IsGenericPoint = whiskerClipSettings.IsGenericPoint; NumberOfPoints = whiskerClipSettings.NumberOfPoints; }
private void AddPoint() { IWhiskerClipSettings whisker = ModelResolver.Resolve <IWhiskerClipSettings>(); whisker.IsGenericPoint = true; whisker.NumberOfPoints = 1; int genericStartId = ViewModel.NumberOfWhiskers + 1; genericStartId += GenericPoints.Count; whisker.WhiskerId = genericStartId; whisker.WhiskerName = "Point " + (GenericPoints.Count + 1); AddWhisker(whisker); GenericPoints.Add(whisker); RemovePointCommand.RaiseCanExecuteChangedNotification(); }
private void AddWhisker(IWhiskerClipSettings whisker) { Whiskers.Add(whisker); OkCommand.RaiseCanExecuteChangedNotification(); }