Example #1
0
        public override object visit(GraphNode node)
        {
            //draw node
            Pen p;

            if (node == m_selected)
            {
                p = new Pen(Brushes.IndianRed, 2.5f);
            }
            else
            {
                p = new Pen(Brushes.BlueViolet, 1.5f);
            }
            if (node.getRoot() == node)
            {
                p.DashStyle = DashStyle.Dash;
            }
            m_gc.DrawEllipse(p, node.Location.X - node.Width / 2, node.Location.Y - node.Height / 2, node.Width, node.Height);

            //with its text
            m_gc.DrawString(node.Name, new Font(FontFamily.GenericSerif, 8),
                            Brushes.DarkGreen,
                            node.Location.X - node.Name.Length * 3, node.Location.Y - 5);

            //visit edges
            foreach (GraphEdge edge in node.Successors)
            {
                edge.getVisited(this);
            }
            return(null);
        }
        public override object visit(GraphNode node)
        {
            //draw node
              Pen p;
              if (node == m_selected){
            p = new Pen(Brushes.IndianRed,2.5f);
              }
              else
            p = new Pen(Brushes.BlueViolet,1.5f);
              if (node.getRoot() == node)
            p.DashStyle = DashStyle.Dash;
              m_gc.DrawEllipse(p, node.Location.X-node.Width/2, node.Location.Y-node.Height/2, node.Width, node.Height);

              //with its text
              m_gc.DrawString(node.Name, new Font(FontFamily.GenericSerif, 8),
            Brushes.DarkGreen,
            node.Location.X-node.Name.Length*3, node.Location.Y-5);

              //visit edges
              foreach (GraphEdge edge in node.Successors)
              {
            edge.getVisited(this);
              }
              return null;
        }
 public GraphEdge(GraphNode from, GraphNode to)
 {
     m_type = Factory.ObjectType.GraphEdge;
       m_from = from;
       m_to = to;
       if (to.Successors.Count > 0 && to.getRoot() == from.getRoot())
     m_loop = true;
       else
     m_loop = false;
 }
Example #4
0
 public GraphEdge(GraphNode from, GraphNode to)
 {
     m_type = Factory.ObjectType.GraphEdge;
     m_from = from;
     m_to   = to;
     if (to.Successors.Count > 0 && to.getRoot() == from.getRoot())
     {
         m_loop = true;
     }
     else
     {
         m_loop = false;
     }
 }