Package org.opentripplanner.routing.graph

Examples of org.opentripplanner.routing.graph.Edge


            incomingEdges.clearSelection();
   
            @SuppressWarnings("unchecked")
        JList<State> theList = (JList<State>)e.getSource();
            State st = (State)theList.getSelectedValue();
            Edge edge = st.getBackEdge();
            reactToEdgeSelection( edge, false );
          }
        });
        
View Full Code Here


        findEdgeByIdButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String edgeIdStr = (String) JOptionPane.showInputDialog(frame, "Edge ID",
                        JOptionPane.PLAIN_MESSAGE);
                Integer edgeId = Integer.parseInt(edgeIdStr);
                Edge edge = getGraph().getEdgeById(edgeId);
                if (edge != null) {
                    showGraph.highlightEdge(edge);
                    showGraph.highlightVertex(edge.getFromVertex());
                } else {
                    System.out.println("Found no edge with ID " + edgeIdStr);
                }
            }
        });
View Full Code Here

            public void valueChanged(ListSelectionEvent e) {

                @SuppressWarnings("unchecked")
        JList<Edge> edgeList = (JList<Edge>) e.getSource();
               
                Edge selected = (Edge) edgeList.getSelectedValue();
               
                boolean outgoing = (edgeList==outgoingEdges);
                reactToEdgeSelection( selected, outgoing );
            }
View Full Code Here

        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

    @Override
    public boolean visit(State s) {
        final Graph graph = s.getOptions().rctx.graph;
        final State existing = states.get(s.getVertex());
        final Edge backEdge = existing.getBackEdge();
        if (!graph.getTurnRestrictions(backEdge).isEmpty()) {
            // 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.
View Full Code Here

     *
     * @param state
     * @return The set of notes or null if empty.
     */
    public Set<Alert> getNotes(State state) {
        Edge edge = state.getBackEdge();
        Set<MatcherAndAlert> maas = new HashSet<MatcherAndAlert>();

        for (StreetNotesSource source : sources) {
            Set<MatcherAndAlert> maas2 = source.getNotes(edge);
            if (maas2 != null)
View Full Code Here

        // disable path parsing temporarily
        pathParsers = stateData.opt.rctx.pathParsers;
        stateData.opt.rctx.pathParsers = new PathParser[0];

        Edge edge = null;

        while (orig.getBackState() != null) {
            edge = orig.getBackEdge();
           
            if (optimize) {
                // first board/last alight: figure in wait time in on the fly optimization
                if (edge instanceof TransitBoardAlight &&
                        forward &&
                        orig.getNumBoardings() == 1 &&
                        (
                                // boarding in a forward main search
                                (((TransitBoardAlight) edge).boarding &&                        
                                        !stateData.opt.arriveBy) ||
                                // alighting in a reverse main search
                                (!((TransitBoardAlight) edge).boarding &&
                                        stateData.opt.arriveBy)
                         )
                    ) {

                    ret = ((TransitBoardAlight) edge).traverse(ret, orig.getBackState().getTimeSeconds());
                    newInitialWaitTime = ret.stateData.initialWaitTime;
                } else {
                    ret = edge.traverse(ret);
                }

                if (ret != null && ret.getBackMode() != null && orig.getBackMode() != null &&
                        ret.getBackMode() != orig.getBackMode()) {
                    ret = ret.next; // Keep the mode the same as on the original graph path (in K+R)
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public Collection<Edge> getEdgesForEnvelope(Envelope envelope) {
        List<Edge> edges = edgeTree.query(envelope);
        for (Iterator<Edge> ie = edges.iterator(); ie.hasNext();) {
            Edge e = ie.next();
            Envelope eenv = e.getGeometry().getEnvelopeInternal();
            //Envelope eenv = e.getEnvelope();
            if (!envelope.intersects(eenv))
                ie.remove();
        }
        return edges;
View Full Code Here

    public State traverse(State s0) {
        // Do not enter park and ride mechanism if it's not activated in the routing request.
        if ( ! s0.getOptions().parkAndRide) {
            return null;
        }
        Edge backEdge = s0.getBackEdge();
        boolean back = s0.getOptions().arriveBy;
        // If we are exiting (or entering-backward), check if we
        // really parked a car: this will prevent using P+R as
        // shortcut.
        if ((back != exit) && !(backEdge instanceof ParkAndRideEdge))
View Full Code Here

    private void drawGraphPath(GraphPath gp) {
        // draw edges in different colors according to mode
        for (State s : gp.states) {
            TraverseMode mode = s.getBackMode();

            Edge e = s.getBackEdge();
            if (e == null)
                continue;

            if (mode != null && mode.isTransit()) {
                stroke(200, 050, 000);
                strokeWeight(6);
                drawEdge(e);
            }
            if (e instanceof StreetEdge) {
                StreetTraversalPermission stp = ((StreetEdge) e).getPermission();
                if (stp == StreetTraversalPermission.PEDESTRIAN) {
                    stroke(000, 200, 000);
                    strokeWeight(6);
                    drawEdge(e);
                } else if (stp == StreetTraversalPermission.BICYCLE) {
                    stroke(000, 000, 200);
                    strokeWeight(6);
                    drawEdge(e);
                } else if (stp == StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE) {
                    stroke(000, 200, 200);
                    strokeWeight(6);
                    drawEdge(e);
                } else if (stp == StreetTraversalPermission.ALL) {
                    stroke(200, 200, 200);
                    strokeWeight(6);
                    drawEdge(e);
                } else {
                    stroke(64, 64, 64);
                    strokeWeight(6);
                    drawEdge(e);
                }
            }
        }
        // mark key vertices
        lastLabelY = -999;
        labelState(gp.states.getFirst(), "begin");
        for (State s : gp.states) {
            Edge e = s.getBackEdge();
            if (e instanceof TransitBoardAlight) {
                if (((TransitBoardAlight) e).boarding) {
                    labelState(s, "board");
                } else {
                    labelState(s, "alight");
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.graph.Edge

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.