Package org.opentripplanner.routing.alertpatch

Examples of org.opentripplanner.routing.alertpatch.Alert


            handleAlert(id, alert);
        }
    }

    private void handleAlert(String id, GtfsRealtime.Alert alert) {
        Alert alertText = new Alert();
        alertText.alertDescriptionText = deBuffer(alert.getDescriptionText());
        alertText.alertHeaderText = deBuffer(alert.getHeaderText());
        alertText.alertUrl = deBuffer(alert.getUrl());
        ArrayList<TimePeriod> periods = new ArrayList<TimePeriod>();
        if(alert.getActivePeriodCount() > 0) {
View Full Code Here


    }

    public T2<Alert, NoteMatcher> generateNote(OSMWithTags way) {
        Map<String, String> noteText = TemplateLibrary.generateI18N(notePattern, way,
                Alert.defaultLanguage);
        Alert note = new Alert();
        note.alertHeaderText = new TranslatedString();
        for (Map.Entry<String, String> kv : noteText.entrySet()) {
            note.alertHeaderText.addTranslation(kv.getKey(), kv.getValue());
        }
        return new T2<>(note, noteMatcher);
View Full Code Here

        alerts = new TestAlertPatch[] {new TestAlertPatch(), new TestAlertPatch(),
                new TestAlertPatch(), new TestAlertPatch()};
        alerts[0].setRoute(testRoute);
        alerts[0].setStop(testStop);

        alerts[0].setAlert(new Alert());
        alerts[1].setAlert(new Alert());
        alerts[2].setAlert(new Alert());
        alerts[3].setAlert(new Alert());

        alerts[0].setId("0");
        alerts[1].setId("1");
        alerts[2].setId("2");
        alerts[3].setId("3");
View Full Code Here

    public void testStreetSplittingAlerts() {
        HashSet<Edge> turns = new HashSet<Edge>();
        turns.add(left);
        turns.add(leftBack);

        Alert alert = Alert.createSimpleAlerts("This is the alert");
        Set<Alert> alerts = new HashSet<>();
        alerts.add(alert);

        graph.streetNotesService.addStaticNote(left, alert, StreetNotesService.ALWAYS_MATCHER);
        graph.streetNotesService.addStaticNote(leftBack, alert, StreetNotesService.ALWAYS_MATCHER);

        StreetLocation start = StreetLocation.createStreetLocation(graph, "start", "start",
                filter(turns, StreetEdge.class),
                new LinearLocation(0, 0.4).getCoordinate(left.getGeometry()));

        // The alert should be preserved
        // traverse the FreeEdge from the StreetLocation to the new IntersectionVertex
        RoutingRequest req = new RoutingRequest();
        req.setMaxWalkDistance(Double.MAX_VALUE);
        State traversedOne = new State((Vertex) start, req);
        State currentState;
        for (Edge e : start.getOutgoing()) {
            currentState = e.traverse(traversedOne);
            if (currentState != null) {
                traversedOne = currentState;
                break;
            }
        }

        assertEquals(alerts, graph.streetNotesService.getNotes(traversedOne));
        assertNotSame(left, traversedOne.getBackEdge().getFromVertex());
        assertNotSame(leftBack, traversedOne.getBackEdge().getFromVertex());

        // now, make sure wheelchair alerts are preserved
        Alert wheelchairAlert = Alert.createSimpleAlerts("This is the wheelchair alert");
        Set<Alert> wheelchairAlerts = new HashSet<>();
        wheelchairAlerts.add(wheelchairAlert);

        graph.streetNotesService.removeStaticNotes(left);
        graph.streetNotesService.removeStaticNotes(leftBack);
View Full Code Here

                backStreet.shareData(street);

                if (noteConverter != null) {
                  String note = noteConverter.convert(feature);
                  if (note != null && note.length() > 0) {
        Alert noteAlert = Alert.createSimpleAlerts(note);
        graph.streetNotesService.addStaticNote(street, noteAlert, StreetNotesService.ALWAYS_MATCHER);
        graph.streetNotesService.addStaticNote(backStreet, noteAlert, StreetNotesService.ALWAYS_MATCHER);
                  }
                }
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.alertpatch.Alert

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.