Beispiel #1
0
        /// <summary>
        /// Generate a compact element for an atom, such as a circle or a square,
        /// rather than text element.
        /// </summary>
        /// <param name="atom">the atom to generate the compact element for</param>
        /// <param name="model">the renderer model</param>
        /// <returns>a compact rendering element</returns>
        public virtual IRenderingElement GenerateCompactElement(IAtom atom, RendererModel model)
        {
            var    point    = atom.Point2D.Value;
            double radius   = model.GetAtomRadius() / model.GetScale();
            double distance = 2 * radius;

            if (model.GetCompactShape() == AtomShapeType.Square)
            {
                return(new RectangleElement(
                           new WPF.Point(point.X - radius, point.Y - radius),
                           distance, distance,
                           true, GetAtomColor(atom, model)));
            }
            else
            {
                return(new OvalElement(ToPoint(point), radius, true, GetAtomColor(atom, model)));
            }
        }