public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append($"{Text}");
            sb.Append(" ");
            sb.Append($"at {PointHelper.AsString(BoundingBox.Location)}");
            sb.Append(" ");
            sb.Append($"size {SafeDouble.AsString4(BoundingBox.Size.Width)}x{SafeDouble.AsString4(BoundingBox.Size.Height)}");
            return(sb.ToString());
        }
Beispiel #2
0
        public override string ToString()
        {
            string result = $"{Style} from {PointHelper.AsString(Start)} to {PointHelper.AsString(End)}";

            if (Bond != null)
            {
                result += $" [{Bond}]";
            }

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Checks to make sure the internals of the molecule haven't become busted up.
        /// </summary>
        public List <string> CheckIntegrity()
        {
            var mols   = GetAllMolecules();
            var result = new List <string>();

            foreach (Molecule mol in mols)
            {
                result.AddRange(mol.CheckIntegrity());
            }

            var atoms = GetAllAtoms().ToList();

            foreach (var atom in atoms)
            {
                var matches = atoms.Where(a => a.Id != atom.Id && SamePoint(atom.Position, a.Position, MeanBondLength * Globals.BondOffsetPercentage)).ToList();
                if (matches.Any())
                {
                    var plural  = matches.Count > 1 ? "s" : "";
                    var clashes = matches.Select(a => a.Id);
                    result.Add($"Atom {atom.Id} - {atom.Element.Symbol} @ {PointHelper.AsString(atom.Position)} clashes with atom{plural} {string.Join(",", clashes)}");
                }
            }

            // Local Function
            bool SamePoint(Point a, Point b, double tolerance)
            {
                bool samePoint;

                if (a.Equals(b))
                {
                    samePoint = true;
                }
                else
                {
                    Vector v = a - b;
                    samePoint = v.Length <= tolerance;
                }

                return(samePoint);
            }

            return(result);
        }
Beispiel #4
0
        public override string ToString()
        {
            var symbol = Element != null ? Element.Symbol : "???";

            return($"Atom {Id} - {Path}: {symbol} @ {PointHelper.AsString(Position)}");
        }
Beispiel #5
0
 public override string ToString()
 {
     return($"{Character.Character} of {ParentAtom} @ {PointHelper.AsString(Position)}");
 }