Skip to content
Commits on Source (4)
mkgmap (0.0.0+svn4257-2) UNRELEASED; urgency=medium
mkgmap (0.0.0+svn4260-1) unstable; urgency=medium
* New upstream SVN snapshot.
* Bump Standards-Version to 4.3.0, no changes.
-- Bas Couwenberg <sebastic@debian.org> Tue, 25 Dec 2018 22:39:23 +0100
-- Bas Couwenberg <sebastic@debian.org> Tue, 01 Jan 2019 10:50:43 +0100
mkgmap (0.0.0+svn4257-1) unstable; urgency=medium
......
......@@ -487,6 +487,13 @@ per relation member. A round-trip route relation may include the same
ways multiple times, unless all member ways have been defined as parallel
one way streets.
=== apply_first ===
The apply_first action is like +apply+, but it will apply the action only to the
first relation member as appearing in the input file. In combination with the
--add-pois-to-lines option this might be used with route relations to mark the
beginning of a route, presuming that the relation is complete and ordered so
that the first member is the start of the route.
=== echo ===
The echo action prints the element id plus a text to standard error. This can be
used for quality checks and debugging purposes.
......
svn.version: 4257
build.timestamp: 2018-11-26T14:51:21+0000
svn.version: 4260
build.timestamp: 2018-12-28T10:15:41+0000
......@@ -29,6 +29,7 @@ import java.util.TreeMap;
import uk.me.parabola.imgfmt.MapFailedException;
import uk.me.parabola.imgfmt.Utils;
import uk.me.parabola.imgfmt.app.BitWriter;
import uk.me.parabola.imgfmt.app.Coord;
import uk.me.parabola.imgfmt.app.ImgFileWriter;
import uk.me.parabola.imgfmt.app.Label;
import uk.me.parabola.imgfmt.app.lbl.City;
......@@ -61,6 +62,7 @@ import uk.me.parabola.mkgmap.general.ZipCodeInfo;
public class RoadDef {
private static final Logger log = Logger.getLogger(RoadDef.class);
public static final int MAX_NUMBER_NODES = 0x3ff;
public static final int NET_FLAG_NODINFO = 0x40;
public static final int NET_FLAG_ADDRINFO = 0x10;
......@@ -140,7 +142,7 @@ public class RoadDef {
// the first point in the road is a node (the above routing node)
private boolean startsWithNode = true;
// number of nodes in the road
private int nnodes;
private int nnodes = -1;
// always appears to be set
private int nod2Flags = NOD2_FLAG_UNK;
......@@ -524,6 +526,9 @@ public class RoadDef {
}
public void setNumNodes(int n) {
if (n-2 > MAX_NUMBER_NODES) {
throw new MapFailedException("Too many special nodes: " + n + " is > " + MAX_NUMBER_NODES + " " + this);
}
nnodes = n;
}
......
......@@ -18,6 +18,7 @@ package uk.me.parabola.mkgmap.general;
import java.util.List;
import uk.me.parabola.imgfmt.app.Coord;
import uk.me.parabola.imgfmt.app.lbl.City;
import uk.me.parabola.imgfmt.app.lbl.Zip;
import uk.me.parabola.imgfmt.app.net.Numbers;
......@@ -209,4 +210,15 @@ public class MapRoad extends MapLine {
roadDef.resetImgData();
}
public int countNodes() {
int n = 0;
for (Coord p : getPoints()) {
if (p.isNumberNode())
n++;
}
return n;
}
}
......@@ -71,9 +71,11 @@ public class ActionReader {
} else if ("addaccess".equals(cmd)) {
actions.add(readAccessValue(false, changeableTags));
} else if ("apply".equals(cmd)) {
actions.add(readAllCmd(false));
actions.add(readAllCmd(null));
} else if ("apply_once".equals(cmd)) {
actions.add(readAllCmd(true));
actions.add(readAllCmd("once"));
} else if ("apply_first".equals(cmd)) {
actions.add(readAllCmd("first"));
} else if ("name".equals(cmd)) {
actions.add(readValueBuilder(new NameAction()));
changeableTags.add("mkgmap:label:1");
......@@ -115,7 +117,7 @@ public class ActionReader {
return new ActionList(actions, changeableTags);
}
private Action readAllCmd(boolean once) {
private Action readAllCmd(String selector) {
String role = null;
if (scanner.checkToken("role")) {
scanner.nextToken();
......@@ -124,7 +126,7 @@ public class ActionReader {
throw new SyntaxException(scanner, "Expecting '=' after role keyword");
role = scanner.nextWord();
}
SubAction subAction = new SubAction(role, once);
SubAction subAction = new SubAction(role, selector);
List<Action> actionList = readActions().getList();
for (Action a : actionList)
......
......@@ -36,11 +36,11 @@ import uk.me.parabola.mkgmap.reader.osm.Relation;
public class SubAction implements Action {
private final List<Action> actionList = new ArrayList<Action>();
private final String role;
private final boolean once;
private final String selector;
public SubAction(String role, boolean once) {
public SubAction(String role, String selector) {
this.role = role;
this.once = once;
this.selector = selector;
}
public boolean perform(Element el) {
......@@ -58,6 +58,8 @@ public class SubAction implements Action {
else if (a instanceof AddAccessAction)
((AddAccessAction) a).setValueTags(rel);
boolean once = "once".equals(selector);
boolean first_only = "first".equals(selector);
HashSet<Element> elems = once ? new HashSet<Element>() : null;
for (Map.Entry<String,Element> r_el : elements) {
......@@ -67,6 +69,8 @@ public class SubAction implements Action {
for (Action a : actionList)
a.perform(r_el.getValue());
}
if (first_only)
break;
}
}
......@@ -76,7 +80,10 @@ public class SubAction implements Action {
public String toString() {
Formatter fmt = new Formatter();
fmt.format(once ? "apply_once" : "apply");
fmt.format("apply");
if (selector != null) {
fmt.format("_%s",selector);
}
if (role != null)
fmt.format(" role=%s ", role);
......
......@@ -26,12 +26,13 @@ import java.util.Set;
import java.util.TreeMap;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import uk.me.parabola.imgfmt.MapFailedException;
import uk.me.parabola.imgfmt.Utils;
import uk.me.parabola.imgfmt.app.Coord;
import uk.me.parabola.imgfmt.app.net.NumberStyle;
import uk.me.parabola.imgfmt.app.net.Numbers;
import uk.me.parabola.imgfmt.app.net.RoadDef;
import uk.me.parabola.log.Logger;
import uk.me.parabola.mkgmap.filters.LineSplitterFilter;
import uk.me.parabola.mkgmap.general.CityInfo;
import uk.me.parabola.mkgmap.general.MapRoad;
import uk.me.parabola.mkgmap.general.ZipCodeInfo;
......@@ -507,6 +508,11 @@ public class ExtNumbers {
private ExtNumbers splitInterval(){
if (log.isDebugEnabled())
log.debug("trying to split",this,"so that",badNum,"is not contained");
if (getRoad().countNodes() + 1 > 0x3ff) {
log.warn("cannot increase number of number nodes", getRoad());
return this;
}
boolean doSplit = false;
Numbers origNumbers = getNumbers();
if (origNumbers.countMatches(badNum) == 0){
......@@ -678,14 +684,15 @@ public class ExtNumbers {
* @return
*/
private ExtNumbers tryAddNumberNode(int reason) {
int numNumNodes = getRoad().countNodes();
if (numNumNodes + 1 > RoadDef.MAX_NUMBER_NODES){
log.warn("can't change intervals, road has already", numNumNodes, "number nodes");
return this; // can't add a node
}
String action;
if (endInRoad - startInRoad > 1)
action = "change";
else {
if (getRoad().getPoints().size() + 1 > LineSplitterFilter.MAX_POINTS_IN_LINE){
log.warn("can't change intervals, road has already",LineSplitterFilter.MAX_POINTS_IN_LINE,"points");
return this; // can't add a node
}
Coord c1 = getRoad().getPoints().get(startInRoad);
Coord c2 = getRoad().getPoints().get(startInRoad+1);
if (c1.equals(c2)){
......@@ -1085,6 +1092,9 @@ public class ExtNumbers {
* @return new start of next interval
*/
private int addAsNumberNode(int pos, Coord toAdd){
if (getRoad().countNodes() + 1 > RoadDef.MAX_NUMBER_NODES) {
throw new MapFailedException("too many number nodes in " + getRoad());
}
toAdd.setNumberNode(true);
toAdd.setAddedNumberNode(true);
getRoad().getPoints().add(pos, toAdd);
......@@ -1132,6 +1142,7 @@ public class ExtNumbers {
continue;
if (multipleZipOrCity(left))
multipleZipOrCity = true;
if (houses.size() < 50) {
for (HousenumberMatch house: houses){
int hn = house.getHousenumber();
if (countOccurence(houses, hn) > 1)
......@@ -1145,6 +1156,7 @@ public class ExtNumbers {
}
}
}
}
if (multipleZipOrCity)
return; // unlikely
// log.debug("did not yet find good split position");
......