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