/// <summary>
        /// Returns the outline of the node.
        /// </summary>
        /// <remarks>
        /// Overriding this method will yield proper hit tests and edge intersection tests.
        /// </remarks>
        /// <param name="node"></param>
        /// <returns></returns>
        protected override GeneralPath GetOutline(INode node)
        {
            var path = new GeneralPath();

            path.AppendEllipse(node.Layout, false);
            return(path);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the outline of the node, an ellipse in this case
        /// </summary>
        /// <remarks>
        /// This allows for correct edge path intersection calculation, among others.
        /// </remarks>
        protected override GeneralPath GetOutline(INode node)
        {
            var rect    = node.Layout.ToRectD();
            var outline = new GeneralPath();

            outline.AppendEllipse(rect, false);
            return(outline);
        }
Ejemplo n.º 3
0
        protected override GeneralPath GetOutline(INode node)
        {
            double size   = Math.Min(node.Layout.Width, node.Layout.Height);
            RectD  bounds = new RectD(node.Layout.GetCenter().X - size / 2, node.Layout.GetCenter().Y - size / 2, size, size);

            var path = new GeneralPath();

            path.AppendEllipse(bounds, false);
            return(path);
        }
Ejemplo n.º 4
0
        static LogicGateNodeStyle()
        {
            // path for AND nodes
            AndOutlinePath = new GeneralPath();
            AndOutlinePath.MoveTo(0.6, 0);
            AndOutlinePath.LineTo(0.1, 0);
            AndOutlinePath.LineTo(0.1, 1);
            AndOutlinePath.LineTo(0.6, 1);
            AndOutlinePath.QuadTo(0.8, 1.0, 0.8, 0.5);
            AndOutlinePath.QuadTo(0.8, 0.0, 0.6, 0);

            // path for OR nodes
            OrOutlinePath = new GeneralPath();
            OrOutlinePath.MoveTo(0.6, 0);
            OrOutlinePath.LineTo(0.1, 0);
            OrOutlinePath.QuadTo(0.3, 0.5, 0.1, 1);
            OrOutlinePath.LineTo(0.6, 1);
            OrOutlinePath.QuadTo(0.8, 1.0, 0.8, 0.5);
            OrOutlinePath.QuadTo(0.8, 0.0, 0.6, 0);

            // path for NAND nodes
            NandOutlinePath = new GeneralPath();
            NandOutlinePath.MoveTo(0.6, 0);
            NandOutlinePath.LineTo(0.1, 0);
            NandOutlinePath.LineTo(0.1, 1);
            NandOutlinePath.LineTo(0.6, 1);
            NandOutlinePath.QuadTo(0.8, 1.0, 0.8, 0.5);
            NandOutlinePath.QuadTo(0.8, 0.0, 0.6, 0);
            NandOutlinePath.AppendEllipse(new RectD(0.8, 0.4, 0.1, 0.2), false);

            // path for NOR nodes
            NorOutlinePath = new GeneralPath();
            NorOutlinePath.MoveTo(0.6, 0);
            NorOutlinePath.LineTo(0.1, 0);
            NorOutlinePath.QuadTo(0.3, 0.5, 0.1, 1);
            NorOutlinePath.LineTo(0.6, 1);
            NorOutlinePath.QuadTo(0.8, 1.0, 0.8, 0.5);
            NorOutlinePath.QuadTo(0.8, 0.0, 0.6, 0);
            NorOutlinePath.AppendEllipse(new RectD(0.8, 0.4, 0.1, 0.2), false);

            // path for NOT nodes
            NotOutlinePath = new GeneralPath();
            NotOutlinePath.MoveTo(0.8, 0.5);
            NotOutlinePath.LineTo(0.1, 0);
            NotOutlinePath.LineTo(0.1, 1);
            NotOutlinePath.LineTo(0.8, 0.5);
            NotOutlinePath.AppendEllipse(new RectD(0.8, 0.4, 0.1, 0.2), false);
        }