コード例 #1
0
 /// <summary>
 /// Creates a new stream target.
 /// </summary>
 public CHEdgeFlatfileStreamTarget(Stream stream, ITagsIndex tagsIndex, Vehicle vehicle, MemoryMappedStream memoryMappedStream)
     : base(new RouterDataSource<CHEdgeData>(new DirectedGraph<CHEdgeData>(memoryMappedStream, 1000, 
         CHEdgeData.MapFromDelegate, CHEdgeData.MapToDelegate, CHEdgeData.SizeUints), tagsIndex), new OsmRoutingInterpreter(), tagsIndex, vehicle)
 {
     _stream = stream;
     _memoryMappedStream = memoryMappedStream;
 }
コード例 #2
0
 /// <summary>
 /// Creates the target.
 /// </summary>
 /// <returns></returns>
 public static CHEdgeFlatfileStreamTarget CreateTarget(Stream stream, Vehicle vehicle, MemoryMappedStream memoryMappedStream)
 {
     if(memoryMappedStream == null)
     {
         return new CHEdgeFlatfileStreamTarget(stream, new TagsIndex(new MemoryMappedStream()), vehicle);
     }
     return new CHEdgeFlatfileStreamTarget(stream, new TagsIndex(memoryMappedStream), vehicle, memoryMappedStream);
 }
コード例 #3
0
ファイル: EdgeInterpreter.cs プロジェクト: cmberryau/routing
 /// <summary>
 /// Returns true if the edge with given tags can be traversed by the given vehicle.
 /// </summary>
 /// <param name="tags"></param>
 /// <param name="vehicle"></param>
 /// <returns></returns>
 public bool CanBeTraversedBy(TagsCollectionBase tags, Vehicle vehicle)
 {
     return vehicle.CanTraverse(tags);
 }
コード例 #4
0
ファイル: Vehicle.cs プロジェクト: cmberryau/routing
        /// <summary>
        /// Tries to the the vehicle given it's unique name.
        /// </summary>
        /// <param name="uniqueName"></param>
        /// <param name="vehicle"></param>
        /// <returns></returns>
        public static bool TryGetByUniqueName(string uniqueName, out Vehicle vehicle)
        {
            if (uniqueName == null) { throw new ArgumentNullException("uniqueName"); }

            if (VehiclesByName == null)
            { // no vehicles have been registered.
                Vehicle.RegisterVehicles();
            }
            uniqueName = uniqueName.ToLowerInvariant();
            if (!VehiclesByName.TryGetValue(uniqueName, out vehicle))
            { // vehicle name not registered.
                return false;
            }
            return true;
        }
コード例 #5
0
 /// <summary>
 /// Creates a new stream target.
 /// </summary>
 public CHEdgeFlatfileStreamTarget(Stream stream, ITagsIndex tagsIndex, Vehicle vehicle)
     : base(new RouterDataSource<CHEdgeData>(new DirectedGraph<CHEdgeData>(), tagsIndex), new OsmRoutingInterpreter(), tagsIndex, vehicle)
 {
     _stream = stream;
 }
コード例 #6
0
 /// <summary>
 /// Does the metric calculations.
 /// </summary>
 /// <param name="vehicle"></param>
 /// <param name="p"></param>
 /// <returns></returns>
 public abstract Dictionary<string, double> Calculate(Vehicle vehicle, AggregatedPoint p);