Add information about header section size
This commit is contained in:
parent
f50f41a4da
commit
4c91c95721
2 changed files with 14 additions and 1 deletions
|
@ -696,6 +696,7 @@ public class BinaryMapIndexReader {
|
|||
private void readMapIndex(MapIndex index, boolean onlyInitEncodingRules) throws IOException {
|
||||
int defaultId = 1;
|
||||
int oldLimit;
|
||||
int encodingRulesSize = 0;
|
||||
while (true) {
|
||||
int t = codedIS.readTag();
|
||||
int tag = WireFormat.getTagFieldNumber(t);
|
||||
|
@ -712,10 +713,14 @@ public class BinaryMapIndexReader {
|
|||
break;
|
||||
case OsmandOdb.OsmAndMapIndex.RULES_FIELD_NUMBER :
|
||||
if (onlyInitEncodingRules) {
|
||||
if(encodingRulesSize == 0) {
|
||||
encodingRulesSize = codedIS.getTotalBytesRead();
|
||||
}
|
||||
int len = codedIS.readInt32();
|
||||
oldLimit = codedIS.pushLimit(len);
|
||||
readMapEncodingRule(index, defaultId++);
|
||||
codedIS.popLimit(oldLimit);
|
||||
index.encodingRulesSizeBytes = (codedIS.getTotalBytesRead() - encodingRulesSize);
|
||||
} else {
|
||||
skipUnknownField(t);
|
||||
}
|
||||
|
@ -1829,10 +1834,13 @@ public class BinaryMapIndexReader {
|
|||
public int onewayReverseAttribute = -1;
|
||||
public TIntHashSet positiveLayers = new TIntHashSet(2);
|
||||
public TIntHashSet negativeLayers = new TIntHashSet(2);
|
||||
public int encodingRulesSizeBytes;
|
||||
|
||||
// to speed up comparision
|
||||
private MapIndex referenceMapIndex;
|
||||
|
||||
|
||||
|
||||
public Integer getRule(String t, String v) {
|
||||
Map<String, Integer> m = encodingRules.get(t);
|
||||
if (m != null) {
|
||||
|
|
|
@ -292,6 +292,7 @@ public class BinaryMapRouteReaderAdapter {
|
|||
public static class RouteRegion extends BinaryIndexPart {
|
||||
public int regionsRead;
|
||||
public List<RouteTypeRule> routeEncodingRules = new ArrayList<BinaryMapRouteReaderAdapter.RouteTypeRule>();
|
||||
public int routeEncodingRulesBytes = 0;
|
||||
public Map<String, Integer> decodingRules = null;
|
||||
List<RouteSubregion> subregions = new ArrayList<RouteSubregion>();
|
||||
List<RouteSubregion> basesubregions = new ArrayList<RouteSubregion>();
|
||||
|
@ -614,6 +615,7 @@ public class BinaryMapRouteReaderAdapter {
|
|||
|
||||
protected void readRouteIndex(RouteRegion region) throws IOException {
|
||||
int routeEncodingRule = 1;
|
||||
int routeEncodingRulesSize = 0;
|
||||
while(true){
|
||||
int t = codedIS.readTag();
|
||||
int tag = WireFormat.getTagFieldNumber(t);
|
||||
|
@ -626,10 +628,13 @@ public class BinaryMapRouteReaderAdapter {
|
|||
break;
|
||||
case OsmandOdb.OsmAndRoutingIndex.RULES_FIELD_NUMBER: {
|
||||
int len = codedIS.readInt32();
|
||||
if(routeEncodingRulesSize == 0) {
|
||||
routeEncodingRulesSize = codedIS.getTotalBytesRead();
|
||||
}
|
||||
int oldLimit = codedIS.pushLimit(len);
|
||||
readRouteEncodingRule(region, routeEncodingRule++);
|
||||
codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
|
||||
codedIS.popLimit(oldLimit);
|
||||
region.routeEncodingRulesBytes = codedIS.getTotalBytesRead() - routeEncodingRulesSize;
|
||||
} break;
|
||||
case OsmandOdb.OsmAndRoutingIndex.ROOTBOXES_FIELD_NUMBER :
|
||||
case OsmandOdb.OsmAndRoutingIndex.BASEMAPBOXES_FIELD_NUMBER :{
|
||||
|
|
Loading…
Reference in a new issue