Exemplo n.º 1
0
        internal static void LoadForTile(this TiledBarrierGraph graph, uint tile,
                                         Func <uint, IEnumerable <OsmGeo> > getTile,
                                         Func <TagsCollectionBase, bool> isBarrier)
        {
            // mark tile as loaded.
            graph.SetTileLoaded(tile);

            // first load the tile in question.
            var tileData   = getTile(tile);
            var extraTiles = graph.Add(tileData, isBarrier);

            // add all the tiles.
            graph.AddTiles(extraTiles, getTile, isBarrier);
        }
Exemplo n.º 2
0
        internal static void AddTiles(this TiledBarrierGraph graph, IEnumerable <uint> tiles,
                                      Func <uint, IEnumerable <OsmGeo> > getTile,
                                      Func <TagsCollectionBase, bool> isBarrier)
        {
            foreach (var tile in tiles)
            {
                // mark tile as loaded.
                graph.SetTileLoaded(tile);

                // get the data and load it.
                var tileData = getTile(tile);
                graph.Add(tileData, isBarrier);
            }

            // prune graph.
            graph.PruneDeadEnds();
            graph.PruneShapePoints();

            // standardize edges
            // loading them in a different order could lead to different start and end points
            graph.StandardizeEdges();
        }