Package org.movsim.roadmappings

Examples of org.movsim.roadmappings.RoadMapping


     */
    private void defaultTestingRoadMapping(Road roadInput) {
        LOG.warn("Simulation with test network");
        final int laneCount = 1;
        final double roadLength = 1500;
        final RoadMapping roadMapping = new RoadMappingPolyS(laneCount, 10, 50, 50, 100.0 / Math.PI, roadLength);
        final RoadSegment roadSegment = new RoadSegment(roadMapping);
        addInputToRoadSegment(roadSegment, roadInput);
        roadSegment.setUserId("1");
        roadSegment.addDefaultSink();
        roadNetwork.add(roadSegment);
View Full Code Here


     */
    @Test
    public final void testRoadSegmentRoadMapping() {
        final int laneCount = 1;
        final double roadLength = 1000.0;
        final RoadMapping m = new RoadMappingConcrete(laneCount, roadLength);
        final RoadSegment r = new RoadSegment(m);
        assertEquals(roadLength, r.roadLength(), delta);
        assertEquals(laneCount, r.laneCount());
        assertEquals(null, r.trafficSource());
        assertEquals(null, r.sink());
View Full Code Here

     */
    @Test
    public final void testAddLanePair() {
        final int laneCount = 1;
        final double roadLength = 1000.0;
        final RoadMapping m = new RoadMappingConcrete(laneCount, roadLength);
        final RoadSegment r1 = new RoadSegment(m);
        final RoadSegment r2 = new RoadSegment(m);

        Link.addLanePair(Lanes.LANE1, r1, Lanes.LANE1, r2);

View Full Code Here

     */
    @Test
    public final void testAddOffsetJoin() {
        final int laneCount = 2;
        final int offset = 1;
        final RoadMapping m1 = new RoadMappingConcrete(laneCount, 1000.0);
        final RoadSegment r1 = new RoadSegment(m1);
        final RoadMapping m2 = new RoadMappingConcrete(laneCount + offset, 1000.0);
        final RoadSegment r2 = new RoadSegment(m2);
        r2.setLaneType(Lanes.LANE3, Lanes.Type.ENTRANCE);
        final RoadMapping m3 = new RoadMappingConcrete(laneCount, 1000.0);
        final RoadSegment r3 = new RoadSegment(m3);
        Link.addJoin(r1, r2);

        assertEquals(r2, r1.sinkRoadSegment(Lanes.LANE1));
        assertEquals(r2, r1.sinkRoadSegment(Lanes.LANE2));
View Full Code Here

    }

    @Test
    public void testRoadMappingBaseInt() {
        final int LANE_COUNT = 3;
        final RoadMapping roadMapping = new RoadMappingConcrete(LANE_COUNT);
        assertEquals(LANE_COUNT, roadMapping.laneCount());
    }
View Full Code Here

    @Test
    public void testRoadMappingBaseIntDouble() {
        final int LANE_COUNT = 3;
        final double roadLength = 56.4;
        final RoadMapping roadMapping = new RoadMappingConcrete(LANE_COUNT, roadLength);
        assertEquals(LANE_COUNT, roadMapping.laneCount());
        assertEquals(roadLength, roadMapping.roadLength(), delta);
    }
View Full Code Here

     */
    @Test
    public void testRoadLength() {
        final int LANE_COUNT = 3;
        final double roadLength = 56.4;
        final RoadMapping roadMapping = new RoadMappingConcrete(LANE_COUNT, roadLength);
        assertEquals(roadLength, roadMapping.roadLength(), delta);
    }
View Full Code Here

    }

    @Test
    public void testRoadWidth() {
        final int LANE_COUNT = 3;
        RoadMapping roadMapping = new RoadMappingConcrete(LANE_COUNT);
        assertEquals(roadMapping.laneWidth() * LANE_COUNT, roadMapping.roadWidth(), delta);
        roadMapping = new RoadMappingConcrete(LANE_COUNT + 1);
        assertEquals(roadMapping.laneWidth() * roadMapping.laneCount(), roadMapping.roadWidth(), delta);
    }
View Full Code Here

     * Test method for {@link org.movsim.roadmappings.RoadMapping#laneCount()}
     */
    @Test
    public void testLaneCount() {
        final int LANE_COUNT = 3;
        RoadMapping roadMapping = new RoadMappingConcrete(LANE_COUNT);
        assertEquals(LANE_COUNT, roadMapping.laneCount());
        final double roadLength = 56.4;
        roadMapping = new RoadMappingConcrete(LANE_COUNT, roadLength);
        assertEquals(LANE_COUNT, roadMapping.laneCount());
    }
View Full Code Here

    /**
     * Test method for {@link org.movsim.roadmappings.RoadMapping#laneOffset(int)}
     */
    @Test
    public void testLaneOffset() {
        RoadMapping roadMapping = new RoadMappingConcrete(0);
        final double laneWidth = roadMapping.laneWidth();

        roadMapping = new RoadMappingConcrete(1);
        assertEquals(0.0, roadMapping.laneOffset(Lanes.NONE), delta);
        assertEquals(0.0, roadMapping.laneOffset(Lanes.LANE1), delta);

        roadMapping = new RoadMappingConcrete(3);
        assertEquals(0.0, roadMapping.laneOffset(Lanes.NONE), delta);
        assertEquals(-laneWidth, roadMapping.laneOffset(Lanes.LANE1), delta);
        assertEquals(0.0, roadMapping.laneOffset(Lanes.LANE2), delta);
        assertEquals(+laneWidth, roadMapping.laneOffset(Lanes.LANE3), delta);

        roadMapping = new RoadMappingConcrete(5);
        assertEquals(0.0, roadMapping.laneOffset(Lanes.NONE), delta);
        assertEquals(-2 * laneWidth, roadMapping.laneOffset(Lanes.LANE1), delta);
        assertEquals(-laneWidth, roadMapping.laneOffset(Lanes.LANE2), delta);
        assertEquals(0.0, roadMapping.laneOffset(Lanes.LANE3), delta);
        assertEquals(laneWidth, roadMapping.laneOffset(Lanes.LANE4), delta);
        assertEquals(2 * laneWidth, roadMapping.laneOffset(Lanes.LANE5), delta);

        roadMapping = new RoadMappingConcrete(2);
        assertEquals(0.0, roadMapping.laneOffset(Lanes.NONE), delta);
        assertEquals(-0.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE1), delta);
        assertEquals(0.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE2), delta);

        roadMapping = new RoadMappingConcrete(4);
        assertEquals(0.0, roadMapping.laneOffset(Lanes.NONE), delta);
        assertEquals(-1.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE1), delta);
        assertEquals(-0.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE2), delta);
        assertEquals(0.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE3), delta);
        assertEquals(1.5 * laneWidth, roadMapping.laneOffset(Lanes.LANE4), delta);
    }
View Full Code Here

TOP

Related Classes of org.movsim.roadmappings.RoadMapping

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.