Search in sources :

Example 1 with RouteDataBlock

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

the class BinaryMapIndexWriter method writeRouteDataBlock.

public void writeRouteDataBlock(RouteDataBlock.Builder builder, Map<String, Integer> stringTable, BinaryFileReference ref) throws IOException {
    checkPeekState(ROUTE_INDEX_INIT);
    if (stringTable != null && stringTable.size() > 0) {
        StringTable.Builder bs = OsmandOdb.StringTable.newBuilder();
        for (String s : stringTable.keySet()) {
            bs.addS(s);
        }
        StringTable st = bs.build();
        builder.setStringTable(st);
        int size = st.getSerializedSize();
        ROUTE_STRING_DATA_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());
    RouteDataBlock block = builder.build();
    ROUTE_DATA_SIZE += block.getSerializedSize();
    codedOutStream.writeMessageNoTag(block);
}
Also used : StringTable(net.osmand.binary.OsmandOdb.StringTable) RouteDataBlock(net.osmand.binary.OsmandOdb.OsmAndRoutingIndex.RouteDataBlock) ByteString(com.google.protobuf.ByteString)

Aggregations

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