tr bike exceptions

This commit is contained in:
Arndt 2016-12-10 19:49:24 +01:00
parent e629a2b2b2
commit f15c5b923e
8 changed files with 55 additions and 5 deletions

View file

@ -224,9 +224,23 @@ public class OsmCutter extends MapCreatorBase
{
return;
}
short exceptions = 0;
String except = r.getTag( "except" );
if ( except != null )
{
exceptions |= toBit( "bicycle" , 0, except );
exceptions |= toBit( "motorcar" , 1, except );
exceptions |= toBit( "agricultural" , 2, except );
exceptions |= toBit( "forestry" , 2, except );
exceptions |= toBit( "psv" , 3, except );
exceptions |= toBit( "hgv" , 4, except );
}
// System.out.println( "restriction id = " + r.rid + " isPositive=" + isPositive + " fromWid = " + fromWid + " toWid = " + toWid+ " viaNid = " + viaNid );
RestrictionData res = new RestrictionData();
res.isPositive = isPositive;
res.exceptions = exceptions;
res.fromWid = fromWid;
res.toWid = toWid;
res.viaNid = viaNid;
@ -234,6 +248,11 @@ public class OsmCutter extends MapCreatorBase
}
private static short toBit( String tag, int bitpos, String s )
{
return (short) ( s.indexOf( tag ) < 0 ? 0 : 1 << bitpos );
}
private int getTileIndex( int ilon, int ilat )
{
int lon = ilon / 45000000;

View file

@ -175,6 +175,7 @@ public class OsmNodeP extends OsmLinkP
while( r != null )
{
mc.writeBoolean( true ); // restriction follows
mc.writeShort( r.exceptions );
mc.writeBoolean( r.isPositive );
mc.writeInt( r.fromLon );
mc.writeInt( r.fromLat );

View file

@ -13,6 +13,7 @@ import btools.util.LongList;
public class RestrictionData extends MapCreatorBase
{
public boolean isPositive;
public short exceptions;
public long fromWid;
public long toWid;
public long viaNid;
@ -31,6 +32,7 @@ public class RestrictionData extends MapCreatorBase
public RestrictionData( DataInputStream di ) throws Exception
{
isPositive = di.readBoolean();
exceptions = di.readShort();
fromWid = readId( di );
toWid = readId( di );
viaNid = readId( di );
@ -39,6 +41,7 @@ public class RestrictionData extends MapCreatorBase
public void writeTo( DataOutputStream dos ) throws Exception
{
dos.writeBoolean( isPositive );
dos.writeShort( exceptions );
writeId( dos, fromWid );
writeId( dos, toWid );
writeId( dos, viaNid );