use of org.opentripplanner.graph_builder.DataImportIssue in project OpenTripPlanner by opentripplanner.
the class GraphVisualizer method initRightPanel.
private void initRightPanel(Container pane) {
/* right panel holds trip pattern and stop metadata */
JPanel rightPanel = new JPanel();
rightPanel.setLayout(new BorderLayout());
pane.add(rightPanel, BorderLayout.LINE_END);
JTabbedPane rightPanelTabs = new JTabbedPane();
rightPanel.add(rightPanelTabs, BorderLayout.LINE_END);
// a place to print out the details of a path
pathStates = new JList<State>();
JScrollPane stScrollPane = new JScrollPane(pathStates);
stScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
rightPanelTabs.addTab("path states", stScrollPane);
// when you select a path component state, it prints the backedge's metadata
pathStates.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
outgoingEdges.clearSelection();
incomingEdges.clearSelection();
@SuppressWarnings("unchecked") JList<State> theList = (JList<State>) e.getSource();
State st = (State) theList.getSelectedValue();
Edge edge = st.getBackEdge();
reactToEdgeSelection(edge, false);
}
});
metadataList = new JList<String>();
metadataModel = new DefaultListModel<String>();
metadataList.setModel(metadataModel);
JScrollPane mdScrollPane = new JScrollPane(metadataList);
mdScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
rightPanelTabs.addTab("metadata", mdScrollPane);
// This is where matched issues from an issue search go
issueMatches = new JList<>();
issueMatches.addListSelectionListener(e -> {
@SuppressWarnings("unchecked") JList<DataImportIssue> theList = (JList<DataImportIssue>) e.getSource();
DataImportIssue issue = theList.getSelectedValue();
if (issue == null) {
return;
}
showGraph.drawIssue(issue);
});
issueMatchesModel = new DefaultListModel<DataImportIssue>();
issueMatches.setModel(issueMatchesModel);
JScrollPane imScrollPane = new JScrollPane(issueMatches);
imScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
rightPanelTabs.addTab("issues", imScrollPane);
Dimension size = new Dimension(200, 1600);
imScrollPane.setMaximumSize(size);
imScrollPane.setPreferredSize(size);
stScrollPane.setMaximumSize(size);
stScrollPane.setPreferredSize(size);
mdScrollPane.setMaximumSize(size);
mdScrollPane.setPreferredSize(size);
rightPanelTabs.setMaximumSize(size);
rightPanel.setMaximumSize(size);
}
use of org.opentripplanner.graph_builder.DataImportIssue in project OpenTripPlanner by opentripplanner.
the class TestGeometryAndBlockProcessor method testIssue.
public void testIssue() {
boolean found = false;
for (DataImportIssue it : issueStore.getIssues()) {
if (it instanceof NegativeHopTime) {
NegativeHopTime nht = (NegativeHopTime) it;
assertTrue(nht.st0.getDepartureTime() > nht.st1.getArrivalTime());
found = true;
}
}
assertTrue(found);
}
use of org.opentripplanner.graph_builder.DataImportIssue in project OpenTripPlanner by opentripplanner.
the class SimpleStreetSplitter method link.
@SuppressWarnings("Convert2MethodRef")
public <T extends Vertex> void link(Class<T> type, Function<T, DataImportIssue> unlinkedIssueMapper) {
@SuppressWarnings("unchecked") List<T> vertices = graph.getVertices().stream().filter(type::isInstance).map(it -> (T) it).collect(Collectors.toList());
String actionName = "Link " + type.getSimpleName();
if (vertices.isEmpty()) {
LOG.info("{} skiped. No such data exist.", actionName);
return;
}
ProgressTracker progress = ProgressTracker.track(actionName, 500, vertices.size());
LOG.info(progress.startMessage());
for (T v : vertices) {
// Do not link vertices, which are already linked by TransitToTaggedStopsModule
boolean alreadyLinked = v.getOutgoing().stream().anyMatch(e -> e instanceof StreetTransitLink);
if (alreadyLinked) {
continue;
}
// Do not link stops connected by pathways
if (v instanceof TransitStopVertex && ((TransitStopVertex) v).hasPathways()) {
continue;
}
if (!link(v)) {
issueStore.add(unlinkedIssueMapper.apply(v));
}
// Keep lambda! A method-ref would cause incorrect class and line number to be logged
progress.step(m -> LOG.info(m));
}
LOG.info(progress.completeMessage());
}
Aggregations