Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="vehicle"></param>
        public CHEdgeGraphFileStreamTarget(Stream stream, Vehicle vehicle)
        {
            _graphStream = stream;

            var tagsIndex   = new SimpleTagsCollectionIndex();
            var interpreter = new OsmRoutingInterpreter();

            _graph       = new DynamicGraphRouterDataSource <CHEdgeData>(tagsIndex);
            _graphTarget = new CHEdgeGraphOsmStreamTarget(
                _graph, interpreter, tagsIndex, vehicle);
        }
        /// <summary>
        /// Preprocesses the data from the given OsmStreamReader and converts it directly to a routable data source.
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="tagsIndex"></param>
        /// <param name="interpreter"></param>
        /// <param name="vehicle"></param>
        /// <returns></returns>
        public static RouterDataSource <CHEdgeData> Preprocess(OsmStreamSource reader,
                                                               ITagsIndex tagsIndex, IOsmRoutingInterpreter interpreter, Vehicle vehicle)
        {
            // pull in the data.
            var graph      = new RouterDataSource <CHEdgeData>(new DirectedGraph <CHEdgeData>(), tagsIndex);
            var targetData = new CHEdgeGraphOsmStreamTarget(
                graph, interpreter, tagsIndex, vehicle);

            targetData.RegisterSource(reader);
            targetData.Pull();

            return(graph);
        }
 /// <summary>
 /// Preprocesses the data from the given OsmStreamReader and converts it directly to a routable data source.
 /// </summary>
 /// <param name="reader"></param>
 /// <param name="interpreter"></param>
 /// <param name="vehicle"></param>
 /// <returns></returns>
 public static RouterDataSource <CHEdgeData> Preprocess(OsmStreamSource reader,
                                                        IOsmRoutingInterpreter interpreter, Vehicle vehicle)
 {
     return(CHEdgeGraphOsmStreamTarget.Preprocess(reader, new TagsIndex(), interpreter, vehicle));
 }