use of net.osmand.binary.OsmandOdb.StringTable 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);
}
use of net.osmand.binary.OsmandOdb.StringTable in project OsmAnd-tools by osmandapp.
the class BinaryMapIndexWriter method writeTransportStringTable.
public void writeTransportStringTable(Map<String, Integer> stringTable) throws IOException {
checkPeekState(TRANSPORT_INDEX_INIT);
// expect linked hash map
int i = 0;
OsmandOdb.StringTable.Builder st = OsmandOdb.StringTable.newBuilder();
for (String s : stringTable.keySet()) {
if (stringTable.get(s) != i++) {
throw new IllegalStateException();
}
st.addS(s);
}
codedOutStream.writeMessage(OsmAndTransportIndex.STRINGTABLE_FIELD_NUMBER, st.build());
}
use of net.osmand.binary.OsmandOdb.StringTable 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);
}
Aggregations