Search in sources :

Example 6 with GraphBuilderAnnotation

use of org.opentripplanner.graph_builder.annotation.GraphBuilderAnnotation in project OpenTripPlanner by opentripplanner.

the class GraphVisualizer method findAnnotation.

protected void findAnnotation() {
    Set<Class<? extends GraphBuilderAnnotation>> gbaClasses = Sets.newHashSet();
    for (GraphBuilderAnnotation gba : graph.getBuilderAnnotations()) {
        gbaClasses.add(gba.getClass());
    }
    @SuppressWarnings("unchecked") Class<? extends GraphBuilderAnnotation> variety = (Class<? extends GraphBuilderAnnotation>) JOptionPane.showInputDialog(// parentComponent; TODO: set correctly
    null, // question
    "Select the type of annotation to find", // title
    "Select annotation", // message type
    JOptionPane.QUESTION_MESSAGE, // no icon
    null, // options (built above)
    gbaClasses.toArray(), // default value
    StopUnlinked.class);
    // User clicked cancel
    if (variety == null)
        return;
    // loop over the annotations and save the ones of the requested type
    annotationMatchesModel.clear();
    for (GraphBuilderAnnotation anno : graph.getBuilderAnnotations()) {
        if (variety.isInstance(anno)) {
            annotationMatchesModel.addElement(anno);
        }
    }
    System.out.println("Found " + annotationMatchesModel.getSize() + " annotations of type " + variety);
}
Also used : GraphBuilderAnnotation(org.opentripplanner.graph_builder.annotation.GraphBuilderAnnotation) StopUnlinked(org.opentripplanner.graph_builder.annotation.StopUnlinked)

Aggregations

GraphBuilderAnnotation (org.opentripplanner.graph_builder.annotation.GraphBuilderAnnotation)6 StreetEdge (org.opentripplanner.routing.edgetype.StreetEdge)2 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1 NegativeHopTime (org.opentripplanner.graph_builder.annotation.NegativeHopTime)1 StopUnlinked (org.opentripplanner.graph_builder.annotation.StopUnlinked)1 State (org.opentripplanner.routing.core.State)1 Edge (org.opentripplanner.routing.graph.Edge)1 PatternArriveVertex (org.opentripplanner.routing.vertextype.PatternArriveVertex)1