Package org.movsim.simulator.roadnetwork

Examples of org.movsim.simulator.roadnetwork.RoadSegment


    private static void handleJunctions(OpenDRIVE openDriveNetwork, RoadNetwork roadNetwork) {
        // iterate through all the junctions
        for (Junction junction : openDriveNetwork.getJunction()) {
            for (Connection connection : junction.getConnection()) {
                RoadSegment incomingRoadSegment = Preconditions.checkNotNull(
                        roadNetwork.findByUserId(connection.getIncomingRoad()), "Cannot find incoming road: "
                                + connection.getIncomingRoad());
                RoadSegment connenctingRoadSegment = Preconditions.checkNotNull(
                        roadNetwork.findByUserId(connection.getConnectingRoad()), "Cannot find connecting road: "
                                + connection.getConnectingRoad());
                Road road = findByUserId(openDriveNetwork.getRoad(), connection.getConnectingRoad());
                if (roadPredecessorIsJunction(junction, road)) {
                    for (final LaneLink laneLink : connection.getLaneLink()) {
View Full Code Here


            LOG.info("edge weight={}", graph.getEdgeWeight(roadSegment));
            graph.setEdgeWeight(roadSegment, roadSegment.roadLength());
            // add vertex to successor links AND to predecessor links of successors
            for (LaneSegment laneSegment : roadSegment.laneSegments()) {
                if (laneSegment.sinkLaneSegment() != null) {
                    RoadSegment successor = laneSegment.sinkLaneSegment().roadSegment();
                    successor.setNode(NodeType.ORIGIN, toVertex);
                    for (LaneSegment laneSegmentSuccessor : successor.laneSegments()) {
                        if (laneSegmentSuccessor.sourceLaneSegment() != null) {
                            RoadSegment predecessor = laneSegmentSuccessor.sourceLaneSegment().roadSegment();
                            predecessor.setNode(NodeType.DESTINATION, toVertex);
                        }
                    }
                }
            }
        }
View Full Code Here

    private void createPredefinedRoutes(Routes routesInput) {
        for (org.movsim.autogen.Route routeInput : routesInput.getRoute()) {
            Route route = new Route(routeInput.getLabel());
            for (org.movsim.autogen.Road roadInput : routeInput.getRoad()) {
                RoadSegment roadSegment = roadNetwork.findByUserId(roadInput.getId());
                Preconditions.checkNotNull(roadSegment, "cannot create route \"" + route.getName()
                        + "\" with undefinied road=" + roadInput.getId());
                route.add(roadSegment);
            }
            Route replaced = predefinedRoutes.put(route.getName(), route);
View Full Code Here

        }
        Preconditions.checkArgument(startRoadId != null && !startRoadId.isEmpty());
        Preconditions.checkArgument(destinationRoadId != null && !destinationRoadId.isEmpty());

        Route route = new Route(createRouteName(startRoadId, destinationRoadId));
        RoadSegment startRoadSegment = roadNetwork.findByUserId(startRoadId);
        route.add(startRoadSegment);
        RoadSegment endRoadSegment = roadNetwork.findByUserId(destinationRoadId);

        LOG.info("Shortest path from roadSegment={} to={}", startRoadId, destinationRoadId);
        LOG.info("From node={} to node={}", startRoadSegment.getNode(NodeType.DESTINATION),
                endRoadSegment.getNode(NodeType.DESTINATION));

        List<RoadSegment> path = DijkstraShortestPath.findPathBetween(graph,
                startRoadSegment.getNode(NodeType.DESTINATION), endRoadSegment.getNode(NodeType.DESTINATION));
        if (path == null) {
            throw new IllegalStateException("cannot find route from startRoadId=" + startRoadId
                    + " to destinationRoadId=" + destinationRoadId);
        }
View Full Code Here

TOP

Related Classes of org.movsim.simulator.roadnetwork.RoadSegment

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.