itinero / transit

Transit routing module.
Other
5 stars 3 forks source link

ResolveMultipleAlgorithm not found #3

Closed GioAlba closed 7 years ago

GioAlba commented 7 years ago

I want to know how to solve the problem ResolveMultipleAlgorithm. In the 0.36 version is not supported. I tried with the following code:

  public static void AddStopLinksDb(this MultimodalDb db, Profile profile, float searchOffset = DefaultSearchOffset,
        float maxDistance = DefaultMaxDistance, int maxRouterPoints = DefaultMaxRouterPoints)
    {
        var stopsDbEnumerator = db.TransitDb.GetStopsEnumerator();
        var linksDb = new StopLinksDb(stopsDbEnumerator.Count, db.RouterDb, profile);

        while (stopsDbEnumerator.MoveNext())
        {
            var stopId = stopsDbEnumerator.Id;
            var multiResolver = new ResolveAlgorithm(db.RouterDb.Network.GeometricGraph,
                stopsDbEnumerator.Latitude, stopsDbEnumerator.Longitude, searchOffset, maxDistance, (edge) =>
                {
                    // get profile.
                    float distance;
                    ushort edgeProfileId;
                    Itinero.Data.Edges.EdgeDataSerializer.Deserialize(edge.Data[0],
                        out distance, out edgeProfileId);
                    var edgeProfile = db.RouterDb.EdgeProfiles.Get(edgeProfileId);
                    // get factor from profile.
                    if (profile.Factor(edgeProfile).Value <= 0)
                    { // cannot be traversed by this profile.
                        return false;
                    }
                    // verify stoppable.
                    if (!profile.CanStopOn(edgeProfile))
                    { // this profile cannot stop on this edge.
                        return false;
                    }
                    return true;
                });
            multiResolver.Run();
            if (multiResolver.HasSucceeded)
            {
                // get the n-closest.
                var closest = multiResolver.Result;
                    linksDb.Add((uint)stopId, closest);
            }
        }

        db.AddStopLinksDb(linksDb);
    }

but HasSucceeded is always false. Thanks

xivk commented 7 years ago

Should be fixed now...