/// <summary> /// Calculates heatmap for the given profile. /// </summary> public static HeatmapResult CalculateHeatmap(this RouterBase router, Profile profile, RouterPoint origin, int limitInSeconds, int zoom, CancellationToken cancellationToken) { if (!router.SupportsAll(profile)) { throw new ArgumentException(string.Format("Profile {0} not supported.", profile.FullName)); } if (profile.Metric != ProfileMetric.TimeInSeconds) { throw new ArgumentException(string.Format("Profile {0} not supported, only profiles with metric TimeInSeconds are supported.", profile.FullName)); } // get the weight handler. var weightHandler = router.GetDefaultWeightHandler(profile); var getFactor = router.GetDefaultGetFactor(profile); // calculate isochrones. var isochrone = new TileBasedHeatmapBuilder(router.Db.Network.GeometricGraph, new Algorithms.Default.Dykstra(router.Db.Network.GeometricGraph.Graph, weightHandler, null, origin.ToEdgePaths <float>(router.Db, weightHandler, true), limitInSeconds, false), zoom); isochrone.Run(cancellationToken); var result = isochrone.Result; result.MaxMetric = profile.Metric.ToInvariantString(); return(result); }
/// <summary> /// Calculates heatmap for the given profile. /// </summary> public static HeatmapResult CalculateHeatmap(this RouterBase router, Profile profile, RouterPoint origin, int limitInSeconds, int zoom = 16) { if (profile.Metric != ProfileMetric.TimeInSeconds) { throw new ArgumentException(string.Format("Profile {0} not supported, only profiles with metric TimeInSeconds are supported.", profile.Name)); } // get the weight handler. var weightHandler = router.GetDefaultWeightHandler(profile); var getFactor = router.GetDefaultGetFactor(profile); // calculate isochrones. var isochrone = new TileBasedHeatmapBuilder( new DykstraEdgeVisitor(router.Db.Network.GeometricGraph, getFactor, origin.ToEdgePaths <float>(router.Db, weightHandler, true), limitInSeconds), zoom); isochrone.Run(); var result = isochrone.Result; result.MaxMetric = profile.Name; return(result); }