Package org.opentripplanner.routing.graph

Examples of org.opentripplanner.routing.graph.Vertex$ValidEdgeTypes


        DisplayVertex selected = (DisplayVertex) nearbyVertices.getSelectedValue();
        if (selected == null) {
            System.out.println("no vertex selected");
            return;
        }
        Vertex v = selected.vertex;
        System.out.println("initial vertex: " + v);
        Queue<Vertex> toExplore = new LinkedList<Vertex>();
        toExplore.add(v);
        seenVertices.add(v);
        while (!toExplore.isEmpty()) {
            Vertex src = toExplore.poll();
            for (Edge e : src.getOutgoing()) {
                Vertex tov = e.getToVertex();
                if (!seenVertices.contains(tov)) {
                    seenVertices.add(tov);
                    toExplore.add(tov);
                }
            }
View Full Code Here


    protected void checkGraph() {

        HashSet<Vertex> seenVertices = new HashSet<Vertex>();
        Collection<Vertex> allVertices = getGraph().getVertices();
        Vertex v = allVertices.iterator().next();
        System.out.println("initial vertex: " + v);
        Queue<Vertex> toExplore = new LinkedList<Vertex>();
        toExplore.add(v);
        seenVertices.add(v);
        while (!toExplore.isEmpty()) {
            Vertex src = toExplore.poll();
            for (Edge e : src.getOutgoing()) {
                Vertex tov = e.getToVertex();
                if (!seenVertices.contains(tov)) {
                    seenVertices.add(tov);
                    toExplore.add(tov);
                }
            }
View Full Code Here

        ListModel<DisplayVertex> data = new VertexList(selected);
        nearbyVertices.setModel(data);

        // pick out an intersection vertex and find the path
        // if the spt is already available
        Vertex target=null;
        for(Vertex vv : selected){
          if( vv instanceof IntersectionVertex ){
            target = vv;
            break;
          }
View Full Code Here

     ****/

    @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 {
View Full Code Here

      int divergence=-1;
      int convergence=-1;
     
      // find divergence
      for(int i=0; i<minlen; i++){
        Vertex v1 = firstComparePath.states.get(i).getVertex();
        Vertex v2 = secondComparePath.states.get(i).getVertex();
        if(!v1.equals(v2)){
          divergence = i-1;
          break;
        }
      }
     
      // find convergence
      for(int i=0; i<minlen; i++){
        Vertex v1 = firstComparePath.states.get(l1-i-1).getVertex();
        Vertex v2 = secondComparePath.states.get(l2-i-1).getVertex();
        if(!v1.equals(v2)){
          convergence = i-1;
          break;
        }
      }
View Full Code Here

            // this section handles the case of an option which is only an option if you walk your
            // bike. It is complicated because you will not need to walk your bike until one
            // edge after the current edge.

            //now, from here, try a continuing path.
            Vertex tov = outState.getVertex();
            boolean found = false;
            for (Edge out2 : tov.getOutgoing()) {
                State outState2 = out2.traverse(outState);
                if (outState2 != null && !outState2.getBackMode().equals(requestedMode)) {
                    // walking a bike, so, not really an exit
                    continue;
                }
View Full Code Here

    }

    @SuppressWarnings("rawtypes")
    private void postSetup() {
        for (Vertex gv : graph.getVertices()) {
            Vertex v = gv;
            /*
             * We add all edges with geometry, skipping transit, filtering them out after. We do not
             * index transit edges as we do not need them and some GTFS do not have shape data, so
             * long straight lines between 2 faraway stations will wreck performance on a hash grid
             * spatial index.
             *
             * If one need to store transit edges in the index, we could improve the hash grid
             * rasterizing splitting long segments.
             */
            for (Edge e : gv.getOutgoing()) {
                if (e instanceof PatternEdge)
                    continue;
                LineString geometry = e.getGeometry();
                if (geometry == null) {
                    continue;
                }
                Envelope env = geometry.getEnvelopeInternal();
                if (edgeTree instanceof HashGridSpatialIndex)
                    ((HashGridSpatialIndex)edgeTree).insert(geometry, e);
                else
                    edgeTree.insert(env, e);
            }
            if (v instanceof TransitStop) {
                Envelope env = new Envelope(v.getCoordinate());
                transitStopTree.insert(env, v);
            }
            Envelope env = new Envelope(v.getCoordinate());
            verticesTree.insert(env, v);
        }
    }
View Full Code Here

        }

        // if no intersection vertices were found, then find the closest transit stop
        // (we can return stops here because this method is not used when street-transit linking)
        double closestStopDistance = Double.POSITIVE_INFINITY;
        Vertex closestStop = null;
        // elsewhere options=null means no restrictions, find anything.
        // here we skip examining stops, as they are really only relevant when transit is being used
        if (options != null && options.modes.isTransit()) {
            for (TransitStop v : getNearbyTransitStops(coord, 1000)) {
                if (!v.isStreetLinkable()) continue;
View Full Code Here

    @Override
    public List<Vertex> getVerticesForEnvelope(Envelope envelope) {
        List<Vertex> vertices = verticesTree.query(envelope);
        // Here we assume vertices list modifiable
        for (Iterator<Vertex> iv = vertices.iterator(); iv.hasNext();) {
            Vertex v = iv.next();
            if (!envelope.contains(new Coordinate(v.getLon(), v.getLat())))
                iv.remove();
        }
        return vertices;
    }
View Full Code Here

            toIncoming.remove(e);
        }
    }

    public void addEdge(Edge e) {
        Vertex fromv = e.getFromVertex();
        Vertex tov = e.getToVertex();
        addOutgoing(fromv, e);
        addIncoming(tov, e);
    }
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.graph.Vertex$ValidEdgeTypes

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.