public Netron.Shape ProvideShape(QuickGraph.Concepts.IVertex v)
        {
            Shape shape = (Shape)this.constructor.Invoke(null);
            OnFormatShape(shape,v);

            return shape;
        }
 public static void FormatGraph(object sender, QuickGraph.Algorithms.Graphviz.FormatVertexEventArgs args)
 {
     MyVertex o = (MyVertex) args.Vertex;
     args.VertexFormatter.Label = o.Name;
     args.VertexFormatter.Shape = NGraphviz.Helpers.GraphvizVertexShape.Ellipse;
 }
Esempio n. 3
0
        public void SetChooseEdge(QuickGraph.Concepts.IVertex v, int k, QuickGraph.Concepts.IEdge e)
        {
            if (k==0)
            {
                this.successors.Add(v,new EdgeCollection());
            }

            EdgeCollection col = this.successors[v];
            if (col.Count<=k)
                col.Add(e);
            else
                col[k]=e;
        }
Esempio n. 4
0
 public QuickGraph.Concepts.IEdge ChooseEdge(QuickGraph.Concepts.IVertex state, int i)
 {
     return this.successors[state][i];
 }
        public System.Collections.IEnumerable AdjacentVertices(QuickGraph.Concepts.IVertex v)
        {
            foreach(Edge e in this.vertexOutEdges[v])
                yield return e;

            yield break;
        }
 public int NumOutEdges(QuickGraph.Concepts.IVertex v)
 {
     return this.vertexOutEdges[v].Count;
 }
 /// <summary>
 /// Raises the <see cref="LayEdge"/> event.
 /// </summary>
 /// <param name="e">edge to lay</param>
 /// <param name="sourcePort">source port</param>
 /// <param name="targetPort">target port</param>
 /// <param name="keys">key positions of the spline</param>
 protected void OnLayEdge(
     IEdge e,
     QuickGraph.Concepts.EdgePort sourcePort,
     QuickGraph.Concepts.EdgePort targetPort,
     NGraphviz.Layout.Collections.PointFCollection keys
     )
 {
     if (LayEdge!=null)
         LayEdge(this,new EdgeKeysEventArgs(e,sourcePort,targetPort,keys));
 }
Esempio n. 8
0
 public void UpdateEdge(QuickGraph.Concepts.IEdge v)
 {
 }
Esempio n. 9
0
 public QuickGraph.Concepts.IEdge ProvideEdge(QuickGraph.Concepts.IVertex u, QuickGraph.Concepts.IVertex v)
 {
     return new InterferenceGraphEdge(IdCounter++, (InterferenceGraphNode)u, (InterferenceGraphNode)v);
 }
Esempio n. 10
0
 public void UpdateVertex(QuickGraph.Concepts.IVertex v)
 {
 }
Esempio n. 11
0
    public void createGraphAndNavi()
    {
        QuickGraph g           = new QuickGraph();
        string     currentPath = Application.persistentDataPath;
        string     mapName     = LabelMain.Instance.selectFileName;
        string     fullPath    = currentPath + "/" + mapName + "/";
        string     line;

        using (StreamReader sreader = new StreamReader(fullPath + "distance.txt", Encoding.UTF8)) {
            Dictionary <string, Dictionary <string, float> > buffer = new Dictionary <string, Dictionary <string, float> >();
            while ((line = sreader.ReadLine()) != null)
            {
                if (line == "")
                {
                    break;
                }

                string[] lineSplite;
                lineSplite = line.Split(' ');

                if (buffer.ContainsKey(lineSplite[0]))
                {
                    buffer[lineSplite[0]].Add(lineSplite[1], float.Parse(lineSplite[2]));
                }
                else
                {
                    buffer.Add(lineSplite[0], new Dictionary <string, float>()
                    {
                        { lineSplite[1],
                          float.Parse(lineSplite[2]) }
                    }
                               );
                }

                if (buffer.ContainsKey(lineSplite[1]))
                {
                    buffer[lineSplite[1]].Add(lineSplite[0], float.Parse(lineSplite[2]));
                }
                else
                {
                    buffer.Add(lineSplite[1], new Dictionary <string, float>()
                    {
                        { lineSplite[0],
                          float.Parse(lineSplite[2]) }
                    }
                               );
                }
            }
            sreader.Close();

            foreach (var temp in buffer)
            {
                //Debug.Log("Load: " + temp);
                g.add_vertex(temp.Key, temp.Value);
            }


            string   target = this.transform.parent.name;
            string   start = "start point not found", dest = "dest point not found";
            float    total = 0;
            string[] destSplite;
            string[] startSplite;
            dest = LabelMain.Instance.clickedLabel;
            using (StreamReader sr = new StreamReader(fullPath + "nearistNode.txt", Encoding.UTF8)) {
                line = sr.ReadLine();
                sr.Close();
                if (line != "")
                {
                    startSplite = line.Split(' ');
                    start       = startSplite[1];
                    if (start != dest)
                    {
                        result      = g.shortest_path(start, dest);
                        currentStep = result.Count;
                        Debug.Log("CurStep: " + currentStep);
                        Debug.Log("Navi from " + start + " to " + dest);
                        //Debug.Log("要走幾步:" + result.Count);
                        for (int i = 0; i < result.Count - 1; ++i)
                        {
                            total += buffer[result[i]][result[i + 1]];
                            //Debug.Log(result[i]);
                        }
                        total += buffer[result[result.Count - 1]][start];
                        //Debug.Log(result[result.Count - 1]);
                        //Debug.Log(start);
                        Debug.Log("途經 " + total + "公尺");
                    }
                    else
                    {
                        Debug.Log("已到達目的地!");
                    }
                }
            }
        }
    }
Esempio n. 12
0
 public void UpdateVertex(QuickGraph.Concepts.IVertex v)
 {
     v.ID = IdCounter++;
 }
Esempio n. 13
0
 public void UpdateEdge(QuickGraph.Concepts.IEdge v)
 {
     v.ID = IdCounter++;
 }
Esempio n. 14
0
 public QuickGraph.Concepts.IEdge ProvideEdge(QuickGraph.Concepts.IVertex u, QuickGraph.Concepts.IVertex v)
 {
     return new CFGEdge(IdCounter++, (CFGNode)u, (CFGNode)v);
 }
Esempio n. 15
0
 public void UpdateVertex(QuickGraph.Concepts.IVertex v)
 {
     throw new Exception("The method or operationInfo is not implemented.");
 }
 public bool IsEnabled(QuickGraph.Concepts.Petri.Collections.ITokenCollection tokens)
 {
     return true;
 }