Search in sources :

Example 56 with Way

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

the class NotContainedFilterTest method stdElement.

private Element stdElement() {
    Element el1 = new Way(1);
    el1.addTag("ref", "x;y;z");
    return el1;
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way)

Example 57 with Way

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

the class ValueBuilderTest method testMultiSubst.

@Test
public void testMultiSubst() {
    ValueBuilder vb = new ValueBuilder("${name|subst:abc=>xyz|subst:def=>www|def:unset}");
    Element el = new Way(1);
    // No tags set, so default value will be applied.
    String s = vb.build(el, null);
    assertEquals("name not set, so default is applied", "unset", s);
    // Name tag is set, so substitutions are made
    el.addTag("name", "abc def");
    s = vb.build(el, null);
    assertEquals("substitutions in name", "xyz www", s);
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Example 58 with Way

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

the class ValueBuilderTest method testEmptyArg.

@Test
public void testEmptyArg() {
    ValueBuilder vb = new ValueBuilder("${name|def:}");
    Element el = new Way(1);
    String s = vb.build(el, null);
    assertEquals("", s);
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Example 59 with Way

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

the class ValueBuilderTest method testDQuotedArg.

@Test
public void testDQuotedArg() {
    ValueBuilder vb = new ValueBuilder("${name|subst:\"abc=>x y z \"}!");
    Element el = new Way(1);
    el.addTag("name", "Tabc");
    String s = vb.build(el, null);
    assertEquals("Tx y z !", s);
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Example 60 with Way

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

the class ValueBuilderTest method testEmptyQuotedArg.

@Test
public void testEmptyQuotedArg() {
    ValueBuilder vb = new ValueBuilder("${name|def:''}");
    Element el = new Way(1);
    String s = vb.build(el, null);
    assertEquals("", s);
}
Also used : 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