added turn restrictions

This commit is contained in:
Arndt 2016-11-20 22:31:10 +01:00
parent 561b60c5cb
commit e48cbd49cb
18 changed files with 383 additions and 32 deletions

View file

@ -32,6 +32,8 @@ public class OsmNode extends OsmLink implements OsmPos
* The node-tags, if any
*/
public byte[] nodeDescription;
public TurnRestriction firstRestriction;
/**
* The links to other nodes
@ -129,6 +131,22 @@ public class OsmNode extends OsmLink implements OsmPos
public final void parseNodeBody2( MicroCache2 mc, OsmNodesMap hollowNodes, IByteArrayUnifier expCtxWay )
{
ByteArrayUnifier abUnifier = hollowNodes.getByteArrayUnifier();
// read turn restrictions
while( mc.readBoolean() )
{
TurnRestriction tr = new TurnRestriction();
tr.isPositive = mc.readBoolean();
tr.fromLon = mc.readInt();
tr.fromLat = mc.readInt();
tr.toLon = mc.readInt();
tr.toLat = mc.readInt();
tr.next = firstRestriction;
firstRestriction = tr;
System.out.println( "decoded tr: " + tr );
}
selev = mc.readShort();
int nodeDescSize = mc.readVarLengthUnsigned();

View file

@ -0,0 +1,26 @@
/**
* Container for a turn restriction
*
* @author ab
*/
package btools.mapaccess;
public final class TurnRestriction
{
public boolean isPositive;
public int fromLon;
public int fromLat;
public int toLon;
public int toLat;
public TurnRestriction next;
@Override
public String toString()
{
return "pos=" + isPositive + " fromLon=" + fromLon + " fromLat=" + fromLat + " toLon=" + toLon + " toLat=" + toLat;
}
}