public BondAnnotation(AtomDataPoint a1, AtomDataPoint a2, DefaultScatterSeries associatedSeries)
 {
     StartPoint       = a1;
     EndPoint         = a2;
     Color            = OxyColor.Parse(Settings.Instance.BondColor);
     StrokeThickness  = Settings.Instance.BondThickness;
     Layer            = AnnotationLayer.BelowSeries;
     Tag              = $"{a1.Atom.Title} - {a2.Atom.Title} ({a1}, {a2})";
     AssociatedSeries = associatedSeries;
 }
    public BondAnnotation CreateBondAnnotation(AtomDataPoint a1, AtomDataPoint a2)
    {
        var src        = ItemsSource.Cast <AtomDataPoint>().ToList();
        var annotation = new BondAnnotation(
            src.FirstOrDefault(s => s.Atom.Title == a1.Atom.Title && Math.Abs(s.X - a1.X) < 1) !,
            src.FirstOrDefault(s => s.Atom.Title == a2.Atom.Title && Math.Abs(s.X - a2.X) < .51) !,
            this)
        {
            Opacity = 255
        };

        if (!Title.Contains("Simulation"))
        {
            return(annotation);
        }

        annotation.Opacity = (byte)Math.Round(255u * Settings.Instance.SimulationOpacity);
        annotation.Color   = OxyColor.Parse(Settings.Instance.SimulationBondColor);
        return(annotation);
    }