Search in sources :

Example 1 with DataImportIssue

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);
}
Also used : ListSelectionEvent(javax.swing.event.ListSelectionEvent) DataImportIssue(org.opentripplanner.graph_builder.DataImportIssue) ListSelectionListener(javax.swing.event.ListSelectionListener) State(org.opentripplanner.routing.core.State) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) Edge(org.opentripplanner.routing.graph.Edge)

Example 2 with DataImportIssue

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);
}
Also used : NegativeHopTime(org.opentripplanner.graph_builder.issues.NegativeHopTime) DataImportIssue(org.opentripplanner.graph_builder.DataImportIssue)

Example 3 with DataImportIssue

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());
}
Also used : TemporaryFreeEdge(org.opentripplanner.routing.edgetype.TemporaryFreeEdge) DefaultStreetEdgeFactory(org.opentripplanner.graph_builder.services.DefaultStreetEdgeFactory) LinearLocation(org.locationtech.jts.linearref.LinearLocation) StopLinkedTooFar(org.opentripplanner.graph_builder.issues.StopLinkedTooFar) TemporaryVertex(org.opentripplanner.routing.vertextype.TemporaryVertex) TransitStopVertex(org.opentripplanner.routing.vertextype.TransitStopVertex) LoggerFactory(org.slf4j.LoggerFactory) Coordinate(org.locationtech.jts.geom.Coordinate) SphericalDistanceLibrary(org.opentripplanner.common.geometry.SphericalDistanceLibrary) TemporaryStreetLocation(org.opentripplanner.routing.location.TemporaryStreetLocation) EntranceUnlinked(org.opentripplanner.graph_builder.issues.EntranceUnlinked) NonLocalizedString(org.opentripplanner.util.NonLocalizedString) SplitterVertex(org.opentripplanner.routing.vertextype.SplitterVertex) StreetTransitLink(org.opentripplanner.routing.edgetype.StreetTransitLink) Graph(org.opentripplanner.routing.graph.Graph) BikeRentalStationVertex(org.opentripplanner.routing.vertextype.BikeRentalStationVertex) TraverseMode(org.opentripplanner.routing.core.TraverseMode) GenericLocation(org.opentripplanner.model.GenericLocation) I18NString(org.opentripplanner.util.I18NString) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) StreetVertex(org.opentripplanner.routing.vertextype.StreetVertex) TransitEntranceVertex(org.opentripplanner.routing.vertextype.TransitEntranceVertex) List(java.util.List) AreaEdge(org.opentripplanner.routing.edgetype.AreaEdge) P2(org.opentripplanner.common.model.P2) Iterables(com.google.common.collect.Iterables) TemporarySplitterVertex(org.opentripplanner.routing.vertextype.TemporarySplitterVertex) OSMWithTags(org.opentripplanner.openstreetmap.model.OSMWithTags) StopUnlinked(org.opentripplanner.graph_builder.issues.StopUnlinked) StreetEdgeFactory(org.opentripplanner.graph_builder.services.StreetEdgeFactory) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) TransitEntranceLink(org.opentripplanner.routing.edgetype.TransitEntranceLink) Function(java.util.function.Function) LocationIndexedLine(org.locationtech.jts.linearref.LocationIndexedLine) LocalizedString(org.opentripplanner.util.LocalizedString) ArrayList(java.util.ArrayList) DataImportIssue(org.opentripplanner.graph_builder.DataImportIssue) DataImportIssueStore(org.opentripplanner.graph_builder.DataImportIssueStore) HashGridSpatialIndex(org.opentripplanner.common.geometry.HashGridSpatialIndex) BikeParkUnlinked(org.opentripplanner.graph_builder.issues.BikeParkUnlinked) GeometryFactory(org.locationtech.jts.geom.GeometryFactory) Logger(org.slf4j.Logger) Vertex(org.opentripplanner.routing.graph.Vertex) StreetBikeRentalLink(org.opentripplanner.routing.edgetype.StreetBikeRentalLink) IntersectionVertex(org.opentripplanner.routing.vertextype.IntersectionVertex) TraverseModeSet(org.opentripplanner.routing.core.TraverseModeSet) StreetBikeParkLink(org.opentripplanner.routing.edgetype.StreetBikeParkLink) GeometryUtils(org.opentripplanner.common.geometry.GeometryUtils) LineString(org.locationtech.jts.geom.LineString) StreetVertexIndex(org.opentripplanner.routing.impl.StreetVertexIndex) SpatialIndex(org.locationtech.jts.index.SpatialIndex) AreaEdgeList(org.opentripplanner.routing.edgetype.AreaEdgeList) BikeParkVertex(org.opentripplanner.routing.vertextype.BikeParkVertex) RoutingRequest(org.opentripplanner.routing.api.request.RoutingRequest) StreetTraversalPermission(org.opentripplanner.routing.edgetype.StreetTraversalPermission) ProgressTracker(org.opentripplanner.util.ProgressTracker) Envelope(org.locationtech.jts.geom.Envelope) Edge(org.opentripplanner.routing.graph.Edge) BikeRentalStationUnlinked(org.opentripplanner.graph_builder.issues.BikeRentalStationUnlinked) ProgressTracker(org.opentripplanner.util.ProgressTracker) TransitStopVertex(org.opentripplanner.routing.vertextype.TransitStopVertex) StreetTransitLink(org.opentripplanner.routing.edgetype.StreetTransitLink) NonLocalizedString(org.opentripplanner.util.NonLocalizedString) I18NString(org.opentripplanner.util.I18NString) LocalizedString(org.opentripplanner.util.LocalizedString) LineString(org.locationtech.jts.geom.LineString)

Aggregations

DataImportIssue (org.opentripplanner.graph_builder.DataImportIssue)3 StreetEdge (org.opentripplanner.routing.edgetype.StreetEdge)2 Iterables (com.google.common.collect.Iterables)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 UUID (java.util.UUID)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1 Coordinate (org.locationtech.jts.geom.Coordinate)1 Envelope (org.locationtech.jts.geom.Envelope)1 GeometryFactory (org.locationtech.jts.geom.GeometryFactory)1 LineString (org.locationtech.jts.geom.LineString)1 SpatialIndex (org.locationtech.jts.index.SpatialIndex)1 LinearLocation (org.locationtech.jts.linearref.LinearLocation)1 LocationIndexedLine (org.locationtech.jts.linearref.LocationIndexedLine)1 GeometryUtils (org.opentripplanner.common.geometry.GeometryUtils)1 HashGridSpatialIndex (org.opentripplanner.common.geometry.HashGridSpatialIndex)1 SphericalDistanceLibrary (org.opentripplanner.common.geometry.SphericalDistanceLibrary)1