예제 #1
0
        public void OSMRouteConstructorSetsSpeedPropertyFromMaxSpeedTag()
        {
            OSMWay source = new OSMWay(11);
            source.Tags.Add(new OSMTag("maxspeed", "50"));

            RoadType sourceType = new RoadType();

            OSMRoad target = new OSMRoad(source, sourceType);

            Assert.Equal(50, target.Speed);
        }
예제 #2
0
        public void OSMRouteConstructorCopiesDataFromWay()
        {
            OSMWay source = new OSMWay(11);
            source.Nodes.Add(1);
            source.Nodes.Add(2);
            source.Tags.Add(new OSMTag("highway", "track"));

            RoadType sourceType = new RoadType();
            sourceType.RequiredTags.Add(new OSMTag("highway", "track"));

            OSMRoad target = new OSMRoad(source, sourceType);

            Assert.Equal(source.Nodes.Count, target.Nodes.Count);
            Assert.Equal(source.Tags.First(), target.Tags.First());
            Assert.Equal(sourceType, target.RoadType);
        }
예제 #3
0
        public void OSMRouteConstructorSetsSpeedPropertyFromRoadTypeSpeed()
        {
            OSMWay source = new OSMWay(11);

            RoadType sourceType = new RoadType();
            sourceType.Speed = 60;

            OSMRoad target = new OSMRoad(source, sourceType);

            Assert.Equal(60, target.Speed);
        }
예제 #4
0
        public void OSMRouteConstructorSetsId()
        {
            OSMRoad target = new OSMRoad(11);

            Assert.Equal(11, target.ID);
        }
예제 #5
0
        public void RoadTypeIsAccessibleReverseAppliesOnewayTagOverridesDefaultValueForRoadType2()
        {
            RoadType roadType = new RoadType();
            roadType.Oneway = false;

            OSMWay way = new OSMWay(0);
            way.Tags.Add(new OSMTag("oneway", "yes"));

            OSMRoad target = new OSMRoad(way, roadType);

            Assert.Equal(true, target.IsAccessible());
            Assert.Equal(false, target.IsAccessibleReverse());
        }
예제 #6
0
        public void RoadTypeIsAccessibleReverseAppliesDefaultOnewayValueFromRoadType()
        {
            RoadType roadType = new RoadType();
            roadType.Oneway = true;

            OSMWay oneWay = new OSMWay(0);
            OSMRoad target = new OSMRoad(oneWay, roadType);

            Assert.Equal(true, target.IsAccessible());
            Assert.Equal(false, target.IsAccessibleReverse());
        }
예제 #7
0
        public void RoadTypeIsAccessibleAndIsAccessibleReturnsCorrectValuesForReverseOnewayRoads()
        {
            RoadType roadType = new RoadType();
            roadType.RequiredTags.Add(new OSMTag("highway", "*"));

            OSMWay oneWay1 = new OSMWay(0);
            oneWay1.Tags.Add(new OSMTag("oneway", "-1"));
            OSMRoad target1 = new OSMRoad(oneWay1, roadType);

            OSMWay oneWay2 = new OSMWay(0);
            oneWay2.Tags.Add(new OSMTag("oneway", "reverse"));
            OSMRoad target2 = new OSMRoad(oneWay2, roadType);

            Assert.False(target1.IsAccessible());
            Assert.True(target1.IsAccessibleReverse());

            Assert.False(target2.IsAccessible());
            Assert.True(target2.IsAccessibleReverse());
        }
예제 #8
0
        public void OSMRouteConstructorSetsSpeedPropertyMaxspeedTagTakesPrecedenceOverRoadTypeSpeed()
        {
            OSMWay source = new OSMWay(11);
            source.Tags.Add(new OSMTag("maxspeed", "50"));

            RoadType sourceType = new RoadType();
            sourceType.Speed = 60;

            OSMRoad target = new OSMRoad(source, sourceType);

            Assert.Equal(50, target.Speed);
        }
예제 #9
0
        public void OSMRouteConstructorSetsSpeedPropertyIgnoresInvalidMaxspeedTags()
        {
            OSMWay source = new OSMWay(11);
            source.Tags.Add(new OSMTag("maxspeed", "some value"));

            RoadType sourceType = new RoadType();
            sourceType.Speed = 60;

            OSMRoad target = new OSMRoad(source, sourceType);

            Assert.Equal(60, target.Speed);
        }