Exemplo n.º 1
0
 /// <summary>
 /// AStar Constructor.
 /// </summary>
 /// <param name="G">The graph on which AStar will perform the search.</param>
 public AStar(Graph G)
 {
     _Graph = G;
     _Open = new SortableList();
     _Closed = new SortableList();
     ChoosenHeuristic = EuclidianHeuristic;
     DijkstraHeuristicBalance = 0.5;
 }
Exemplo n.º 2
0
 /// <summary>
 /// reload db routes
 /// </summary>
 /// <param name="dbpath">string of path to gps database</param>
 public void LoadDataBase(string dbpath)
 {
     try {
         G = new Graph { };  // or do merge?
         this.LoadFromDb(dbpath);
     } catch (Exception eeee) { Err("Can't load paths " + eeee.Message); }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Serialize Graph
 /// </summary>
 /// <param name="G">Graph</param>
 /// <param name="basefile">file name</param>
 public static void StoreToFile(Graph G, string basefile)
 {
     using (Stream StreamWrite = File.Create(basefile))
     {
         BinaryFormatter BinaryWrite = new BinaryFormatter();
         BinaryWrite.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple;
         BinaryWrite.Serialize(StreamWrite, G);
         StreamWrite.Close();
     }
 }