Package org.opentripplanner.routing.graph

Examples of org.opentripplanner.routing.graph.Graph$GraphObjectInputStream


        states = path.states.toArray(states);

        Edge[] edges = new Edge[path.edges.size()];
        edges = path.edges.toArray(edges);

        Graph graph = path.getRoutingContext().graph;

        FareService fareService = graph.getService(FareService.class);

        State[][] legsStates = sliceStates(states);

        if (fareService != null) {
            itinerary.fare = fareService.getCost(path);
View Full Code Here


    }

    /** Returns the first trip of the service day. Currently unused.
     * TODO This should probably be done with a special time value. */
    public TripPlan generateFirstTrip(RoutingRequest request) {
        Graph graph = graphService.getGraph(request.routerId);

        request.setArriveBy(false);

        TimeZone tz = graph.getTimeZone();

        GregorianCalendar calendar = new GregorianCalendar(tz);
        calendar.setTimeInMillis(request.dateTime * 1000);
        calendar.set(Calendar.HOUR, 0);
        calendar.set(Calendar.MINUTE, 0);
View Full Code Here

    }

    /** Return the last trip of the service day. Currently unused.
     * TODO This should probably be done with a special time value. */
    public TripPlan generateLastTrip(RoutingRequest request) {
        Graph graph = graphService.getGraph(request.routerId);

        request.setArriveBy(true);

        TimeZone tz = graph.getTimeZone();

        GregorianCalendar calendar = new GregorianCalendar(tz);
        calendar.setTimeInMillis(request.dateTime * 1000);
        calendar.set(Calendar.HOUR, 0);
        calendar.set(Calendar.MINUTE, 0);
View Full Code Here

        // Build the request
        try {
            RoutingRequest req = buildRequest(0); // batch must be true
          
            Graph graph;
           
            // routerId is optional -- select default graph if not set
          if(routerId == null || routerId.isEmpty()) {
            graph = server.graphService.getGraph();
          }
View Full Code Here

        if (surf == null) return badRequest("Invalid TimeSurface ID.");
        final PointSet pset = server.pointSetCache.get(targetPointSetId);
        if (pset == null) return badRequest("Missing or invalid target PointSet ID.");
       
        //TODO cache this sampleset
        Graph gg = server.graphService.getGraph(surf.routerId);
        SampleSet samples = pset.getSampleSet( gg );
       
        final ResultFeature indicator = new ResultFeature(samples, surf);
        if (indicator == null) return badServer("Could not compute indicator as requested.");
        return Response.ok().entity(new StreamingOutput() {
View Full Code Here

                    .build());
        return routerInfo;
    }
   
    private RouterInfo getRouterInfo(String routerId) {
        Graph graph = server.graphService.getGraph(routerId);
        if (graph == null) return null;
        RouterInfo routerInfo = new RouterInfo();
        routerInfo.routerId = routerId;
        routerInfo.polygon = graph.getHull();
        routerInfo.buildTime = graph.buildTime;
        return routerInfo;
    }
View Full Code Here

        if (preEvict) {
            LOG.debug("pre-evicting graph");
            server.graphService.evictGraph(routerId);
        }
        LOG.debug("deserializing graph from POST data stream...");
        Graph graph;
        try {
            graph = Graph.load(is, level);
            server.graphService.registerGraph(routerId, new MemoryGraphSource(routerId, graph));
            return Response.status(Status.CREATED).entity(graph.toString() + "\n").build();
        } catch (Exception e) {
            return Response.status(Status.BAD_REQUEST).entity(e.toString() + "\n").build();
        }
    }
View Full Code Here

            file.delete();
        }
       
        tempDir.delete();
       
        Graph graph = graphBuilder.getGraph();
        graph.index(new DefaultStreetVertexIndexFactory());
       
        server.graphService.registerGraph(routerId, new MemoryGraphSource(routerId, graph));
        return Response.status(Status.CREATED).entity(graph.toString() + "\n").build();
    }
View Full Code Here

        if (thisState.isCarParked() != other.isCarParked())
            return false;
        if (thisState.isBikeParked() != other.isBikeParked())
            return false;

        Graph graph = thisState.getOptions().rctx.graph;
        if (thisState.backEdge != other.getBackEdge() && ((thisState.backEdge instanceof StreetEdge)
                && (!graph.getTurnRestrictions(thisState.backEdge).isEmpty())))
            return false;

        if (thisState.routeSequenceSubset(other)) {
            // TODO subset is not really the right idea
            return thisState.weight <= other.weight &&
View Full Code Here

     * {@link ShortestPathTree} Interface
     ****/

    @Override
    public boolean add(State state) {
        Graph graph = state.getOptions().rctx.graph;
        Vertex here = state.getVertex();
        State existing = states.get(here);
        if (existing == null || state.betterThan(existing)) {
            states.put(here, state);
            return true;
        } else {
            final Edge backEdge = existing.getBackEdge();
            // If the previous back edge had turn restrictions, we need to continue
            // the search because the previous path may be prevented by from reaching the end by
            // turn restrictions.

            return !graph.getTurnRestrictions(backEdge).isEmpty();
        }
    }
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.graph.Graph$GraphObjectInputStream

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.