Package org.opentripplanner.analyst.core

Examples of org.opentripplanner.analyst.core.Sample


        // 3. Compute the isochrone based on the SPT.
        ZFunc timeFunc = new ZFunc() {
            @Override
            public long z(Coordinate c) {
                // TODO Make the sample source multi-router compatible
                Sample sample = sampleSource.getSample(c.x, c.y);
                if (sample == null) {
                    return Long.MAX_VALUE;
                }
                Long z = sample.eval(spt);
                return z;
            }
        };
        // TODO Snap the center as XYZ tile grid for better sample-reuse (if using sample cache).
        Coordinate center = sptRequest.from.getCoordinate();
View Full Code Here


        v0s = new Vertex[pset.capacity];
        v1s = new Vertex[pset.capacity];
        d0s = new float[pset.capacity];
        d1s = new float[pset.capacity];
        for (int i = 0; i < pset.capacity; i++) {
            Sample sample = sfac.getSample(pset.lons[i], pset.lats[i]);
            if (sample == null) {
                d0s[i] = Float.NaN;
                d1s[i] = Float.NaN;
                continue;
            }
View Full Code Here

                return null;
            double d0 = d + best.distanceAlong();
            int t0 = (int) (d0 / 1.33);
            double d1 = d + best.distanceToEnd();
            int t1 = (int) (d1 / 1.33);
            Sample s = new Sample(v0, t0, v1, t1);
            //System.out.println(s.toString());
            return s;
        }
        return null;
    }
View Full Code Here

   
    public static ResultSet forTravelTimes(Population population, ShortestPathTree spt) {
        double[] results = new double[population.size()];
        int i = 0;
        for (Individual indiv : population) {
            Sample s = indiv.sample;
            long t = Long.MAX_VALUE;
            if (s == null)
                t = -2;
            else
                t = s.eval(spt);
            if (t == Long.MAX_VALUE)
                t = -1;
            results[i] = t;
            i++;
        }
View Full Code Here

     */
    private void linkIntoGraph(Population p) {
        LOG.info("linking population {} to the graph...", p);
        int n = 0, nonNull = 0;
        for (Individual i : p) {
            Sample s = sampleFactory.getSample(i.lon, i.lat);
            i.sample = s;
            n += 1;
            if (s != null)
                nonNull += 1;
        }
View Full Code Here

TOP

Related Classes of org.opentripplanner.analyst.core.Sample

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.