Search in sources :

Example 1 with MapDataBlock

use of net.osmand.binary.OsmandOdb.MapDataBlock in project OsmAnd-tools by osmandapp.

the class BinaryMapIndexWriter method writeMapDataBlock.

public void writeMapDataBlock(MapDataBlock.Builder builder, Map<String, Integer> stringTable, BinaryFileReference ref) throws IOException {
    checkPeekState(MAP_ROOT_LEVEL_INIT);
    StringTable.Builder bs = OsmandOdb.StringTable.newBuilder();
    if (stringTable != null) {
        for (String s : stringTable.keySet()) {
            bs.addS(s);
        }
    }
    StringTable st = bs.build();
    builder.setStringTable(st);
    int size = st.getSerializedSize();
    STRING_TABLE_SIZE += CodedOutputStream.computeTagSize(OsmandOdb.MapDataBlock.STRINGTABLE_FIELD_NUMBER) + CodedOutputStream.computeRawVarint32Size(size) + size;
    codedOutStream.writeTag(OsmAndMapIndex.MapRootLevel.BLOCKS_FIELD_NUMBER, FieldType.MESSAGE.getWireType());
    codedOutStream.flush();
    ref.writeReference(raf, getFilePointer());
    MapDataBlock block = builder.build();
    MAP_DATA_SIZE += block.getSerializedSize();
    codedOutStream.writeMessageNoTag(block);
}
Also used : StringTable(net.osmand.binary.OsmandOdb.StringTable) MapDataBlock(net.osmand.binary.OsmandOdb.MapDataBlock) ByteString(com.google.protobuf.ByteString)

Aggregations

ByteString (com.google.protobuf.ByteString)1 MapDataBlock (net.osmand.binary.OsmandOdb.MapDataBlock)1 StringTable (net.osmand.binary.OsmandOdb.StringTable)1