示例#1
0
 public static void Init(this IPathView pathView)
 {
     pathView.Update();
     for (var i = 0; i < pathView.Graph.NodeCount; i++)
     {
         if (pathView.MustBeRelevant[i])
         {
             pathView.SelectPath(i);
         }
     }
 }
 public void Init(TilePropagator propagator)
 {
     if (pathViewIsFresh)
     {
         pathViewIsFresh = false;
     }
     else
     {
         pathView = PathSpec.MakeView(propagator);
     }
     pathView.Init();
 }
 internal IPickHeuristic GetHeuristic(
     IRandomPicker randomPicker,
     Func <double> randomDouble,
     TilePropagator propagator,
     TileModelMapping tileModelMapping,
     IPickHeuristic fallbackHeuristic)
 {
     pathView        = PathSpec.MakeView(propagator);
     pathViewIsFresh = true;
     if (pathView is EdgedPathView epv)
     {
         return(new FollowPathHeuristic(
                    randomPicker, randomDouble, propagator, tileModelMapping, fallbackHeuristic, epv));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
示例#4
0
 public void Init(TilePropagator propagator)
 {
     if (PathSpec is PathSpec pathSpec)
     {
         // Convert PathSpec to EdgedPathSpec
         // As we have a bug with PathSpec ignoring paths of length 2.
         // (probably should use bridge edges instead of articulation points)
         ISet <Direction> allDirections = new HashSet <Direction>(Enumerable.Range(0, propagator.Topology.DirectionsCount).Cast <Direction>());
         var edgedPathSpec = new EdgedPathSpec
         {
             Exits         = pathSpec.Tiles.ToDictionary(x => x, _ => allDirections),
             RelevantCells = pathSpec.RelevantCells,
             RelevantTiles = pathSpec.RelevantTiles,
             TileRotation  = pathSpec.TileRotation,
         };
         pathView = edgedPathSpec.MakeView(propagator);
     }
     else
     {
         pathView = PathSpec.MakeView(propagator);
     }
     pathView.Init();
 }
示例#5
0
 public void Init(TilePropagator propagator)
 {
     pathView = PathSpec.MakeView(propagator);
     pathView.Init();
 }