Search in sources :

Example 96 with Way

use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.

the class RuleFileReaderTest method testNot.

/**
 * Test the not operator.
 */
@Test
public void testNot() {
    RuleSet rs = makeRuleSet("tunnel=yes & !(route=mtb | route=bicycle) [0x1]");
    // RuleSet rs = makeRuleSet("tunnel=yes & (route!=mtb & route!=bicycle) [0x1]");
    Way el = new Way(1);
    el.addTag("tunnel", "yes");
    el.addTag("route", "abc");
    getFirstType(rs, el);
}
Also used : TestUtils.makeRuleSet(func.lib.TestUtils.makeRuleSet) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Example 97 with Way

use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.

the class RuleFileReaderTest method testGetTagValueNotFound.

@Test
public void testGetTagValueNotFound() {
    RuleSet rs = makeRuleSet("a=b & b<$c [0x5] a=b [0x6]");
    Way w = new Way(1);
    w.addTag("a", "b");
    w.addTag("b", "50");
    GType type = getFirstType(rs, w);
    assertNotNull(type);
    assertEquals(6, type.getType());
}
Also used : TestUtils.makeRuleSet(func.lib.TestUtils.makeRuleSet) GType(uk.me.parabola.mkgmap.reader.osm.GType) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Example 98 with Way

use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.

the class RuleFileReaderTest method testNEAtTop.

@Test(expected = SyntaxException.class)
public void testNEAtTop() {
    RuleSet rs = makeRuleSet("QUOTA != 'fred' [0x2]");
    Element el = new Way(1);
    el.addTag("QUOTA", "tom");
    GType type = getFirstType(rs, el);
    assertNotNull(type);
    assertEquals(2, type.getType());
}
Also used : TestUtils.makeRuleSet(func.lib.TestUtils.makeRuleSet) GType(uk.me.parabola.mkgmap.reader.osm.GType) Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Example 99 with Way

use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.

the class RuleFileReaderTest method testLengthFunction.

@Test
public void testLengthFunction() {
    // Its less than 92m
    RuleSet rs = makeRuleSet("A=B & length() < 92 [0x5]");
    Way el = getWayWithLength();
    el.addTag("A", "B");
    GType type = getFirstType(rs, el);
    assertNotNull(type);
    assertEquals(5, type.getType());
}
Also used : TestUtils.makeRuleSet(func.lib.TestUtils.makeRuleSet) GType(uk.me.parabola.mkgmap.reader.osm.GType) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Example 100 with Way

use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.

the class RuleFileReaderTest method testMultipleActions.

@Test
public void testMultipleActions() {
    String rstr = "highway=footway {add access = no; add foot = yes} [0x16 road_class=0 road_speed=0 resolution 23]";
    RuleSet rs = makeRuleSet(rstr);
    Element el = new Way(1);
    el.addTag("highway", "footway");
    getFirstType(rs, el);
    assertEquals("access set", "no", el.getTag("access"));
    assertEquals("access set", "yes", el.getTag("foot"));
}
Also used : TestUtils.makeRuleSet(func.lib.TestUtils.makeRuleSet) Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Aggregations

Way (uk.me.parabola.mkgmap.reader.osm.Way)142 Test (org.junit.Test)94 TestUtils.makeRuleSet (func.lib.TestUtils.makeRuleSet)70 GType (uk.me.parabola.mkgmap.reader.osm.GType)60 Element (uk.me.parabola.mkgmap.reader.osm.Element)48 Coord (uk.me.parabola.imgfmt.app.Coord)31 ArrayList (java.util.ArrayList)18 MapPoint (uk.me.parabola.mkgmap.general.MapPoint)12 MapExitPoint (uk.me.parabola.mkgmap.general.MapExitPoint)11 List (java.util.List)8 Node (uk.me.parabola.mkgmap.reader.osm.Node)8 HashMap (java.util.HashMap)7 IdentityHashMap (java.util.IdentityHashMap)6 Map (java.util.Map)6 StringStyleFileLoader (func.lib.StringStyleFileLoader)5 CoordNode (uk.me.parabola.imgfmt.app.CoordNode)5 Relation (uk.me.parabola.mkgmap.reader.osm.Relation)5 CoordPOI (uk.me.parabola.mkgmap.reader.osm.CoordPOI)4 RestrictionRelation (uk.me.parabola.mkgmap.reader.osm.RestrictionRelation)4 Long2ObjectOpenHashMap (it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap)3