1.0 preparations
This commit is contained in:
parent
55717c6e71
commit
8fa82633d4
34 changed files with 742 additions and 462 deletions
|
|
@ -15,9 +15,11 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import btools.util.DiffCoderDataOutputStream;
|
||||
|
||||
public abstract class MapCreatorBase implements WayListener, NodeListener, RelationListener
|
||||
{
|
||||
private DataOutputStream[] tileOutStreams;
|
||||
private DiffCoderDataOutputStream[] tileOutStreams;
|
||||
protected File outTileDir;
|
||||
|
||||
protected HashMap<String,String> tags;
|
||||
|
|
@ -102,16 +104,16 @@ public abstract class MapCreatorBase implements WayListener, NodeListener, Relat
|
|||
return new DataInputStream( new BufferedInputStream ( new FileInputStream( inFile ) ) );
|
||||
}
|
||||
|
||||
protected DataOutputStream createOutStream( File outFile ) throws IOException
|
||||
protected DiffCoderDataOutputStream createOutStream( File outFile ) throws IOException
|
||||
{
|
||||
return new DataOutputStream( new BufferedOutputStream( new FileOutputStream( outFile ) ) );
|
||||
return new DiffCoderDataOutputStream( new BufferedOutputStream( new FileOutputStream( outFile ) ) );
|
||||
}
|
||||
|
||||
protected DataOutputStream getOutStreamForTile( int tileIndex ) throws Exception
|
||||
protected DiffCoderDataOutputStream getOutStreamForTile( int tileIndex ) throws Exception
|
||||
{
|
||||
if ( tileOutStreams == null )
|
||||
{
|
||||
tileOutStreams = new DataOutputStream[64];
|
||||
tileOutStreams = new DiffCoderDataOutputStream[64];
|
||||
}
|
||||
|
||||
if ( tileOutStreams[tileIndex] == null )
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package btools.mapcreator;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import btools.util.DiffCoderDataInputStream;
|
||||
import btools.util.DiffCoderDataOutputStream;
|
||||
|
||||
/**
|
||||
* Container for node data on the preprocessor level
|
||||
|
|
@ -23,21 +23,21 @@ public class NodeData extends MapCreatorBase
|
|||
ilon = (int)( ( lon + 180. )*1000000. + 0.5);
|
||||
}
|
||||
|
||||
public NodeData( DataInputStream dis ) throws Exception
|
||||
public NodeData( DiffCoderDataInputStream dis ) throws Exception
|
||||
{
|
||||
nid = readId( dis );
|
||||
ilon = dis.readInt();
|
||||
ilat = dis.readInt();
|
||||
nid = dis.readDiffed( 0 );
|
||||
ilon = (int)dis.readDiffed( 1 );
|
||||
ilat = (int)dis.readDiffed( 2 );
|
||||
int mode = dis.readByte();
|
||||
if ( ( mode & 1 ) != 0 ) { int dlen = dis.readByte(); description = new byte[dlen]; dis.readFully( description ); }
|
||||
if ( ( mode & 2 ) != 0 ) selev = dis.readShort();
|
||||
}
|
||||
|
||||
public void writeTo( DataOutputStream dos ) throws Exception
|
||||
public void writeTo( DiffCoderDataOutputStream dos ) throws Exception
|
||||
{
|
||||
writeId( dos, nid );
|
||||
dos.writeInt( ilon );
|
||||
dos.writeInt( ilat );
|
||||
dos.writeDiffed( nid, 0 );
|
||||
dos.writeDiffed( ilon, 1 );
|
||||
dos.writeDiffed( ilat, 2 );
|
||||
int mode = ( description == null ? 0 : 1 ) | ( selev == Short.MIN_VALUE ? 0 : 2 );
|
||||
dos.writeByte( (byte)mode );
|
||||
if ( ( mode & 1 ) != 0 ) { dos.writeByte( description.length ); dos.write( description ); }
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package btools.mapcreator;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
import btools.util.DenseLongMap;
|
||||
import btools.util.DiffCoderDataOutputStream;
|
||||
import btools.util.TinyDenseLongMap;
|
||||
|
||||
/**
|
||||
|
|
@ -17,7 +17,7 @@ import btools.util.TinyDenseLongMap;
|
|||
*/
|
||||
public class NodeFilter extends MapCreatorBase
|
||||
{
|
||||
private DataOutputStream nodesOutStream;
|
||||
private DiffCoderDataOutputStream nodesOutStream;
|
||||
private File nodeTilesOut;
|
||||
protected DenseLongMap nodebitmap;
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ public class NodeFilter extends MapCreatorBase
|
|||
String filename = nodefile.getName();
|
||||
filename = filename.substring( 0, filename.length() - 3 ) + "tlf";
|
||||
File outfile = new File( nodeTilesOut, filename );
|
||||
nodesOutStream = new DataOutputStream( new BufferedOutputStream ( new FileOutputStream( outfile ) ) );
|
||||
nodesOutStream = new DiffCoderDataOutputStream( new BufferedOutputStream ( new FileOutputStream( outfile ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
package btools.mapcreator;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
||||
import btools.util.DiffCoderDataInputStream;
|
||||
|
||||
/**
|
||||
* Iterate over a singe nodefile or a directory
|
||||
* of nodetiles and feed the nodes to the callback listener
|
||||
|
|
@ -48,7 +49,7 @@ public class NodeIterator extends MapCreatorBase
|
|||
|
||||
listener.nodeFileStart( nodefile );
|
||||
|
||||
DataInputStream di = new DataInputStream( new BufferedInputStream ( new FileInputStream( nodefile ) ) );
|
||||
DiffCoderDataInputStream di = new DiffCoderDataInputStream( new BufferedInputStream ( new FileInputStream( nodefile ) ) );
|
||||
try
|
||||
{
|
||||
for(;;)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import java.io.File;
|
|||
import java.io.FileOutputStream;
|
||||
|
||||
import btools.expressions.BExpressionContext;
|
||||
import btools.expressions.BExpressionMetaData;
|
||||
|
||||
public class OsmCutter extends MapCreatorBase
|
||||
{
|
||||
|
|
@ -47,7 +48,7 @@ public class OsmCutter extends MapCreatorBase
|
|||
private BExpressionContext _expctxNode;
|
||||
|
||||
private BExpressionContext _expctxWayStat;
|
||||
private BExpressionContext _expctxNodeStat;
|
||||
// private BExpressionContext _expctxNodeStat;
|
||||
|
||||
public void process (File lookupFile, File outTileDir, File wayFile, File relFile, File mapFile) throws Exception
|
||||
{
|
||||
|
|
@ -56,13 +57,13 @@ public class OsmCutter extends MapCreatorBase
|
|||
throw new IllegalArgumentException( "lookup-file: " + lookupFile + " does not exist" );
|
||||
}
|
||||
|
||||
_expctxWay = new BExpressionContext("way");
|
||||
_expctxWay.readMetaData( lookupFile );
|
||||
// _expctxWayStat = new BExpressionContext("way");
|
||||
BExpressionMetaData meta = new BExpressionMetaData();
|
||||
|
||||
_expctxNode = new BExpressionContext("node");
|
||||
_expctxNode.readMetaData( lookupFile );
|
||||
// _expctxNodeStat = new BExpressionContext("node");
|
||||
_expctxWay = new BExpressionContext("way", meta );
|
||||
_expctxNode = new BExpressionContext("node", meta );
|
||||
meta.readMetaData( lookupFile );
|
||||
// _expctxWayStat = new BExpressionContext("way", null );
|
||||
// _expctxNodeStat = new BExpressionContext("node", null );
|
||||
|
||||
this.outTileDir = outTileDir;
|
||||
if ( !outTileDir.isDirectory() ) throw new RuntimeException( "out tile directory " + outTileDir + " does not exist" );
|
||||
|
|
@ -122,8 +123,7 @@ public class OsmCutter extends MapCreatorBase
|
|||
int tileIndex = getTileIndex( n.ilon, n.ilat );
|
||||
if ( tileIndex >= 0 )
|
||||
{
|
||||
DataOutputStream dos = getOutStreamForTile( tileIndex );
|
||||
n.writeTo( dos );
|
||||
n.writeTo( getOutStreamForTile( tileIndex ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,14 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import sun.security.pkcs.SigningCertificateInfo;
|
||||
|
||||
import btools.util.ByteDataWriter;
|
||||
|
||||
public class OsmNodeP implements Comparable<OsmNodeP>
|
||||
{
|
||||
public static final int EXTERNAL_BITMASK = 0x80;
|
||||
public static final int VARIABLEDESC_BITMASK = 0x40;
|
||||
public static final int SIGNLON_BITMASK = 0x80;
|
||||
public static final int SIGNLAT_BITMASK = 0x40;
|
||||
public static final int TRANSFERNODE_BITMASK = 0x20;
|
||||
public static final int WRITEDESC_BITMASK = 0x10;
|
||||
public static final int SKIPDETAILS_BITMASK = 0x08;
|
||||
|
|
@ -42,10 +46,12 @@ public class OsmNodeP implements Comparable<OsmNodeP>
|
|||
|
||||
public boolean isBorder = false;
|
||||
|
||||
public final static int BRIDGE_AND_BIT = 1;
|
||||
public final static int TUNNEL_AND_BIT = 2;
|
||||
public byte wayAndBits = -1; // use for bridge/tunnel logic
|
||||
|
||||
public final static int NO_BRIDGE_BIT = 1;
|
||||
public final static int NO_TUNNEL_BIT = 2;
|
||||
public final static int LCN_BIT = 4;
|
||||
public final static int CR_BIT = 8;
|
||||
|
||||
public byte wayBits = 0;
|
||||
|
||||
// interface OsmPos
|
||||
public int getILat()
|
||||
|
|
@ -61,7 +67,7 @@ public class OsmNodeP implements Comparable<OsmNodeP>
|
|||
public short getSElev()
|
||||
{
|
||||
// if all bridge or all tunnel, elevation=no-data
|
||||
return (wayAndBits & ( BRIDGE_AND_BIT | TUNNEL_AND_BIT ) ) == 0 ? selev : Short.MIN_VALUE;
|
||||
return ( wayBits & NO_BRIDGE_BIT ) == 0 || ( wayBits & NO_TUNNEL_BIT ) == 0 ? Short.MIN_VALUE : selev;
|
||||
}
|
||||
|
||||
public double getElev()
|
||||
|
|
@ -82,22 +88,23 @@ public class OsmNodeP implements Comparable<OsmNodeP>
|
|||
return null;
|
||||
}
|
||||
|
||||
public void writeNodeData( DataOutputStream os, boolean writeVarLength ) throws IOException
|
||||
public void writeNodeData( ByteDataWriter os, boolean writeVarLength, byte[] abBuf ) throws IOException
|
||||
{
|
||||
int lonIdx = ilon/62500;
|
||||
int latIdx = ilat/62500;
|
||||
|
||||
// buffer the body to first calc size
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream( );
|
||||
DataOutputStream os2 = new DataOutputStream( bos );
|
||||
|
||||
ByteDataWriter os2 = new ByteDataWriter( abBuf );
|
||||
os2.writeShort( getSElev() );
|
||||
|
||||
|
||||
// hack: write node-desc as link tag (copy cycleway-bits)
|
||||
byte[] nodeDescription = getNodeDecsription();
|
||||
|
||||
for( OsmLinkP link0 = firstlink; link0 != null; link0 = link0.next )
|
||||
{
|
||||
int ilonref = ilon;
|
||||
int ilatref = ilat;
|
||||
|
||||
OsmLinkP link = link0;
|
||||
OsmNodeP origin = this;
|
||||
int skipDetailBit = link0.counterLinkWritten() ? SKIPDETAILS_BITMASK : 0;
|
||||
|
|
@ -160,32 +167,24 @@ public class OsmNodeP implements Comparable<OsmNodeP>
|
|||
}
|
||||
|
||||
}
|
||||
int targetLonIdx = target.ilon/62500;
|
||||
int targetLatIdx = target.ilat/62500;
|
||||
|
||||
int bm = tranferbit | writedescbit | nodedescbit | skipDetailBit;
|
||||
if ( writeVarLength ) bm |= VARIABLEDESC_BITMASK;
|
||||
int dlon = target.ilon - ilonref;
|
||||
int dlat = target.ilat - ilatref;
|
||||
ilonref = target.ilon;
|
||||
ilatref = target.ilat;
|
||||
if ( dlon < 0 ) { bm |= SIGNLON_BITMASK; dlon = - dlon; }
|
||||
if ( dlat < 0 ) { bm |= SIGNLAT_BITMASK; dlat = - dlat; }
|
||||
os2.writeByte( bm );
|
||||
|
||||
int blon = os2.writeVarLengthUnsigned( dlon );
|
||||
int blat = os2.writeVarLengthUnsigned( dlat );
|
||||
|
||||
if ( targetLonIdx == lonIdx && targetLatIdx == latIdx )
|
||||
{
|
||||
// reduced position for internal target
|
||||
os2.writeByte( bm );
|
||||
os2.writeShort( (short)(target.ilon - lonIdx*62500 - 31250) );
|
||||
os2.writeShort( (short)(target.ilat - latIdx*62500 - 31250) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// full position for external target
|
||||
os2.writeByte( bm | EXTERNAL_BITMASK );
|
||||
os2.writeInt( target.ilon );
|
||||
os2.writeInt( target.ilat );
|
||||
}
|
||||
if ( writedescbit != 0 )
|
||||
{
|
||||
// write the way description, code direction into the first bit
|
||||
int len = lastDescription.length;
|
||||
if ( writeVarLength ) os2.writeByte( len );
|
||||
os2.write( lastDescription, 0, len );
|
||||
if ( writeVarLength ) os2.writeByte( lastDescription.length );
|
||||
os2.write( lastDescription );
|
||||
}
|
||||
if ( nodedescbit != 0 )
|
||||
{
|
||||
|
|
@ -199,7 +198,7 @@ public class OsmNodeP implements Comparable<OsmNodeP>
|
|||
target.markLinkWritten( origin );
|
||||
break;
|
||||
}
|
||||
os2.writeShort( target.getSElev() );
|
||||
os2.writeVarLengthSigned( target.getSElev() -getSElev() );
|
||||
// next link is the one (of two), does does'nt point back
|
||||
for( link = target.firstlink; link != null; link = link.next )
|
||||
{
|
||||
|
|
@ -211,12 +210,15 @@ public class OsmNodeP implements Comparable<OsmNodeP>
|
|||
}
|
||||
|
||||
// calculate the body size
|
||||
int bodySize = bos.size();
|
||||
int bodySize = os2.size();
|
||||
|
||||
os.ensureCapacity( bodySize + 8 );
|
||||
|
||||
os.writeShort( (short)(ilon - lonIdx*62500 - 31250) );
|
||||
os.writeShort( (short)(ilat - latIdx*62500 - 31250) );
|
||||
os.writeInt( bodySize );
|
||||
bos.writeTo( os );
|
||||
|
||||
os.writeVarLengthUnsigned( bodySize );
|
||||
os.write( abBuf, 0, bodySize );
|
||||
}
|
||||
|
||||
public String toString2()
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ public class OsmNodePT extends OsmNodeP
|
|||
{
|
||||
public byte[] descriptionBits;
|
||||
|
||||
public byte wayOrBits = 0; // used to propagate bike networks to nodes
|
||||
|
||||
public OsmNodePT()
|
||||
{
|
||||
}
|
||||
|
|
@ -25,7 +23,6 @@ public class OsmNodePT extends OsmNodeP
|
|||
public final byte[] getNodeDecsription()
|
||||
{
|
||||
return descriptionBits;
|
||||
// return descriptionBits | (long)( (wayOrBits & 6) >> 1 ); TODO !!!!!!!!!!1
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import java.io.File;
|
|||
import java.util.HashMap;
|
||||
|
||||
import btools.util.CompactLongSet;
|
||||
import btools.util.DiffCoderDataOutputStream;
|
||||
import btools.util.FrozenLongSet;
|
||||
|
||||
/**
|
||||
|
|
@ -21,8 +22,8 @@ import btools.util.FrozenLongSet;
|
|||
*/
|
||||
public class PosUnifier extends MapCreatorBase
|
||||
{
|
||||
private DataOutputStream nodesOutStream;
|
||||
private DataOutputStream borderNodesOut;
|
||||
private DiffCoderDataOutputStream nodesOutStream;
|
||||
private DiffCoderDataOutputStream borderNodesOut;
|
||||
private File nodeTilesOut;
|
||||
private CompactLongSet positionSet;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import java.io.File;
|
|||
import java.util.HashMap;
|
||||
|
||||
import btools.expressions.BExpressionContext;
|
||||
import btools.expressions.BExpressionMetaData;
|
||||
import btools.util.CompactLongSet;
|
||||
import btools.util.FrozenLongSet;
|
||||
|
||||
|
|
@ -29,7 +30,7 @@ public class RelationMerger extends MapCreatorBase
|
|||
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
System.out.println("*** RelationMerger: merge relation bits into ways" );
|
||||
System.out.println("*** RelationMerger: merge relations into ways" );
|
||||
if (args.length != 6)
|
||||
{
|
||||
System.out.println("usage: java RelationMerger <way-file-in> <way-file-out> <relation-file> <lookup-file> <report-profile> <check-profile>" );
|
||||
|
|
@ -42,11 +43,15 @@ public class RelationMerger extends MapCreatorBase
|
|||
public void process( File wayFileIn, File wayFileOut, File relationFileIn, File lookupFile, File reportProfile, File checkProfile ) throws Exception
|
||||
{
|
||||
// read lookup + profile for relation access-check
|
||||
expctxReport = new BExpressionContext("way");
|
||||
expctxReport.readMetaData( lookupFile );
|
||||
BExpressionMetaData metaReport = new BExpressionMetaData();
|
||||
expctxReport = new BExpressionContext("way", metaReport );
|
||||
metaReport.readMetaData( lookupFile );
|
||||
|
||||
BExpressionMetaData metaCheck = new BExpressionMetaData();
|
||||
expctxCheck = new BExpressionContext("way", metaCheck );
|
||||
metaCheck.readMetaData( lookupFile );
|
||||
|
||||
expctxReport.parseFile( reportProfile, "global" );
|
||||
expctxCheck = new BExpressionContext("way");
|
||||
expctxCheck.readMetaData( lookupFile );
|
||||
expctxCheck.parseFile( checkProfile, "global" );
|
||||
// expctxStat = new BExpressionContext("way");
|
||||
|
||||
|
|
@ -63,6 +68,7 @@ public class RelationMerger extends MapCreatorBase
|
|||
String network = dis.readUTF();
|
||||
|
||||
String tagname = "route_" + route + "_" + network;
|
||||
|
||||
CompactLongSet routeset = null;
|
||||
if ( expctxCheck.getLookupNameIdx(tagname) >= 0 )
|
||||
{
|
||||
|
|
@ -127,6 +133,7 @@ public class RelationMerger extends MapCreatorBase
|
|||
|
||||
if ( ok )
|
||||
{
|
||||
expctxReport.decode( data.description );
|
||||
for( String tagname : routesets.keySet() )
|
||||
{
|
||||
CompactLongSet routeset = routesets.get( tagname );
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import btools.expressions.BExpressionContext;
|
||||
import btools.expressions.BExpressionMetaData;
|
||||
import btools.util.ByteArrayUnifier;
|
||||
import btools.util.ByteDataWriter;
|
||||
import btools.util.CompactLongMap;
|
||||
import btools.util.CompactLongSet;
|
||||
import btools.util.Crc32;
|
||||
|
|
@ -45,6 +47,7 @@ public class WayLinker extends MapCreatorBase
|
|||
private long creationTimeStamp;
|
||||
|
||||
private BExpressionContext expctxWay;
|
||||
private BExpressionContext expctxNode;
|
||||
|
||||
private ByteArrayUnifier abUnifier;
|
||||
|
||||
|
|
@ -77,13 +80,19 @@ public class WayLinker extends MapCreatorBase
|
|||
this.borderFileIn = borderFileIn;
|
||||
this.dataTilesSuffix = dataTilesSuffix;
|
||||
|
||||
BExpressionMetaData meta = new BExpressionMetaData();
|
||||
|
||||
// read lookup + profile for lookup-version + access-filter
|
||||
expctxWay = new BExpressionContext("way");
|
||||
expctxWay.readMetaData( lookupFile );
|
||||
lookupVersion = expctxWay.lookupVersion;
|
||||
lookupMinorVersion = expctxWay.lookupMinorVersion;
|
||||
writeVarLength = expctxWay.readVarLength;
|
||||
expctxWay = new BExpressionContext("way", meta);
|
||||
expctxNode = new BExpressionContext("node", meta);
|
||||
meta.readMetaData( lookupFile );
|
||||
|
||||
lookupVersion = meta.lookupVersion;
|
||||
lookupMinorVersion = meta.lookupMinorVersion;
|
||||
writeVarLength = meta.readVarLength;
|
||||
|
||||
expctxWay.parseFile( profileFile, "global" );
|
||||
expctxNode.parseFile( profileFile, "global" );
|
||||
|
||||
creationTimeStamp = System.currentTimeMillis();
|
||||
|
||||
|
|
@ -158,11 +167,11 @@ public class WayLinker extends MapCreatorBase
|
|||
ok |= expctxWay.getCostfactor() < 10000.;
|
||||
if ( !ok ) return;
|
||||
|
||||
byte bridgeTunnel = 0;
|
||||
byte wayBits = 0;
|
||||
expctxWay.decode( description );
|
||||
if ( expctxWay.getBooleanLookupValue( "bridge" ) ) bridgeTunnel |= OsmNodeP.BRIDGE_AND_BIT;
|
||||
if ( expctxWay.getBooleanLookupValue( "tunnel" ) ) bridgeTunnel |= OsmNodeP.TUNNEL_AND_BIT;
|
||||
|
||||
if ( !expctxWay.getBooleanLookupValue( "bridge" ) ) wayBits |= OsmNodeP.NO_BRIDGE_BIT;
|
||||
if ( !expctxWay.getBooleanLookupValue( "tunnel" ) ) wayBits |= OsmNodeP.NO_TUNNEL_BIT;
|
||||
|
||||
OsmNodeP n1 = null;
|
||||
OsmNodeP n2 = null;
|
||||
for (int i=0; i<way.nodes.size(); i++)
|
||||
|
|
@ -185,7 +194,7 @@ public class WayLinker extends MapCreatorBase
|
|||
}
|
||||
if ( n2 != null )
|
||||
{
|
||||
n2.wayAndBits &= bridgeTunnel;
|
||||
n2.wayBits |= wayBits;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -195,6 +204,9 @@ public class WayLinker extends MapCreatorBase
|
|||
{
|
||||
nodesMap = null;
|
||||
borderSet = null;
|
||||
|
||||
byte[] abBuf = new byte[1024*1024];
|
||||
byte[] abBuf2 = new byte[10*1024*1024];
|
||||
|
||||
int maxLon = minLon + 5000000;
|
||||
int maxLat = minLat + 5000000;
|
||||
|
|
@ -264,17 +276,16 @@ public class WayLinker extends MapCreatorBase
|
|||
{
|
||||
Collections.sort( subList );
|
||||
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream( );
|
||||
DataOutputStream dos = new DataOutputStream( bos );
|
||||
dos.writeInt( subList.size() + 1 ); // reserve 1 dummy node for crc
|
||||
ByteDataWriter dos = new ByteDataWriter( abBuf2 );
|
||||
|
||||
dos.writeInt( subList.size() );
|
||||
for( int ni=0; ni<subList.size(); ni++ )
|
||||
{
|
||||
OsmNodeP n = subList.get(ni);
|
||||
n.writeNodeData( dos, writeVarLength );
|
||||
n.writeNodeData( dos, writeVarLength, abBuf );
|
||||
}
|
||||
dos.close();
|
||||
byte[] subBytes = bos.toByteArray();
|
||||
pos += subBytes.length + 12; // reserve 12 bytes for crc dummy node
|
||||
byte[] subBytes = dos.toByteArray();
|
||||
pos += subBytes.length + 4; // reserve 4 bytes for crc
|
||||
subByteArrays[si] = subBytes;
|
||||
}
|
||||
posIdx[si] = pos;
|
||||
|
|
@ -289,9 +300,6 @@ public class WayLinker extends MapCreatorBase
|
|||
if ( ab != null )
|
||||
{
|
||||
os.write( ab );
|
||||
os.writeShort( Short.MAX_VALUE ); // write crc as a dummy node for compatibility
|
||||
os.writeShort( Short.MAX_VALUE );
|
||||
os.writeInt( 4 );
|
||||
os.writeInt( Crc32.crc( ab, 0 , ab.length ) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue