use of uk.me.parabola.mkgmap.reader.osm.TypeResult in project mkgmap by openstreetmap.
the class RuleSetTest method getFirstType.
private GType getFirstType(Rule rs, Element el) {
final List<GType> types = new ArrayList<GType>();
rs.resolveType(el, new TypeResult() {
public void add(Element el, GType type) {
types.add(type);
}
});
if (types.isEmpty())
return null;
else
return types.get(0);
}
use of uk.me.parabola.mkgmap.reader.osm.TypeResult in project mkgmap by openstreetmap.
the class RuleFileReaderTest method testContinue.
/**
* Test the continue keyword. If a type is marked with this word, then
* further matches are performed and this might result in more types
* being added.
*/
@Test
public void testContinue() {
RuleSet rs = makeRuleSet("highway=primary [0x1 continue]" + "highway=primary [0x2 continue]" + "highway=primary [0x3]" + "highway=primary [0x4]");
Way el = new Way(1);
el.addTag("highway", "primary");
final List<GType> list = new ArrayList<>();
rs.resolveType(el, new TypeResult() {
public void add(Element el, GType type) {
list.add(type);
}
});
GType type = list.get(0);
assertEquals("first type", 1, type.getType());
assertEquals("continue search", true, type.isContinueSearch());
assertEquals("number of result types", 3, list.size());
assertEquals("type of first", 1, list.get(0).getType());
assertEquals("type of second", 2, list.get(1).getType());
assertEquals("type of third", 3, list.get(2).getType());
}
use of uk.me.parabola.mkgmap.reader.osm.TypeResult in project mkgmap by openstreetmap.
the class RuleFileReaderTest method getFirstType.
/**
* Resolve the rule set with the given element and get the first
* resolved type.
*/
private GType getFirstType(Rule rs, Element el) {
final List<GType> types = new ArrayList<>();
rs.resolveType(el, new TypeResult() {
public void add(Element el, GType type) {
types.add(type);
}
});
if (types.isEmpty())
return null;
else
return types.get(0);
}
use of uk.me.parabola.mkgmap.reader.osm.TypeResult in project mkgmap by openstreetmap.
the class RuleSetTest method resolveList.
private List<GType> resolveList(RuleSet rs, Way el) {
final List<GType> list = new ArrayList<GType>();
rs.resolveType(el, new TypeResult() {
public void add(Element el, GType type) {
list.add(type);
}
});
return list;
}
Aggregations