public override object visit(GraphEdge edge)
 {
     m_edges.Add(edge);
       //not looping and not second pass
       if (!edge.IsLoop && edge.From == GraphNode.getFirstNonLoopingPredecessor(edge.To))
       {
     edge.To.getVisited(this);
       }
       return null;
 }
Esempio n. 2
0
 public override object visit(GraphEdge edge)
 {
     m_edges.Add(edge);
     //not looping and not second pass
     if (!edge.IsLoop && edge.From == GraphNode.getFirstNonLoopingPredecessor(edge.To))
     {
         edge.To.getVisited(this);
     }
     return(null);
 }
Esempio n. 3
0
        public override object visit(GraphEdge edge)
        {
            int frm = m_flatter.Nodes.IndexOf(edge.From);
            int to  = m_flatter.Nodes.IndexOf(edge.To);

            m_cmd.CommandText = "INSERT INTO room_connections (frm, too, chid, type) VALUES (" + frm + ", " + to + ",0 , 0);";
            m_cmd.ExecuteNonQuery();
            if (!edge.IsLoop && edge.From == GraphNode.getFirstNonLoopingPredecessor(edge.To))
            {
                edge.To.getVisited(this);
            }
            return(null);
        }
Esempio n. 4
0
 public static GraphNode getFirstNonLoopingPredecessor(GraphNode node)
 {
     //get the non-looping predecessor
     for (int i = 0; i < node.Predecessors.Count; ++i)
     {
         GraphEdge edge = (GraphEdge)node.Predecessors[i];
         if (!edge.IsLoop)
         {
             return(edge.From);
         }
     }
     return(null);
 }
Esempio n. 5
0
        public override object visit(GraphEdge edge)
        {
            if (edge.IsLoop || edge.From != GraphNode.getFirstNonLoopingPredecessor(edge.To))
            {
                return(null);
            }
            object found = edge.To.getVisited(this);

            if (found != null)
            {
                return(found);
            }
            return(null);
        }
Esempio n. 6
0
        public void addEdge(GraphEdge edge)
        {
            //TODO
              //add from to roots if it was not in graph
              //add to to leafs if it was not in graph

              //build connections
              m_leafs.Remove(edge.From);
              //TODO
              if (!edge.IsLoop || edge.From.getRoot() != edge.To.getRoot())
            m_roots.Remove(edge.To);
              edge.From.Successors.Add(edge);
              edge.To.Predecessors.Add(edge);
        }
Esempio n. 7
0
        public void addEdge(GraphEdge edge)
        {
            //TODO
            //add from to roots if it was not in graph
            //add to to leafs if it was not in graph

            //build connections
            m_leafs.Remove(edge.From);
            //TODO
            if (!edge.IsLoop || edge.From.getRoot() != edge.To.getRoot())
            {
                m_roots.Remove(edge.To);
            }
            edge.From.Successors.Add(edge);
            edge.To.Predecessors.Add(edge);
        }
 public override object visit(GraphEdge edge)
 {
     Pen p;
       if (edge.IsLoop)
     p = new Pen(Brushes.Green,2.0f);
       else
     p = new Pen(Brushes.Black);
       p.EndCap = LineCap.ArrowAnchor;
       Point p2 = intersectLineCircle(edge.From.Location, edge.To.Location, edge.To.Location, edge.To.Height/2);
       Point p1 = intersectLineCircle(edge.To.Location, edge.From.Location, edge.From.Location, edge.From.Height/2);
       m_gc.DrawLine(p, p1.X,
     p1.Y,
     p2.X,
     p2.Y);
       if (!edge.IsLoop  && edge.From == GraphNode.getFirstNonLoopingPredecessor(edge.To))
     edge.To.getVisited(this);
       return null;
 }
Esempio n. 9
0
        public Graph(BinaryReader reader) : this()
        {
            m_type = Factory.ObjectType.Graph;
            ArrayList tmpnodes = new ArrayList();
            int       count    = reader.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                GraphNode node = (GraphNode)Factory.makeObject(reader);
                tmpnodes.Add(node);
                addUnconnectedNode(node);
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; ++i)
            {
                GraphEdge edge = (GraphEdge)Factory.makeObject(reader);
                int       from = reader.ReadInt32();
                int       to   = reader.ReadInt32();
                edge.From = (GraphNode)tmpnodes[from];
                edge.To   = (GraphNode)tmpnodes[to];
                addEdge(edge);
            }
        }
 public abstract object visit(GraphEdge edge);
 public override object visit(GraphEdge edge)
 {
     int frm = m_flatter.Nodes.IndexOf(edge.From);
       int to = m_flatter.Nodes.IndexOf(edge.To);
       m_cmd.CommandText = "INSERT INTO room_connections (frm, too, chid, type) VALUES ("+frm+", "+to+",0 , 0);";
       m_cmd.ExecuteNonQuery();
       if (!edge.IsLoop  && edge.From == GraphNode.getFirstNonLoopingPredecessor(edge.To))
     edge.To.getVisited(this);
       return null;
 }
Esempio n. 12
0
        public void connect(GraphNode from, GraphNode to)
        {
            GraphEdge edge = newEdge(from, to);

            addEdge(edge);
        }
Esempio n. 13
0
 public abstract object visit(GraphEdge edge);