use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method getWayWithLength.
/**
* Get a way with a few points for testing length.
*
* The length of this segment was independently confirmed to be around 91m.
*/
private Way getWayWithLength() {
Way el = new Way(1);
el.addPoint(new Coord(51.6124376, -0.1777185));
el.addPoint(new Coord(51.6127816, -0.1775029));
el.addPoint(new Coord(51.6132048, -0.1772467));
return el;
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testNestedIncludes.
/**
* Test an include file within an include file.
*/
@Test
public void testNestedIncludes() {
StyleFileLoader loader = new StringStyleFileLoader(new String[][] { { "lines", "a=1 [0x1] include 'first'; a=2 [0x2]" }, { "first", "b=1 [0x1] include 'second'; b=2 [0x2 ]" }, { "second", "c=1 [0x1] c=2 [0x2 ]" } });
RuleSet rs = makeRuleSet(loader);
Element el = new Way(1);
el.addTag("a", "2");
GType type = getFirstType(rs, el);
assertNotNull(type);
assertEquals(2, type.getType());
el = new Way(2);
el.addTag("c", "1");
type = getFirstType(rs, el);
assertNotNull(type);
assertEquals(1, type.getType());
el = new Way(2);
el.addTag("c", "2");
type = getFirstType(rs, el);
assertNotNull(type);
assertEquals(2, type.getType());
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testLevel.
/**
* Test for non-standard level specification. You can give a range
* of levels, rather than defaulting the max end to 0.
*/
@Test
public void testLevel() {
RuleSet rs = makeRuleSet("highway=primary [0x1 level 1-3]");
Element el = new Way(1);
el.addTag("highway", "primary");
GType type = getFirstType(rs, el);
assertNotNull(type);
assertEquals("min level", 1, type.getMinLevel());
assertEquals("max level", 3, type.getMaxLevel());
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testLeftSideOr.
/**
* Deal with cases such as
* (a = b | a = c) & d!=*
* where there is no key at the top level. This gets converted
* to: (a=b & d!=*) | (a=c & d!= *) which can then be used.
*
* This is applied recursively, so you can have chains of any length.
*/
@Test
public void testLeftSideOr() {
RuleSet rs = makeRuleSet("(a = b | a = c | a=d) & e!=* [0x2]" + "a=c & e!=* [0x1]");
assertNotNull("a=b chain", rs);
assertNotNull("a=c chain", rs);
assertNotNull("a=d chain", rs);
// get the a=c chain and look at it more closely
Element el = new Way(1);
el.addTag("a", "c");
GType type = getFirstType(rs, el);
assertNotNull("match e not existing", type);
assertEquals("correct type", 2, type.getType());
el = new Way(2);
el.addTag("a", "d");
assertNotNull("match e not existing", type);
assertEquals("correct type", 2, type.getType());
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testNumberOpAtTop.
@Test
public void testNumberOpAtTop() {
RuleSet rs = makeRuleSet("QUOTA > 10 [0x1] QUOTA < 6 [0x2]");
Element el = new Way(1);
el.addTag("QUOTA", "2");
GType type = getFirstType(rs, el);
assertNotNull(type);
assertEquals(2, type.getType());
}
Aggregations