/** Returns a debug string for this path. */ public virtual string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } // Get a cached string builder for this thread System.Text.StringBuilder text = pathHandler.DebugStringBuilder; text.Length = 0; text.Append(error ? "Path Failed : " : "Path Completed : "); text.Append("Computation Time "); text.Append((duration).ToString(logMode == PathLog.Heavy ? "0.000 ms " : "0.00 ms ")); text.Append("Searched Nodes "); text.Append(searchedNodes); if (!error) { text.Append(" Path Length "); text.Append(path == null ? "Null" : path.Count.ToString()); if (logMode == PathLog.Heavy) { text.Append("\nSearch Iterations " + searchIterations); } } if (error) { text.Append("\nError: "); text.Append(errorLog); } // Can only print this from the Unity thread // since otherwise an exception might be thrown if (logMode == PathLog.Heavy && !AstarPath.active.IsUsingMultithreading) { text.Append("\nCallback references "); if (callback != null) { text.Append(callback.Target.GetType().FullName).AppendLine(); } else { text.AppendLine("NULL"); } } text.Append("\nPath Number "); text.Append(pathID); return(text.ToString()); }
protected void DebugStringPrefix(PathLog logMode, StringBuilder text) { text.Append(this.error ? "Path Failed : " : "Path Completed : "); text.Append("Computation Time "); text.Append(this.duration.ToString((logMode == PathLog.Heavy) ? "0.000 ms " : "0.00 ms ")); text.Append("Searched Nodes ").Append(this.searchedNodes); if (!this.error) { text.Append(" Path Length "); text.Append((this.path == null) ? "Null" : this.path.Count.ToString()); } }
public virtual string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!this.error && logMode == PathLog.OnlyErrors)) { return(string.Empty); } StringBuilder debugStringBuilder = this.pathHandler.DebugStringBuilder; debugStringBuilder.Length = 0; this.DebugStringPrefix(logMode, debugStringBuilder); this.DebugStringSuffix(logMode, debugStringBuilder); return(debugStringBuilder.ToString()); }
/** Returns a debug string for this path. */ public virtual string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } //debugStringBuilder.Length = 0; System.Text.StringBuilder text = runData.DebugStringBuilder; text.Length = 0; text.Append(error ? "Path Failed : " : "Path Completed : "); text.Append("Computation Time "); text.Append((duration).ToString(logMode == PathLog.Heavy ? "0.000 ms " : "0.00 ms ")); text.Append("Searched Nodes "); text.Append(searchedNodes); if (!error) { text.Append(" Path Length "); text.Append(path == null ? "Null" : path.Count.ToString()); if (logMode == PathLog.Heavy) { text.Append("\nSearch Iterations " + searchIterations); text.Append("\nBinary Heap size at complete: "); // -2 because numberOfItems includes the next item to be added and item zero is not used text.Append(runData.open == null ? "null" : (runData.open.numberOfItems - 2).ToString()); } /*"\nEnd node\n G = "+p.endNode.g+"\n H = "+p.endNode.h+"\n F = "+p.endNode.f+"\n Point "+p.endPoint +"\nStart Point = "+p.startPoint+"\n"+"Start Node graph: "+p.startNode.graphIndex+" End Node graph: "+p.endNode.graphIndex+ * "\nBinary Heap size at completion: "+(p.open == null ? "Null" : p.open.numberOfItems.ToString ())*/ } if (error) { text.Append("\nError: "); text.Append(errorLog); } text.Append("\nPath Number "); text.Append(pathID); return(text.ToString()); }
/** Writes text shared for all overrides of DebugString to the string builder. * \see DebugString */ protected void DebugStringPrefix(PathLog logMode, System.Text.StringBuilder text) { text.Append(error ? "Path Failed : " : "Path Completed : "); text.Append("Computation Time "); text.Append(duration.ToString(logMode == PathLog.Heavy ? "0.000 ms " : "0.00 ms ")); text.Append("Searched Nodes ").Append(searchedNodes); if (!error) { text.Append(" Path Length "); text.Append(path == null ? "Null" : path.Count.ToString()); } }
/* String builder used for all debug logging */ //public static System.Text.StringBuilder debugStringBuilder = new System.Text.StringBuilder (); /** Returns a debug string for this path. */ public override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } var text = new System.Text.StringBuilder(); DebugStringPrefix(logMode, text); if (!error && logMode == PathLog.Heavy) { text.Append("\nSearch Iterations " + searchIterations); if (hasEndPoint && endNode != null) { PathNode nodeR = pathHandler.GetPathNode(endNode); text.Append("\nEnd Node\n G: "); text.Append(nodeR.G); text.Append("\n H: "); text.Append(nodeR.H); text.Append("\n F: "); text.Append(nodeR.F); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(endNode.GraphIndex); } text.Append("\nStart Node"); text.Append("\n Point: "); text.Append(((Vector3)startPoint).ToString()); text.Append("\n Graph: "); if (startNode != null) { text.Append(startNode.GraphIndex); } else { text.Append("< null startNode >"); } } DebugStringSuffix(logMode, text); return(text.ToString()); }
static int DebugString(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Pathfinding.Path obj = (Pathfinding.Path)ToLua.CheckObject <Pathfinding.Path>(L, 1); PathLog arg0 = (PathLog)ToLua.CheckObject(L, 2, typeof(PathLog)); string o = obj.DebugString(arg0); LuaDLL.lua_pushstring(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/** Returns a string with information about it. * More information is emitted when logMode == Heavy. * An empty string is returned if logMode == None * or logMode == OnlyErrors and this path did not fail. */ internal virtual string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } // Get a cached string builder for this thread System.Text.StringBuilder text = pathHandler.DebugStringBuilder; text.Length = 0; DebugStringPrefix(logMode, text); DebugStringSuffix(logMode, text); return(text.ToString()); }
/// <summary>Returns a debug string for this path.</summary> internal override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } var text = new System.Text.StringBuilder(); //todo: removed this call to clear up console during testing //DebugStringPrefix(logMode, text); if (!error && logMode == PathLog.Heavy) { if (hasEndPoint && endNode != null) { PathNode nodeR = pathHandler.GetPathNode(endNode); text.Append("\nEnd Node\n G: "); text.Append(nodeR.G); text.Append("\n H: "); text.Append(nodeR.H); text.Append("\n F: "); text.Append(nodeR.F); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(endNode.GraphIndex); } text.Append("\nStart Node"); text.Append("\n Point: "); text.Append(((Vector3)startPoint).ToString()); text.Append("\n Graph: "); if (startNode != null) { text.Append(startNode.GraphIndex); } else { text.Append("< null startNode >"); } } //todo: removed debug call to clear up console //DebugStringSuffix(logMode, text); return(text.ToString()); }
// Token: 0x06002720 RID: 10016 RVA: 0x001AFA28 File Offset: 0x001ADC28 internal override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!base.error && logMode == PathLog.OnlyErrors)) { return(""); } StringBuilder stringBuilder = new StringBuilder(); base.DebugStringPrefix(logMode, stringBuilder); if (!base.error && logMode == PathLog.Heavy) { Vector3 vector; if (this.hasEndPoint && this.endNode != null) { PathNode pathNode = this.pathHandler.GetPathNode(this.endNode); stringBuilder.Append("\nEnd Node\n\tG: "); stringBuilder.Append(pathNode.G); stringBuilder.Append("\n\tH: "); stringBuilder.Append(pathNode.H); stringBuilder.Append("\n\tF: "); stringBuilder.Append(pathNode.F); stringBuilder.Append("\n\tPoint: "); StringBuilder stringBuilder2 = stringBuilder; vector = this.endPoint; stringBuilder2.Append(vector.ToString()); stringBuilder.Append("\n\tGraph: "); stringBuilder.Append(this.endNode.GraphIndex); } stringBuilder.Append("\nStart Node"); stringBuilder.Append("\n\tPoint: "); StringBuilder stringBuilder3 = stringBuilder; vector = this.startPoint; stringBuilder3.Append(vector.ToString()); stringBuilder.Append("\n\tGraph: "); if (this.startNode != null) { stringBuilder.Append(this.startNode.GraphIndex); } else { stringBuilder.Append("< null startNode >"); } } base.DebugStringSuffix(logMode, stringBuilder); return(stringBuilder.ToString()); }
/// <summary> /// Returns a string with information about it. /// More information is emitted when logMode == Heavy. /// An empty string is returned if logMode == None /// or logMode == OnlyErrors and this path did not fail. /// </summary> internal virtual string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } // Get a cached string builder for this thread System.Text.StringBuilder text = pathHandler.DebugStringBuilder; text.Length = 0; //TODO: removed these calls because couldn't figure out how to stop it spamming console during testing //DebugStringPrefix(logMode, text); //DebugStringSuffix(logMode, text); return(text.ToString()); }
public virtual string DebugString(PathLog logMode) { if ((logMode == PathLog.None) || (!this.error && (logMode == PathLog.OnlyErrors))) { return(string.Empty); } StringBuilder debugStringBuilder = this.pathHandler.DebugStringBuilder; debugStringBuilder.Length = 0; debugStringBuilder.Append(!this.error ? "Path Completed : " : "Path Failed : "); debugStringBuilder.Append("Computation Time "); debugStringBuilder.Append(this.duration.ToString((logMode != PathLog.Heavy) ? "0.00 ms " : "0.000 ms ")); debugStringBuilder.Append("Searched Nodes "); debugStringBuilder.Append(this.searchedNodes); if (!this.error) { debugStringBuilder.Append(" Path Length "); debugStringBuilder.Append((this.path != null) ? this.path.Count.ToString() : "Null"); if (logMode == PathLog.Heavy) { debugStringBuilder.Append("\nSearch Iterations " + this.searchIterations); } } if (this.error) { debugStringBuilder.Append("\nError: "); debugStringBuilder.Append(this.errorLog); } if ((logMode == PathLog.Heavy) && !AstarPath.IsUsingMultithreading) { debugStringBuilder.Append("\nCallback references "); if (this.callback != null) { debugStringBuilder.Append(this.callback.Target.GetType().FullName).AppendLine(); } else { debugStringBuilder.AppendLine("NULL"); } } debugStringBuilder.Append("\nPath Number "); debugStringBuilder.Append(this.pathID); return(debugStringBuilder.ToString()); }
public override string DebugString(PathLog logMode) { if ((logMode == PathLog.None) || (!base.error && (logMode == PathLog.OnlyErrors))) { return(string.Empty); } StringBuilder text = new StringBuilder(); base.DebugStringPrefix(logMode, text); if (!base.error && (logMode == PathLog.Heavy)) { text.Append("\nSearch Iterations " + base.searchIterations); if (this.hasEndPoint && (this.endNode != null)) { PathNode pathNode = base.pathHandler.GetPathNode(this.endNode); text.Append("\nEnd Node\n\tG: "); text.Append(pathNode.G); text.Append("\n\tH: "); text.Append(pathNode.H); text.Append("\n\tF: "); text.Append(pathNode.F); text.Append("\n\tPoint: "); text.Append(this.endPoint.ToString()); text.Append("\n\tGraph: "); text.Append(this.endNode.GraphIndex); } text.Append("\nStart Node"); text.Append("\n\tPoint: "); text.Append(this.startPoint.ToString()); text.Append("\n\tGraph: "); if (this.startNode != null) { text.Append(this.startNode.GraphIndex); } else { text.Append("< null startNode >"); } } base.DebugStringSuffix(logMode, text); return(text.ToString()); }
protected void DebugStringSuffix(PathLog logMode, StringBuilder text) { if (this.error) { text.Append("\nError: ").Append(this.errorLog); } if (logMode == PathLog.Heavy && !AstarPath.active.IsUsingMultithreading) { text.Append("\nCallback references "); if (this.callback != null) { text.Append(this.callback.Target.GetType().FullName).AppendLine(); } else { text.AppendLine("NULL"); } } text.Append("\nPath Number ").Append(this.pathID).Append(" (unique id)"); }
static void Main(string[] args) { try { Map map = Map.GetMapFromFile(dataFile); DisplayMaze displayMaze = new DisplayMaze(); displayMaze.Display(map); StartPointSelector startPointSelector = new StartPointSelector(); Coordinates startPoint = startPointSelector.GetCoordinates(map.StartPoint); map.ChangeStartPoint(startPoint); Path path = new Path(map); DisplayPath displayPath = new DisplayPath(); displayPath.Display(path); PathLog pathLog = new PathLog(); pathLog.PrintLogToFile(path.ShortestPath, logFile); } catch (System.IO.FileNotFoundException e) { Console.WriteLine("[ERROR] File " + dataFile + " not found."); } catch (ArgumentException e) { Console.WriteLine("[ERROR] Map without exit."); } catch (System.IO.InvalidDataException e) { Console.WriteLine("[ERROR] Multiple start points."); } catch (IndexOutOfRangeException e) { Console.WriteLine("[ERROR] Start point outside of maze."); } catch (InvalidOperationException e) { Console.WriteLine("[ERROR] Wrong place for start point."); } Console.ReadKey(); }
/// <summary> /// Writes text shared for all overrides of DebugString to the string builder. /// See: DebugString /// </summary> protected void DebugStringSuffix(PathLog logMode, System.Text.StringBuilder text) { if (error) { text.Append("\nError: ").Append(errorLog); } // Can only print this from the Unity thread // since otherwise an exception might be thrown if (logMode == PathLog.Heavy && !AstarPath.active.IsUsingMultithreading) { //text.Append("\nCallback references "); if (callback != null) { text.Append(callback.Target.GetType().FullName).AppendLine(); } //else text.AppendLine("NULL"); } //text.Append("\nPath Number ").Append(pathID).Append(" (unique id)"); }
public override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return ""; } System.Text.StringBuilder text = new System.Text.StringBuilder(); text.Append (error ? "Path Failed : " : "Path Completed : "); text.Append ("Computation Time "); text.Append ((duration).ToString (logMode == PathLog.Heavy ? "0.000" : "0.00")); text.Append (" ms Searched Nodes "); text.Append (searchedNodes); if (!error) { text.Append ("\nLast Found Path Length "); text.Append (path == null ? "Null" : path.Length.ToString ()); if (logMode == PathLog.Heavy) { text.Append ("\nSearch Iterations "+searchIterations); text.Append ("\nPaths (").Append (targetsFound.Length).Append ("):"); for (int i=0;i<targetsFound.Length;i++) { text.Append ("\n\n Path "+i).Append (" Found: ").Append (targetsFound[i]); Node node = nodePaths[i] == null ? null : nodePaths[i][nodePaths[i].Length-1]; if (node != null) { NodeRun nodeR = endNode.GetNodeRun (runData); text.Append ("\n Length: "); text.Append (nodePaths[i].Length); text.Append ("\n End Node"); text.Append ("\n G: "); text.Append (nodeR.g); text.Append ("\n H: "); text.Append (nodeR.h); text.Append ("\n F: "); text.Append (nodeR.f); text.Append ("\n Point: "); text.Append (((Vector3)endPoint).ToString ()); text.Append ("\n Graph: "); text.Append (endNode.graphIndex); } } text.Append ("\nStart Node"); text.Append ("\n Point: "); text.Append (((Vector3)endPoint).ToString ()); text.Append ("\n Graph: "); text.Append (startNode.graphIndex); text.Append ("\nBinary Heap size at completion: "); text.Append (runData.open == null ? "Null" : (runData.open.numberOfItems-2).ToString ());// -2 because numberOfItems includes the next item to be added and item zero is not used } } if (error) { text.Append ("\nError: "); text.Append (errorLog); } text.Append ("\nPath Number "); text.Append (pathID); return text.ToString (); }
/** Writes text shared for all overrides of DebugString to the string builder. * \see DebugString */ protected void DebugStringSuffix (PathLog logMode, System.Text.StringBuilder text) { if (error) { text.Append("\nError: ").Append(errorLog); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading) { text.Append("\nCallback references "); if (callback != null) text.Append(callback.Target.GetType().FullName).AppendLine(); else text.AppendLine("NULL"); } text.Append("\nPath Number ").Append(pathID).Append(" (unique id)"); }
/** Returns a debug string for this path. */ public virtual string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } //debugStringBuilder.Length = 0; var text = pathHandler.DebugStringBuilder; text.Length = 0; text.Append(error ? "Path Failed : " : "Path Completed : "); text.Append("Computation Time "); text.Append((duration).ToString(logMode == PathLog.Heavy ? "0.000 ms " : "0.00 ms ")); text.Append("Searched Nodes "); text.Append(searchedNodes); if (!error) { text.Append(" Path Length "); text.Append(path == null ? "Null" : path.Count.ToString()); if (logMode == PathLog.Heavy) { text.Append("\nSearch Iterations " + searchIterations); //text.Append ("\nBinary Heap size at complete: "); // -2 because numberOfItems includes the next item to be added and item zero is not used //text.Append (pathHandler.open == null ? "null" : (pathHandler.open.numberOfItems-2).ToString ()); } /*"\nEnd node\n G = "+p.endNode.g+"\n H = "+p.endNode.h+"\n F = "+p.endNode.f+"\n Point "+p.endPoint +"\nStart Point = "+p.startPoint+"\n"+"Start Node graph: "+p.startNode.graphIndex+" End Node graph: "+p.endNode.graphIndex+ * "\nBinary Heap size at completion: "+(p.open == null ? "Null" : p.open.numberOfItems.ToString ())*/ } if (error) { text.Append("\nError: "); text.Append(errorLog); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading) { text.Append("\nCallback references "); if (callback != null) { text.Append(callback.Target.GetType().FullName).AppendLine(); } else { text.AppendLine("NULL"); } } text.Append("\nPath Number "); text.Append(pathID); return(text.ToString()); }
public override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } System.Text.StringBuilder text = pathHandler.DebugStringBuilder; text.Length = 0; text.Append(error ? "Path Failed : " : "Path Completed : "); text.Append("Computation Time "); text.Append((duration).ToString(logMode == PathLog.Heavy ? "0.000" : "0.00")); text.Append(" ms Searched Nodes "); text.Append(searchedNodes); if (!error) { text.Append("\nLast Found Path Length "); text.Append(path == null ? "Null" : path.Count.ToString()); if (logMode == PathLog.Heavy) { text.Append("\nSearch Iterations " + searchIterations); text.Append("\nPaths (").Append(targetsFound.Length).Append("):"); for (int i = 0; i < targetsFound.Length; i++) { text.Append("\n\n Path "+ i).Append(" Found: ").Append(targetsFound[i]); if (nodePaths[i] != null) { text.Append("\n Length: "); text.Append(nodePaths[i].Count); GraphNode node = nodePaths[i][nodePaths[i].Count - 1]; if (node != null) { PathNode nodeR = pathHandler.GetPathNode(endNode); if (nodeR != null) { text.Append("\n End Node"); text.Append("\n G: "); text.Append(nodeR.G); text.Append("\n H: "); text.Append(nodeR.H); text.Append("\n F: "); text.Append(nodeR.F); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(endNode.GraphIndex); } else { text.Append("\n End Node: Null"); } } } } text.Append("\nStart Node"); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(startNode.GraphIndex); text.Append("\nBinary Heap size at completion: "); text.AppendLine(pathHandler.GetHeap() == null ? "Null" : (pathHandler.GetHeap().numberOfItems - 2).ToString()); // -2 because numberOfItems includes the next item to be added and item zero is not used } } if (error) { text.Append("\nError: "); text.Append(errorLog); text.AppendLine(); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading) { text.Append("\nCallback references "); if (callback != null) { text.Append(callback.Target.GetType().FullName).AppendLine(); } else { text.AppendLine("NULL"); } } text.Append("\nPath Number "); text.Append(pathID); return(text.ToString()); }
public virtual string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!this.error && logMode == PathLog.OnlyErrors)) { return string.Empty; } StringBuilder debugStringBuilder = this.pathHandler.DebugStringBuilder; debugStringBuilder.Length = 0; debugStringBuilder.Append((!this.error) ? "Path Completed : " : "Path Failed : "); debugStringBuilder.Append("Computation Time "); debugStringBuilder.Append(this.duration.ToString((logMode != PathLog.Heavy) ? "0.00 ms " : "0.000 ms ")); debugStringBuilder.Append("Searched Nodes "); debugStringBuilder.Append(this.searchedNodes); if (!this.error) { debugStringBuilder.Append(" Path Length "); debugStringBuilder.Append((this.path != null) ? this.path.Count.ToString() : "Null"); if (logMode == PathLog.Heavy) { debugStringBuilder.Append("\nSearch Iterations " + this.searchIterations); } } if (this.error) { debugStringBuilder.Append("\nError: "); debugStringBuilder.Append(this.errorLog); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading) { debugStringBuilder.Append("\nCallback references "); if (this.callback != null) { debugStringBuilder.Append(this.callback.Target.GetType().FullName).AppendLine(); } else { debugStringBuilder.AppendLine("NULL"); } } debugStringBuilder.Append("\nPath Number "); debugStringBuilder.Append(this.pathID); return debugStringBuilder.ToString(); }
public override string DebugString (PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return ""; } System.Text.StringBuilder text = pathHandler.DebugStringBuilder; text.Length = 0; text.Append (error ? "Path Failed : " : "Path Completed : "); text.Append ("Computation Time "); text.Append ((duration).ToString (logMode == PathLog.Heavy ? "0.000" : "0.00")); text.Append (" ms Searched Nodes "); text.Append (searchedNodes); if (!error) { text.Append ("\nLast Found Path Length "); text.Append (path == null ? "Null" : path.Count.ToString ()); if (logMode == PathLog.Heavy) { text.Append ("\nSearch Iterations "+searchIterations); text.Append ("\nPaths (").Append (targetsFound.Length).Append ("):"); for (int i=0;i<targetsFound.Length;i++) { text.Append ("\n\n Path "+i).Append (" Found: ").Append (targetsFound[i]); GraphNode node = nodePaths[i] == null ? null : nodePaths[i][nodePaths[i].Count-1]; if ( nodePaths[i] != null ) { text.Append ("\n Length: "); text.Append (nodePaths[i].Count); if (node != null) { PathNode nodeR = pathHandler.GetPathNode (endNode); if (nodeR != null) { text.Append ("\n End Node"); text.Append ("\n G: "); text.Append (nodeR.G); text.Append ("\n H: "); text.Append (nodeR.H); text.Append ("\n F: "); text.Append (nodeR.F); text.Append ("\n Point: "); text.Append (((Vector3)endPoint).ToString ()); text.Append ("\n Graph: "); text.Append (endNode.GraphIndex); } else { text.Append ("\n End Node: Null"); } } } } text.Append ("\nStart Node"); text.Append ("\n Point: "); text.Append (((Vector3)endPoint).ToString ()); text.Append ("\n Graph: "); text.Append (startNode.GraphIndex); text.Append ("\nBinary Heap size at completion: "); text.AppendLine (pathHandler.GetHeap() == null ? "Null" : (pathHandler.GetHeap().numberOfItems-2).ToString ());// -2 because numberOfItems includes the next item to be added and item zero is not used } } if (error) { text.Append ("\nError: "); text.Append (errorLog); text.AppendLine(); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading ) { text.Append ("\nCallback references "); if (callback != null) text.Append(callback.Target.GetType().FullName).AppendLine(); else text.AppendLine ("NULL"); } text.Append ("\nPath Number "); text.Append (pathID); return text.ToString (); }
/// <summary> /// Writes text shared for all overrides of DebugString to the string builder. /// See: DebugString /// </summary> protected void DebugStringSuffix(PathLog logMode, System.Text.StringBuilder text) { }
internal override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } System.Text.StringBuilder text = pathHandler.DebugStringBuilder; text.Length = 0; DebugStringPrefix(logMode, text); if (!error) { text.Append("\nShortest path was "); text.Append(chosenTarget == -1 ? "undefined" : nodePaths[chosenTarget].Count.ToString()); text.Append(" nodes long"); if (logMode == PathLog.Heavy) { text.Append("\nPaths (").Append(targetsFound.Length).Append("):"); for (int i = 0; i < targetsFound.Length; i++) { text.Append("\n\n Path ").Append(i).Append(" Found: ").Append(targetsFound[i]); if (nodePaths[i] != null) { text.Append("\n Length: "); text.Append(nodePaths[i].Count); GraphNode node = nodePaths[i][nodePaths[i].Count - 1]; if (node != null) { PathNode nodeR = pathHandler.GetPathNode(endNode); if (nodeR != null) { text.Append("\n End Node"); text.Append("\n G: "); text.Append(nodeR.G); text.Append("\n H: "); text.Append(nodeR.H); text.Append("\n F: "); text.Append(nodeR.F); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(endNode.GraphIndex); } else { text.Append("\n End Node: Null"); } } } } text.Append("\nStart Node"); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(startNode.GraphIndex); text.Append("\nBinary Heap size at completion: "); text.AppendLine(pathHandler.heap == null ? "Null" : (pathHandler.heap.numberOfItems - 2).ToString()); // -2 because numberOfItems includes the next item to be added and item zero is not used } } DebugStringSuffix(logMode, text); return(text.ToString()); }
/** Returns a string with information about it. * More information is emitted when logMode == Heavy. * An empty string is returned if logMode == None * or logMode == OnlyErrors and this path did not fail. */ public virtual string DebugString (PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return ""; } // Get a cached string builder for this thread System.Text.StringBuilder text = pathHandler.DebugStringBuilder; text.Length = 0; DebugStringPrefix(logMode, text); DebugStringSuffix(logMode, text); return text.ToString(); }
public override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!base.error && logMode == PathLog.OnlyErrors)) { return string.Empty; } StringBuilder debugStringBuilder = base.pathHandler.DebugStringBuilder; debugStringBuilder.Length = 0; debugStringBuilder.Append((!base.error) ? "Path Completed : " : "Path Failed : "); debugStringBuilder.Append("Computation Time "); debugStringBuilder.Append(this.duration.ToString((logMode != PathLog.Heavy) ? "0.00" : "0.000")); debugStringBuilder.Append(" ms Searched Nodes "); debugStringBuilder.Append(this.searchedNodes); if (!base.error) { debugStringBuilder.Append("\nShortest path was "); debugStringBuilder.Append((this.chosenTarget != -1) ? this.nodePaths[this.chosenTarget].Count.ToString() : "undefined"); debugStringBuilder.Append(" nodes long"); if (logMode == PathLog.Heavy) { debugStringBuilder.Append("\nSearch Iterations " + this.searchIterations); debugStringBuilder.Append("\nPaths (").Append(this.targetsFound.Length).Append("):"); for (int i = 0; i < this.targetsFound.Length; i++) { debugStringBuilder.Append("\n\n\tPath " + i).Append(" Found: ").Append(this.targetsFound[i]); if (this.nodePaths[i] != null) { debugStringBuilder.Append("\n\t\tLength: "); debugStringBuilder.Append(this.nodePaths[i].Count); GraphNode graphNode = this.nodePaths[i][this.nodePaths[i].Count - 1]; if (graphNode != null) { PathNode pathNode = base.pathHandler.GetPathNode(this.endNode); if (pathNode != null) { debugStringBuilder.Append("\n\t\tEnd Node"); debugStringBuilder.Append("\n\t\t\tG: "); debugStringBuilder.Append(pathNode.G); debugStringBuilder.Append("\n\t\t\tH: "); debugStringBuilder.Append(pathNode.H); debugStringBuilder.Append("\n\t\t\tF: "); debugStringBuilder.Append(pathNode.F); debugStringBuilder.Append("\n\t\t\tPoint: "); debugStringBuilder.Append(this.endPoint.ToString()); debugStringBuilder.Append("\n\t\t\tGraph: "); debugStringBuilder.Append(this.endNode.GraphIndex); } else { debugStringBuilder.Append("\n\t\tEnd Node: Null"); } } } } debugStringBuilder.Append("\nStart Node"); debugStringBuilder.Append("\n\tPoint: "); debugStringBuilder.Append(this.endPoint.ToString()); debugStringBuilder.Append("\n\tGraph: "); debugStringBuilder.Append(this.startNode.GraphIndex); debugStringBuilder.Append("\nBinary Heap size at completion: "); debugStringBuilder.AppendLine((base.pathHandler.GetHeap() != null) ? (base.pathHandler.GetHeap().numberOfItems - 2).ToString() : "Null"); } } if (base.error) { debugStringBuilder.Append("\nError: "); debugStringBuilder.Append(base.errorLog); debugStringBuilder.AppendLine(); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading) { debugStringBuilder.Append("\nCallback references "); if (this.callback != null) { debugStringBuilder.Append(this.callback.Target.GetType().FullName).AppendLine(); } else { debugStringBuilder.AppendLine("NULL"); } } debugStringBuilder.Append("\nPath Number "); debugStringBuilder.Append(base.pathID); return debugStringBuilder.ToString(); }
public override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!base.error && logMode == PathLog.OnlyErrors)) { return(string.Empty); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append((!base.error) ? "Path Completed : " : "Path Failed : "); stringBuilder.Append("Computation Time "); stringBuilder.Append(this.duration.ToString((logMode != PathLog.Heavy) ? "0.00" : "0.000")); stringBuilder.Append(" ms Searched Nodes "); stringBuilder.Append(this.searchedNodes); if (!base.error) { stringBuilder.Append(" Path Length "); stringBuilder.Append((this.path != null) ? this.path.Count.ToString() : "Null"); if (logMode == PathLog.Heavy) { stringBuilder.Append("\nSearch Iterations " + this.searchIterations); if (this.hasEndPoint && this.endNode != null) { PathNode pathNode = this.pathHandler.GetPathNode(this.endNode); stringBuilder.Append("\nEnd Node\n\tG: "); stringBuilder.Append(pathNode.G); stringBuilder.Append("\n\tH: "); stringBuilder.Append(pathNode.H); stringBuilder.Append("\n\tF: "); stringBuilder.Append(pathNode.F); stringBuilder.Append("\n\tPoint: "); stringBuilder.Append(this.endPoint.ToString()); stringBuilder.Append("\n\tGraph: "); stringBuilder.Append(this.endNode.GraphIndex); } stringBuilder.Append("\nStart Node"); stringBuilder.Append("\n\tPoint: "); stringBuilder.Append(this.startPoint.ToString()); stringBuilder.Append("\n\tGraph: "); if (this.startNode != null) { stringBuilder.Append(this.startNode.GraphIndex); } else { stringBuilder.Append("< null startNode >"); } } } if (base.error) { stringBuilder.Append("\nError: "); stringBuilder.Append(base.errorLog); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading) { stringBuilder.Append("\nCallback references "); if (this.callback != null) { stringBuilder.Append(this.callback.Target.GetType().FullName).AppendLine(); } else { stringBuilder.AppendLine("NULL"); } } stringBuilder.Append("\nPath Number "); stringBuilder.Append(this.pathID); return(stringBuilder.ToString()); }
/** Returns a debug string for this path. */ public virtual string DebugString (PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return ""; } // Get a cached string builder for this thread System.Text.StringBuilder text = pathHandler.DebugStringBuilder; text.Length = 0; text.Append (error ? "Path Failed : " : "Path Completed : "); text.Append ("Computation Time "); text.Append ((duration).ToString (logMode == PathLog.Heavy ? "0.000 ms " : "0.00 ms ")); text.Append ("Searched Nodes "); text.Append (searchedNodes); if (!error) { text.Append (" Path Length "); text.Append (path == null ? "Null" : path.Count.ToString ()); if (logMode == PathLog.Heavy) { text.Append ("\nSearch Iterations "+searchIterations); } } if (error) { text.Append ("\nError: "); text.Append (errorLog); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading ) { text.Append ("\nCallback references "); if (callback != null) text.Append(callback.Target.GetType().FullName).AppendLine(); else text.AppendLine ("NULL"); } text.Append ("\nPath Number "); text.Append (pathID); return text.ToString (); }
/** Writes text shared for all overrides of DebugString to the string builder. * \see DebugString */ protected void DebugStringPrefix (PathLog logMode, System.Text.StringBuilder text) { text.Append(error ? "Path Failed : " : "Path Completed : "); text.Append("Computation Time "); text.Append(duration.ToString(logMode == PathLog.Heavy ? "0.000 ms " : "0.00 ms ")); text.Append("Searched Nodes ").Append(searchedNodes); if (!error) { text.Append(" Path Length "); text.Append(path == null ? "Null" : path.Count.ToString()); if (logMode == PathLog.Heavy) { text.Append("\nSearch Iterations ").Append(searchIterations); } } }
/* String builder used for all debug logging */ //public static System.Text.StringBuilder debugStringBuilder = new System.Text.StringBuilder (); /** Returns a debug string for this path. */ public override string DebugString (PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return ""; } var text = new System.Text.StringBuilder(); DebugStringPrefix(logMode, text); if (!error && logMode == PathLog.Heavy) { text.Append("\nSearch Iterations "+searchIterations); if (hasEndPoint && endNode != null) { PathNode nodeR = pathHandler.GetPathNode(endNode); text.Append("\nEnd Node\n G: "); text.Append(nodeR.G); text.Append("\n H: "); text.Append(nodeR.H); text.Append("\n F: "); text.Append(nodeR.F); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(endNode.GraphIndex); } text.Append("\nStart Node"); text.Append("\n Point: "); text.Append(((Vector3)startPoint).ToString()); text.Append("\n Graph: "); if (startNode != null) text.Append(startNode.GraphIndex); else text.Append("< null startNode >"); } DebugStringSuffix(logMode, text); return text.ToString(); }
/* String builder used for all debug logging */ //public static System.Text.StringBuilder debugStringBuilder = new System.Text.StringBuilder (); /** Returns a debug string for this path. */ public override string DebugString (PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return ""; } var text = new System.Text.StringBuilder (); text.Append (error ? "Path Failed : " : "Path Completed : "); text.Append ("Computation Time "); text.Append ((duration).ToString (logMode == PathLog.Heavy ? "0.000" : "0.00")); text.Append (" ms Searched Nodes "); text.Append (searchedNodes); if (!error) { text.Append (" Path Length "); text.Append (path == null ? "Null" : path.Count.ToString ()); if (logMode == PathLog.Heavy) { text.Append ("\nSearch Iterations "+searchIterations); if (hasEndPoint && endNode != null) { PathNode nodeR = pathHandler.GetPathNode(endNode); text.Append ("\nEnd Node\n G: "); text.Append (nodeR.G); text.Append ("\n H: "); text.Append (nodeR.H); text.Append ("\n F: "); text.Append (nodeR.F); text.Append ("\n Point: "); text.Append (((Vector3)endPoint).ToString ()); text.Append ("\n Graph: "); text.Append (endNode.GraphIndex); } text.Append ("\nStart Node"); text.Append ("\n Point: "); text.Append (((Vector3)startPoint).ToString ()); text.Append ("\n Graph: "); if (startNode != null) text.Append (startNode.GraphIndex); else text.Append ("< null startNode >"); //text.Append ("\nBinary Heap size at completion: "); //text.Append (pathHandler.open == null ? "Null" : (pathHandler.open.numberOfItems-2).ToString ());// -2 because numberOfItems includes the next item to be added and item zero is not used } /*"\nEnd node\n G = "+p.endNode.g+"\n H = "+p.endNode.H+"\n F = "+p.endNode.f+"\n Point "+p.endPoint +"\nStart Point = "+p.startPoint+"\n"+"Start Node graph: "+p.startNode.graphIndex+" End Node graph: "+p.endNode.graphIndex+ "\nBinary Heap size at completion: "+(p.open == null ? "Null" : p.open.numberOfItems.ToString ())*/ } if (error) { text.Append ("\nError: "); text.Append (errorLog); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading ) { text.Append ("\nCallback references "); if (callback != null) text.Append(callback.Target.GetType().FullName).AppendLine(); else text.AppendLine ("NULL"); } text.Append ("\nPath Number "); text.Append (pathID); return text.ToString (); }
/** Returns a debug string for this path. \note This function should NOT be called simultaneously from multiple threads since that could mess up the static StringBuilder used */ public virtual string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } debugStringBuilder.Length = 0; System.Text.StringBuilder text = debugStringBuilder; //if (active.logPathResults == PathLog.Normal || logPathResults == PathLog.OnlyErrors) { text.Append(error ? "Path Failed : " : "Path Completed : "); text.Append("Computation Time "); text.Append((duration).ToString(logMode == PathLog.Heavy ? "0.000" : "0.00")); text.Append(" ms Searched Nodes "); text.Append(searchedNodes); if (!error) { text.Append(" Path Length "); text.Append(path == null ? "Null" : path.Length.ToString()); if (logMode == PathLog.Heavy) { text.Append("\nSearch Iterations " + searchIterations); text.Append("\nEnd Node\n G: "); text.Append(endNode.g); text.Append("\n H: "); text.Append(endNode.h); text.Append("\n F: "); text.Append(endNode.f); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(endNode.graphIndex); text.Append("\nStart Node"); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(startNode.graphIndex); text.Append("\nBinary Heap size at completion: "); text.Append(open == null ? "Null" : (open.numberOfItems - 2).ToString()); // -2 because numberOfItems includes the next item to be added and item zero is not used } /*"\nEnd node\n G = "+p.endNode.g+"\n H = "+p.endNode.h+"\n F = "+p.endNode.f+"\n Point "+p.endPoint +"\nStart Point = "+p.startPoint+"\n"+"Start Node graph: "+p.startNode.graphIndex+" End Node graph: "+p.endNode.graphIndex+ * "\nBinary Heap size at completion: "+(p.open == null ? "Null" : p.open.numberOfItems.ToString ())*/ } if (error) { text.Append("\nError: "); text.Append(errorLog); } text.Append("\nPath Number "); text.Append(pathID); return(text.ToString()); /*if (p.error) { * debug = "Path Failed : Computation Time: "+(p.duration).ToString ("0.00")+" ms Searched Nodes "+p.searchedNodes+"\nPath number: "+PathsCompleted+"\nError: "+p.errorLog; * } else { * debug = "Path Completed : Computation Time: "+(p.duration).ToString ("0.00")+" ms Path Length "+(p.path == null ? "Null" : p.path.Length.ToString ()) + " Searched Nodes "+p.searchedNodes+"\nSmoothed path length "+(p.vectorPath == null ? "Null" : p.vectorPath.Length.ToString ())+"\nPath number: "+p.pathID; * }*/ /*} else if (logPathResults == PathLog.Heavy || logPathResults == PathLog.InGame || logPathResults == PathLog.OnlyErrors) { * * if (p.error) { * debug = "Path Failed : Computation Time: "+(p.duration).ToString ("0.000")+" ms Searched Nodes "+p.searchedNodes+"\nPath number: "+PathsCompleted+"\nError: "+p.errorLog; * } else { * debug = "Path Completed : Computation Time: "+(p.duration).ToString ("0.000")+" ms\nPath Length "+(p.path == null ? "Null" : p.path.Length.ToString ()) + "\nSearched Nodes "+p.searchedNodes+"\nSearch Iterations (frames) "+p.searchIterations+"\nSmoothed path length "+(p.vectorPath == null ? "Null" : p.vectorPath.Length.ToString ())+"\nEnd node\n G = "+p.endNode.g+"\n H = "+p.endNode.h+"\n F = "+p.endNode.f+"\n Point "+p.endPoint +"\nStart Point = "+p.startPoint+"\n"+"Start Node graph: "+p.startNode.graphIndex+" End Node graph: "+p.endNode.graphIndex+"\nBinary Heap size at completion: "+(p.open == null ? "Null" : p.open.numberOfItems.ToString ())+"\nPath number: "+p.pathID; * } * * /*if (active.logPathResults == PathLog.Heavy) { * Debug.Log (debug); * } else { * inGameDebugPath = debug; * }* * } * * if (logPathResults == PathLog.Normal || logPathResults == PathLog.Heavy || (logPathResults == PathLog.OnlyErrors && p.error)) { * Debug.Log (debug); * } else if (logPathResults == PathLog.InGame) { * inGameDebugPath = debug; * }*/ }
/** Returns a debug string for this path. * \warning This function should NOT be called simultaneously from multiple threads since that could mess up the static StringBuilder used */ public virtual string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return ""; } debugStringBuilder.Length = 0; System.Text.StringBuilder text = debugStringBuilder; text.Append(error ? "Path Failed : " : "Path Completed : "); text.Append("Computation Time "); text.Append((duration).ToString(logMode == PathLog.Heavy ? "0.000" : "0.00")); text.Append(" ms Searched Nodes "); text.Append(searchedNodes); if (!error) { text.Append(" Path Length "); text.Append(path == null ? "Null" : path.Length.ToString()); if (logMode == PathLog.Heavy) { text.Append("\nSearch Iterations " + searchIterations); if (hasEndPoint && endNode != null) { text.Append("\nEnd Node\n G: "); text.Append(endNode.g); text.Append("\n H: "); text.Append(endNode.h); text.Append("\n F: "); text.Append(endNode.f); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(endNode.graphIndex); } text.Append("\nStart Node"); text.Append("\n Point: "); text.Append(((Vector3)startPoint).ToString()); text.Append("\n Graph: "); text.Append(startNode.graphIndex); text.Append("\nBinary Heap size at completion: "); text.Append(open == null ? "Null" : (open.numberOfItems - 2).ToString());// -2 because numberOfItems includes the next item to be added and item zero is not used } /*"\nEnd node\n G = "+p.endNode.g+"\n H = "+p.endNode.h+"\n F = "+p.endNode.f+"\n Point "+p.endPoint +"\nStart Point = "+p.startPoint+"\n"+"Start Node graph: "+p.startNode.graphIndex+" End Node graph: "+p.endNode.graphIndex+ "\nBinary Heap size at completion: "+(p.open == null ? "Null" : p.open.numberOfItems.ToString ())*/ } if (error) { text.Append("\nError: "); text.Append(errorLog); } text.Append("\nPath Number "); text.Append(pathID); return text.ToString(); }
public override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } System.Text.StringBuilder text = new System.Text.StringBuilder(); text.Append(error ? "Path Failed : " : "Path Completed : "); text.Append("Computation Time "); text.Append((duration).ToString(logMode == PathLog.Heavy ? "0.000" : "0.00")); text.Append(" ms Searched Nodes "); text.Append(searchedNodes); if (!error) { text.Append("\nLast Found Path Length "); text.Append(path == null ? "Null" : path.Length.ToString()); if (logMode == PathLog.Heavy) { text.Append("\nSearch Iterations " + searchIterations); text.Append("\nPaths (").Append(targetsFound.Length).Append("):"); for (int i = 0; i < targetsFound.Length; i++) { text.Append("\n\n Path "+ i).Append(" Found: ").Append(targetsFound[i]); Node node = nodePaths[i] == null ? null : nodePaths[i][nodePaths[i].Length - 1]; if (node != null) { NodeRun nodeR = endNode.GetNodeRun(runData); text.Append("\n Length: "); text.Append(nodePaths[i].Length); text.Append("\n End Node"); text.Append("\n G: "); text.Append(nodeR.g); text.Append("\n H: "); text.Append(nodeR.h); text.Append("\n F: "); text.Append(nodeR.f); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(endNode.graphIndex); } } text.Append("\nStart Node"); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(startNode.graphIndex); text.Append("\nBinary Heap size at completion: "); text.Append(runData.open == null ? "Null" : (runData.open.numberOfItems - 2).ToString()); // -2 because numberOfItems includes the next item to be added and item zero is not used } } if (error) { text.Append("\nError: "); text.Append(errorLog); } text.Append("\nPath Number "); text.Append(pathID); return(text.ToString()); }
string IPathInternals.DebugString(PathLog logMode) { return(DebugString(logMode)); }
/** Returns a debug string for this path. */ public virtual string DebugString (PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return ""; } //debugStringBuilder.Length = 0; var text = pathHandler.DebugStringBuilder; text.Length = 0; text.Append (error ? "Path Failed : " : "Path Completed : "); text.Append ("Computation Time "); text.Append ((duration).ToString (logMode == PathLog.Heavy ? "0.000 ms " : "0.00 ms ")); text.Append ("Searched Nodes "); text.Append (searchedNodes); if (!error) { text.Append (" Path Length "); text.Append (path == null ? "Null" : path.Count.ToString ()); if (logMode == PathLog.Heavy) { text.Append ("\nSearch Iterations "+searchIterations); //text.Append ("\nBinary Heap size at complete: "); // -2 because numberOfItems includes the next item to be added and item zero is not used //text.Append (pathHandler.open == null ? "null" : (pathHandler.open.numberOfItems-2).ToString ()); } /*"\nEnd node\n G = "+p.endNode.g+"\n H = "+p.endNode.h+"\n F = "+p.endNode.f+"\n Point "+p.endPoint +"\nStart Point = "+p.startPoint+"\n"+"Start Node graph: "+p.startNode.graphIndex+" End Node graph: "+p.endNode.graphIndex+ "\nBinary Heap size at completion: "+(p.open == null ? "Null" : p.open.numberOfItems.ToString ())*/ } if (error) { text.Append ("\nError: "); text.Append (errorLog); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading ) { text.Append ("\nCallback references "); if (callback != null) text.Append(callback.Target.GetType().FullName).AppendLine(); else text.AppendLine ("NULL"); } text.Append ("\nPath Number "); text.Append (pathID); return text.ToString (); }
/* String builder used for all debug logging */ //public static System.Text.StringBuilder debugStringBuilder = new System.Text.StringBuilder (); /** Returns a debug string for this path. */ public override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return(""); } //debugStringBuilder.Length = 0; System.Text.StringBuilder text = new System.Text.StringBuilder(); text.Append(error ? "Path Failed : " : "Path Completed : "); text.Append("Computation Time "); text.Append((duration).ToString(logMode == PathLog.Heavy ? "0.000" : "0.00")); text.Append(" ms Searched Nodes "); text.Append(searchedNodes); if (!error) { text.Append(" Path Length "); text.Append(path == null ? "Null" : path.Count.ToString()); if (logMode == PathLog.Heavy) { text.Append("\nSearch Iterations " + searchIterations); if (hasEndPoint && endNode != null) { PathNode nodeR = pathHandler.GetPathNode(endNode); text.Append("\nEnd Node\n G: "); text.Append(nodeR.G); text.Append("\n H: "); text.Append(nodeR.H); text.Append("\n F: "); text.Append(nodeR.F); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(endNode.GraphIndex); } text.Append("\nStart Node"); text.Append("\n Point: "); text.Append(((Vector3)startPoint).ToString()); text.Append("\n Graph: "); if (startNode != null) { text.Append(startNode.GraphIndex); } else { text.Append("< null startNode >"); } //text.Append ("\nBinary Heap size at completion: "); //text.Append (pathHandler.open == null ? "Null" : (pathHandler.open.numberOfItems-2).ToString ());// -2 because numberOfItems includes the next item to be added and item zero is not used } /*"\nEnd node\n G = "+p.endNode.g+"\n H = "+p.endNode.H+"\n F = "+p.endNode.f+"\n Point "+p.endPoint +"\nStart Point = "+p.startPoint+"\n"+"Start Node graph: "+p.startNode.graphIndex+" End Node graph: "+p.endNode.graphIndex+ * "\nBinary Heap size at completion: "+(p.open == null ? "Null" : p.open.numberOfItems.ToString ())*/ } if (error) { text.Append("\nError: "); text.Append(errorLog); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading) { text.Append("\nCallback references "); if (callback != null) { text.Append(callback.Target.GetType().FullName).AppendLine(); } else { text.AppendLine("NULL"); } } text.Append("\nPath Number "); text.Append(pathID); return(text.ToString()); }
public override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!base.error && logMode == PathLog.OnlyErrors)) { return(string.Empty); } StringBuilder debugStringBuilder = base.pathHandler.DebugStringBuilder; debugStringBuilder.Length = 0; debugStringBuilder.Append((!base.error) ? "Path Completed : " : "Path Failed : "); debugStringBuilder.Append("Computation Time "); debugStringBuilder.Append(this.duration.ToString((logMode != PathLog.Heavy) ? "0.00" : "0.000")); debugStringBuilder.Append(" ms Searched Nodes "); debugStringBuilder.Append(this.searchedNodes); if (!base.error) { debugStringBuilder.Append("\nShortest path was "); debugStringBuilder.Append((this.chosenTarget != -1) ? this.nodePaths[this.chosenTarget].Count.ToString() : "undefined"); debugStringBuilder.Append(" nodes long"); if (logMode == PathLog.Heavy) { debugStringBuilder.Append("\nSearch Iterations " + this.searchIterations); debugStringBuilder.Append("\nPaths (").Append(this.targetsFound.Length).Append("):"); for (int i = 0; i < this.targetsFound.Length; i++) { debugStringBuilder.Append("\n\n\tPath " + i).Append(" Found: ").Append(this.targetsFound[i]); if (this.nodePaths[i] != null) { debugStringBuilder.Append("\n\t\tLength: "); debugStringBuilder.Append(this.nodePaths[i].Count); GraphNode graphNode = this.nodePaths[i][this.nodePaths[i].Count - 1]; if (graphNode != null) { PathNode pathNode = base.pathHandler.GetPathNode(this.endNode); if (pathNode != null) { debugStringBuilder.Append("\n\t\tEnd Node"); debugStringBuilder.Append("\n\t\t\tG: "); debugStringBuilder.Append(pathNode.G); debugStringBuilder.Append("\n\t\t\tH: "); debugStringBuilder.Append(pathNode.H); debugStringBuilder.Append("\n\t\t\tF: "); debugStringBuilder.Append(pathNode.F); debugStringBuilder.Append("\n\t\t\tPoint: "); debugStringBuilder.Append(this.endPoint.ToString()); debugStringBuilder.Append("\n\t\t\tGraph: "); debugStringBuilder.Append(this.endNode.GraphIndex); } else { debugStringBuilder.Append("\n\t\tEnd Node: Null"); } } } } debugStringBuilder.Append("\nStart Node"); debugStringBuilder.Append("\n\tPoint: "); debugStringBuilder.Append(this.endPoint.ToString()); debugStringBuilder.Append("\n\tGraph: "); debugStringBuilder.Append(this.startNode.GraphIndex); debugStringBuilder.Append("\nBinary Heap size at completion: "); debugStringBuilder.AppendLine((base.pathHandler.GetHeap() != null) ? (base.pathHandler.GetHeap().numberOfItems - 2).ToString() : "Null"); } } if (base.error) { debugStringBuilder.Append("\nError: "); debugStringBuilder.Append(base.errorLog); debugStringBuilder.AppendLine(); } if (logMode == PathLog.Heavy && !AstarPath.IsUsingMultithreading) { debugStringBuilder.Append("\nCallback references "); if (this.callback != null) { debugStringBuilder.Append(this.callback.Target.GetType().FullName).AppendLine(); } else { debugStringBuilder.AppendLine("NULL"); } } debugStringBuilder.Append("\nPath Number "); debugStringBuilder.Append(base.pathID); return(debugStringBuilder.ToString()); }
internal override string DebugString(PathLog logMode) { if (logMode == PathLog.None || (!base.error && logMode == PathLog.OnlyErrors)) { return(""); } StringBuilder debugStringBuilder = this.pathHandler.DebugStringBuilder; debugStringBuilder.Length = 0; base.DebugStringPrefix(logMode, debugStringBuilder); if (!base.error) { debugStringBuilder.Append("\nShortest path was "); debugStringBuilder.Append((this.chosenTarget == -1) ? "undefined" : this.nodePaths[this.chosenTarget].Count.ToString()); debugStringBuilder.Append(" nodes long"); if (logMode == PathLog.Heavy) { debugStringBuilder.Append("\nPaths (").Append(this.targetsFound.Length).Append("):"); Vector3 endPoint; for (int i = 0; i < this.targetsFound.Length; i++) { debugStringBuilder.Append("\n\n\tPath ").Append(i).Append(" Found: ").Append(this.targetsFound[i]); if (this.nodePaths[i] != null) { debugStringBuilder.Append("\n\t\tLength: "); debugStringBuilder.Append(this.nodePaths[i].Count); if (this.nodePaths[i][this.nodePaths[i].Count - 1] != null) { PathNode pathNode = this.pathHandler.GetPathNode(this.endNode); if (pathNode != null) { debugStringBuilder.Append("\n\t\tEnd Node"); debugStringBuilder.Append("\n\t\t\tG: "); debugStringBuilder.Append(pathNode.G); debugStringBuilder.Append("\n\t\t\tH: "); debugStringBuilder.Append(pathNode.H); debugStringBuilder.Append("\n\t\t\tF: "); debugStringBuilder.Append(pathNode.F); debugStringBuilder.Append("\n\t\t\tPoint: "); StringBuilder stringBuilder = debugStringBuilder; endPoint = this.endPoint; stringBuilder.Append(endPoint.ToString()); debugStringBuilder.Append("\n\t\t\tGraph: "); debugStringBuilder.Append(this.endNode.GraphIndex); } else { debugStringBuilder.Append("\n\t\tEnd Node: Null"); } } } } debugStringBuilder.Append("\nStart Node"); debugStringBuilder.Append("\n\tPoint: "); StringBuilder stringBuilder2 = debugStringBuilder; endPoint = this.endPoint; stringBuilder2.Append(endPoint.ToString()); debugStringBuilder.Append("\n\tGraph: "); debugStringBuilder.Append(this.startNode.GraphIndex); debugStringBuilder.Append("\nBinary Heap size at completion: "); debugStringBuilder.AppendLine((this.pathHandler.heap == null) ? "Null" : (this.pathHandler.heap.numberOfItems - 2).ToString()); } } base.DebugStringSuffix(logMode, debugStringBuilder); return(debugStringBuilder.ToString()); }
public override string DebugString (PathLog logMode) { if (logMode == PathLog.None || (!error && logMode == PathLog.OnlyErrors)) { return ""; } System.Text.StringBuilder text = pathHandler.DebugStringBuilder; text.Length = 0; DebugStringPrefix(logMode, text); if (!error) { text.Append("\nShortest path was "); text.Append(chosenTarget == -1 ? "undefined" : nodePaths[chosenTarget].Count.ToString()); text.Append(" nodes long"); if (logMode == PathLog.Heavy) { text.Append("\nPaths (").Append(targetsFound.Length).Append("):"); for (int i = 0; i < targetsFound.Length; i++) { text.Append("\n\n Path ").Append(i).Append(" Found: ").Append(targetsFound[i]); if (nodePaths[i] != null) { text.Append("\n Length: "); text.Append(nodePaths[i].Count); GraphNode node = nodePaths[i][nodePaths[i].Count-1]; if (node != null) { PathNode nodeR = pathHandler.GetPathNode(endNode); if (nodeR != null) { text.Append("\n End Node"); text.Append("\n G: "); text.Append(nodeR.G); text.Append("\n H: "); text.Append(nodeR.H); text.Append("\n F: "); text.Append(nodeR.F); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(endNode.GraphIndex); } else { text.Append("\n End Node: Null"); } } } } text.Append("\nStart Node"); text.Append("\n Point: "); text.Append(((Vector3)endPoint).ToString()); text.Append("\n Graph: "); text.Append(startNode.GraphIndex); text.Append("\nBinary Heap size at completion: "); text.AppendLine(pathHandler.GetHeap() == null ? "Null" : (pathHandler.GetHeap().numberOfItems-2).ToString()); // -2 because numberOfItems includes the next item to be added and item zero is not used } } DebugStringSuffix(logMode, text); return text.ToString(); }