/// <summary> /// Determines the proper pixel color for a given BioSymbol. /// </summary> /// <param name="bioSymbol"></param> /// <returns></returns> private int GetPixelColor(IBioSymbol bioSymbol) { // None translates to whitespace. if (bioSymbol.Type == Data.BioSymbolType.None) { return(_whiteBlock); } if (_parent != null && _parent.NucleotideColorSelector != null) { return(ColorToInt(_parent.NucleotideColorSelector.GetSymbolColor(bioSymbol))); } // Fallback for testing. switch (bioSymbol.Value) { case 'A': return(ColorToInt(Colors.Red)); case 'G': return(ColorToInt(Colors.Green)); case 'U': return(ColorToInt(Colors.Blue)); case 'I': return(ColorToInt(Colors.RosyBrown)); default: return(_whiteBlock); } }
public override Brush GetSymbolBrush(IBioSymbol symbol) { TextAttributes ta = new TextAttributes(); _options.GetAttributes(symbol, ref ta); return(ta.Foreground); }
public CircleBasePairViewModel(CircleSequenceViewModel sequence, IBasePairEntity basePair) { _basePairEntity = basePair; _fivePrimeNt = sequence.Sequence.RawData[_basePairEntity.FivePrimeIndex]; _threePrimeNt = sequence.Sequence.RawData[_basePairEntity.ThreePrimeIndex]; Connector = sequence.ComputeBinaryConnector(FivePrimeIndex, ThreePrimeIndex, MAX_RADIUS_FACTOR); }
public CircleElementViewModel(IBioSymbol symbol, int index, int nextIndex, Point start, Point end, double circleRadius, double rayAngle) { Symbol = symbol; Index = index; NextIndex = nextIndex; Position = start; NextPosition = end; _rayAngle = rayAngle; }
public bool AddSymbol(IBioSymbol s) { Debug.Assert(Validator != null); if (Validator.IsValid(s)) { _rawData.Add(s); return(true); } return(false); }
/// <summary> /// Returns the proper color for a given symbol /// </summary> /// <param name="bioSymbol">BioSymbol</param> /// <returns>Brush</returns> public Brush GetNucleotideColor(IBioSymbol bioSymbol) { Brush brush; return(_nucleotideColors.TryGetValue(bioSymbol.Value, out brush) ? brush : (_nucleotideColors.TryGetValue(Char.ToUpper(bioSymbol.Value), out brush) ? brush : Brushes.Black)); }
public override Color GetSymbolColor(IBioSymbol symbol) { TextAttributes ta = new TextAttributes(); _options.GetAttributes(symbol, ref ta); if (ta.Foreground is SolidColorBrush) { SolidColorBrush scb = (SolidColorBrush)ta.Foreground; return(scb.Color); } return(Colors.Black); }
public SSSymbolViewModel(IBioSymbol symbol, int index, FontFamily fontFace, FontStyle fontStyle, FontWeight fontWeight, Brush color, double fontSize, double centerX, double centerY) { Symbol = symbol; Index = index; Color = color; FontSize = fontSize; Typeface = new Typeface(fontFace, fontStyle, fontWeight, FontStretches.Normal); var renderedElement = new FormattedText(symbol.ToString().Substring(0, 1), CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, Typeface, FontSize, Brushes.Black); Width = renderedElement.WidthIncludingTrailingWhitespace; Height = renderedElement.Height; X = centerX - (0.5 * Width); Y = centerY - (0.5 * renderedElement.Baseline); }
private static IBioSymbol CharacterToBioSymbol(IBioValidator bioValidator, char ch) { IBioSymbol symbol = null; switch (ch) { case '~': case '|': symbol = BioSymbol.None; break; case '-': symbol = BioSymbol.Gap; break; default: if (bioValidator.IsValid(ch)) { symbol = new BioSymbol(BioSymbolType.Nucleotide, ch); } break; } return(symbol); }
public override TextAttributes GetSequenceAttributes(IList <IBioSymbol> symbols, int start, out bool canMergeDuplicates) { TextAttributes defaultAttributes = new TextAttributes(); IBioSymbol symbol = symbols[start]; canMergeDuplicates = true; if (_mainVm.SelectedReferenceSequences.Count > 0 && symbol.Type != BioSymbolType.None && symbol.Type != BioSymbolType.Missing) { if (_mainVm.SelectedReferenceSequences.Where(rs => rs.AlignedData == symbols).FirstOrDefault() == null) { canMergeDuplicates = false; var rs = _mainVm.SelectedReferenceSequences.FirstOrDefault(seq => seq.AlignedData[start].Value == symbol.Value); if (rs != null) { defaultAttributes.Background = rs.ReferenceSequenceColor; } } } _options.GetAttributes(symbol, ref defaultAttributes); return(defaultAttributes); }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <returns> /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false. /// </returns> /// <param name="other">An object to compare with this object. /// </param> public bool Equals(IBioSymbol other) { return((other == null) ? false : other.Value == _value); }
/// <summary> /// Sets the nucelotide attributes from the selected options /// </summary> /// <param name="bioSymbol"></param> /// <param name="ta"></param> public void GetAttributes(IBioSymbol bioSymbol, ref TextAttributes ta) { ta.Foreground = GetNucleotideColor(bioSymbol); }
public abstract Color GetSymbolColor(IBioSymbol symbol);
public abstract Brush GetSymbolBrush(IBioSymbol symbol);
public bool IsValid(IBioSymbol bioSymbol) { return(IsValid(bioSymbol.Value) && _validTypes.Contains(bioSymbol.Type)); }
public NestedElementViewModel(NestedViewModel parent, IBioSymbol symbol, int index) : base(parent) { Symbol = symbol; Index = index; ComputePosition(); }