public CharacteristicQuantificationDetailsWpfControl(AimTemplateTreeCharacteristicQuantification characteristicQuantification) { CharacteristicQuantification = characteristicQuantification; InitializeComponent(); _originalBackground = Background; _charQuantifiactionName.Text = string.IsNullOrEmpty(characteristicQuantification.Name) ? @"Characteristic name is missing:" : "Characteristic for " + characteristicQuantification.Name + ":"; _quantificationType = IdentifyCharQuantificationType(); Loaded += CharacteristicQuantificationDetailsWpfControlLoaded; }
/// <summary> /// Matches an AimTempalteTreeCharacteristicQuantification from to a characteristic quantification from aim4_dotnet.annotation /// ICharacteristicQuantification collection /// </summary> /// <param name="annotationCharacteristicQuantifications"></param> /// <param name="templateTreeCharacteristicQuantification"></param> /// <returns></returns> public static AimTemplateTreeCharacteristicQuantification ReadBackCharacteristicQuantificationFromAnnotation(List<aim4_dotnet.CharacteristicQuantification> annotationCharacteristicQuantifications, AimTemplateTreeCharacteristicQuantification templateTreeCharacteristicQuantification) { if (annotationCharacteristicQuantifications != null && annotationCharacteristicQuantifications.Count > 0) { aim4_dotnet.NonQuantifiable nonQuantifiable = annotationCharacteristicQuantifications.OfType<aim4_dotnet.NonQuantifiable>().FirstOrDefault(); if (nonQuantifiable != null) { StandardCodedTerm matchingNonQuantifiable = templateTreeCharacteristicQuantification.NonQuantifiables.FirstOrDefault( nonQuant => AimDotNetNonQuantifiableEqualsTemplateTreeNonQuantifiable(nonQuantifiable, nonQuant)); if (matchingNonQuantifiable != null) templateTreeCharacteristicQuantification.SelectedNonQuantifiable = matchingNonQuantifiable; } else { if (templateTreeCharacteristicQuantification is AimTemplateTreeScaleQuantification) { var scaleQuantification = templateTreeCharacteristicQuantification as AimTemplateTreeScaleQuantification; aim4_dotnet.Scale matchingScale = annotationCharacteristicQuantifications.OfType<aim4_dotnet.Scale>().FirstOrDefault(); if (matchingScale != null) { var matchingTreeScaleLevel = scaleQuantification.Scale.ScaleLevels.FirstOrDefault( scaleLevel => AimDotNetScaleEqualsTemplateTreeScaleLevel(matchingScale, scaleLevel)); scaleQuantification.SelectedScaleLevel = matchingTreeScaleLevel; } else return null; } if (templateTreeCharacteristicQuantification is AimTemplateTreeQuantileQuantification) { var quantileQuantification = templateTreeCharacteristicQuantification as AimTemplateTreeQuantileQuantification; var quantile = annotationCharacteristicQuantifications.OfType<aim4_dotnet.Quantile>().FirstOrDefault(); if (quantile != null) { quantileQuantification.SelectedBin = quantile.SelectedBin; // TODO - add other bin attributes } else return null; } if (templateTreeCharacteristicQuantification is AimTemplateTreeIntervalQuantification) { var intervalQuantification = templateTreeCharacteristicQuantification as AimTemplateTreeIntervalQuantification; var matchingInterval = annotationCharacteristicQuantifications.OfType<aim4_dotnet.Interval>().FirstOrDefault(); if (matchingInterval != null) { var matchingTreeInterval = intervalQuantification.Intervals.FirstOrDefault( interval => AimDotNetIntervalEqualsTemplateTreeInterval(matchingInterval, interval)); intervalQuantification.SelectedInterval = matchingTreeInterval; } else return null; } if (templateTreeCharacteristicQuantification is AimTemplateTreeNumericalQuantification) { var numericalQuantification = templateTreeCharacteristicQuantification as AimTemplateTreeNumericalQuantification; var matchingNumerical = annotationCharacteristicQuantifications.OfType<aim4_dotnet.Numerical>().FirstOrDefault(); if (matchingNumerical != null) { var matchingTreeNumerical = numericalQuantification.Numericals.FirstOrDefault( numerical => AimDotNetNumericalEqualsTemplateTreeNumerical(matchingNumerical, numerical)); numericalQuantification.SelectedNumerical = matchingTreeNumerical; } else return null; } } } return templateTreeCharacteristicQuantification; }
public QuantificationConfidenceWpfControl(AimTemplateTreeCharacteristicQuantification quantification) { Quantification = quantification; InitializeComponent(); }