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);
}
Aggregations