private void FindAllRoutesCommandExecuted(MapView mapView)
        {
            DCGraph.ResetGraph();
            //Remove old route graphics
            RemoveRouteGraphics(mapView);
            var dijkstraApproxBucket = new DijkstraApproximateBucketPathFinder(DCGraph);

            var startVertex       = dijkstraApproxBucket.FindClosestVertex(StartLocation.ToCoordinates());
            var endVertex         = dijkstraApproxBucket.FindClosestVertex(EndLocation.ToCoordinates());
            var dijkstaKArrayHeap = new DijkstraMinHeapPathFinder(DCGraph);
            var dikstraList       = new DijkstraPathFinder(DCGraph);

            var astarList         = new AStarPathFinder(DCGraph);
            var astarApproxBucket = new AStarApproximateBucketPathFinder(DCGraph);
            var astarKarrayHeap   = new AStarMinHeapPathFinder(DCGraph);


            AStarKArrayHeapRunningTime = GetRunningTime(astarKarrayHeap, startVertex, endVertex, mapView);
            DCGraph.ResetGraph();
            AStarApproximateBucketRunningTime = GetRunningTime(astarApproxBucket, startVertex, endVertex, mapView);
            DCGraph.ResetGraph();
            AStarListRunningTime = GetRunningTime(astarList, startVertex, endVertex, mapView);
            DCGraph.ResetGraph();

            DijkstraApproximateBucketRunningTime = GetRunningTime(dijkstraApproxBucket, startVertex, endVertex, mapView);
            DCGraph.ResetGraph();
            DijkstraListRunningTime = GetRunningTime(dikstraList, startVertex, endVertex, mapView);
            DCGraph.ResetGraph();
            DijkstraKArrayHeapRunningTime = GetRunningTime(dijkstaKArrayHeap, startVertex, endVertex, mapView);
            DCGraph.ResetGraph();
        }
 // Use this for initialization
 void Start()
 {
     this.txt                = this.GetComponent <Text> ();
     this.tutorial           = this.txt.text;
     this.txt.text           = "";
     this.startTimerLocation = (StartLocation)this.GetComponentInChildren <StartLocation> ();
     this.skipTextLocation   = (EndLocation)this.GetComponentInChildren <EndLocation> ();
 }
 public override int GetHashCode()
 {
     unchecked {
         int hash = 23;
         hash = hash * 37 + Text.GetHashCode();
         hash = hash * 37 + StartLocation.GetHashCode();
         hash = hash * 37 + EndLocation.GetHashCode();
         return(hash);
     }
 }
Exemple #4
0
 public override int GetHashCode()
 {
     unchecked {
         int hash = 23;
         hash = hash * 37 + Index.GetHashCode();
         hash = hash * 37 + Alignment.GetHashCode();
         hash = hash * 37 + FormatString.GetHashCode();
         hash = hash * 37 + StartLocation.GetHashCode();
         hash = hash * 37 + EndLocation.GetHashCode();
         return(hash);
     }
 }
        protected override void DrawGhost(CanvasControl sender, CanvasDrawEventArgs args)
        {
            if (!Closed)
            {
                Point start = Lines.Count == 0 ? StartLocation : Lines[Lines.Count - 1].EndLocation;
                args.DrawingSession.DrawLine(start.ToVector2(), EndLocation.ToVector2(), ShapeColor, 1);
            }

            foreach (var line in Lines)
            {
                DrawBezier(args, DRAW_PRECISION, ConvertLinesToPoints());
                line.Draw(sender, args);
            }
        }
        public override XmlElement ToXml(XmlDocument doc)
        {
            var root = base.ToXml(doc);

            var startLocation = StartLocation.ToXml(doc, "StartLocation");

            startLocation.SetAttribute("equals", EqualsStartLocation.ToString());
            root.AppendChild(startLocation);

            var endLocation = EndLocation.ToXml(doc, "EndLocation");

            endLocation.SetAttribute("equals", EqualsEndLocation.ToString());
            root.AppendChild(endLocation);

            return(root);
        }
        private void AStarCommandExecuted(MapView mapView)
        {
            var   dpf        = new AStarApproximateBucketPathFinder(DCGraph);
            float pathlength = 0;
            var   path       = dpf.FindShortestPath(dpf.FindClosestVertex(StartLocation.ToCoordinates()),
                                                    dpf.FindClosestVertex(EndLocation.ToCoordinates()),
                                                    ref pathlength);

            if (path != null && path.Count > 0)
            {
                DisplayPath(path, mapView);
            }
            else
            {
                MessageBox.Show("No Route Found!");
            }
            DCGraph.ResetGraph();
        }
 GameEvent[] GetRestrictedEvents()
 {
     if (!Location.IsNullOrAnywhere(EndLocation) && EndLocation.Any(end => end.ID != null))
     {
         return new GameEvent[] { SkyrimEvent.LoadScreenEnd }
     }
     ;
     else if (!Location.IsNullOrAnywhere(EndLocation))
     {
         return new GameEvent[] { SkyrimEvent.LoadScreenLoadEnd, SkyrimEvent.LoadScreenEnd }
     }
     ;
     else
     {
         return new GameEvent[] { SkyrimEvent.LoadScreenStart, SkyrimEvent.LoadScreenLoadEnd,
                                  SkyrimEvent.LoadScreenEnd }
     };
 }
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     return(StartLocation.GetHashCode() ^ EndLocation.GetHashCode());
 }
Exemple #10
0
 protected override void DrawGhost(CanvasControl sender, CanvasDrawEventArgs args)
 {
     args.DrawingSession.DrawLine(StartLocation.ToVector2(), EndLocation.ToVector2(), ShapeColor, 1);
 }