Update rendering types for new Android version & new map creator

This commit is contained in:
vshcherb 2013-11-24 17:14:36 +01:00
parent 778a72992f
commit 6ff89eff04
4 changed files with 568 additions and 239 deletions

View file

@ -55,30 +55,11 @@ public class BinaryInspector {
in.inspector(args); in.inspector(args);
// test cases show info // test cases show info
run(in); in.inspector(new String[]{"-vpoi",/*"-vmap", "-vmapobjects", *//*"-vstreets", "-bbox=14.4,50.1,14.5,50.01", */"/home/victor/projects/osmand/osm-gen/Map.obf"});
run(in);
// in.inspector(new String[]{"-vmap", "-vmapobjects", /*"-vstreets", "-bbox=14.4,50.1,14.5,50.01", */"/home/victor/projects/osmand/osm-gen/Osmand_regions.obf"});
// test case extract parts // test case extract parts
// test case // test case
} }
private static void run(BinaryInspector in) throws IOException {
long ts = System.currentTimeMillis();
int tileX = 1051;
int tileY = 673;
int zoom = 11;
float lt = (float) MapUtils.getLatitudeFromTile(zoom, tileY);
float lb = (float) MapUtils.getLatitudeFromTile(zoom, tileY + 1);
float ll = (float) MapUtils.getLongitudeFromTile(zoom, tileX);
float lr = (float) MapUtils.getLongitudeFromTile(zoom, tileX + 1);
String bbox = "-bbox="+ll+","+lt+","+lr+","+lb;
System.out.println("Tile z="+zoom+" x="+tileX +" y=" + tileY + " " + bbox);
in.inspector(new String[]{"-vmap", "-vmapobjects", /*"-vstreets", */ "-zoom="+zoom,
bbox, "/home/victor/projects/osmand/osm-gen/World_basemap_2.obf"});
System.out.println("Time " + (System.currentTimeMillis() - ts)+" ms");
}
private void printToFile(String s) throws IOException { private void printToFile(String s) throws IOException {
if(vInfo.osmOut != null) { if(vInfo.osmOut != null) {
vInfo.osmOut.write(s.getBytes()); vInfo.osmOut.write(s.getBytes());
@ -91,7 +72,7 @@ public class BinaryInspector {
if(vInfo != null && vInfo.osm && vInfo.osmOut == null) { if(vInfo != null && vInfo.osm && vInfo.osmOut == null) {
// ignore // ignore
} else { } else {
// System.out.println(s); System.out.println(s);
} }
} }
@ -100,7 +81,7 @@ public class BinaryInspector {
if(vInfo != null && vInfo.osm && vInfo.osmOut == null) { if(vInfo != null && vInfo.osm && vInfo.osmOut == null) {
// ignore // ignore
} else { } else {
// System.out.print(s); System.out.print(s);
} }
} }
@ -799,7 +780,8 @@ public class BinaryInspector {
new ResultMatcher<Amenity>() { new ResultMatcher<Amenity>() {
@Override @Override
public boolean publish(Amenity object) { public boolean publish(Amenity object) {
println(object.getType().toString() + " : " + object.getSubType() + " " + object.getEnName() + " " + object.getLocation() + " id=" + (object.getId() >> 1)); println(object.getType().toString() + " : " + object.getSubType() + " " + object.getName() + " " + object.getLocation() + " id=" + (object.getId() >> 1) + " " +
object.getAdditionalInfo());
return false; return false;
} }
@Override @Override

File diff suppressed because it is too large Load diff

View file

@ -114,5 +114,10 @@ public class AmenityType {
return a.getCategoryName(); return a.getCategoryName();
} }
@Override
public String toString() {
return valueToString(this);
}
} }

View file

@ -174,8 +174,19 @@ public class MapRenderingTypes {
if (rType == null || !rType.isPOI()) { if (rType == null || !rType.isPOI()) {
rType = types.get(constructRuleKey(tag, null)); rType = types.get(constructRuleKey(tag, null));
} }
if(!rType.isPOI()) { if(rType == null || !rType.isPOI()) {
return null; return null;
} else if(rType.isAdditional() && rType.tagValuePattern.value == null) {
MapRulType parent = rType;
rType = MapRulType.createAdditional(tag, val);
rType.additional = true;
rType.applyToTagValue = parent.applyToTagValue;
rType.onlyMap = parent.onlyMap;
rType.onlyPoi = parent.onlyPoi;
rType.onlyPoint = parent.onlyPoint;
rType.poiSpecified = parent.poiSpecified;
rType.poiCategory = parent.poiCategory;
registerRuleType(rType);
} }
return rType; return rType;
} }
@ -334,12 +345,12 @@ public class MapRenderingTypes {
value = null; value = null;
} }
MapRulType rtype = MapRulType.createMainEntity(tag, value); MapRulType rtype = MapRulType.createMainEntity(tag, value);
boolean onlyMap = "true".equals(parser.getAttributeValue("", "only_map"));
if("true".equals(additional)) { if("true".equals(additional)) {
rtype = MapRulType.createMainEntity(tag, value); rtype = MapRulType.createAdditional(tag, value);
} else if("text".equals(additional)) { } else if("text".equals(additional)) {
rtype = MapRulType.createText(tag); rtype = MapRulType.createText(tag);
} }
rtype.onlyMap = "true".equals(parser.getAttributeValue("", "only_map"));
String targetTag = parser.getAttributeValue("", "target_tag"); String targetTag = parser.getAttributeValue("", "target_tag");
String targetValue = parser.getAttributeValue("", "target_value"); String targetValue = parser.getAttributeValue("", "target_value");
if (targetTag != null || targetValue != null) { if (targetTag != null || targetValue != null) {
@ -360,7 +371,7 @@ public class MapRenderingTypes {
rtype.applyToTagValue = new HashSet<TagValuePattern>(); rtype.applyToTagValue = new HashSet<TagValuePattern>();
rtype.applyToTagValue.add(new TagValuePattern(applyTo, applyValue)); rtype.applyToTagValue.add(new TagValuePattern(applyTo, applyValue));
} }
if(!onlyMap) { if(!rtype.onlyMap) {
registerRuleType(rtype); registerRuleType(rtype);
} }
@ -617,8 +628,12 @@ public class MapRenderingTypes {
return targetPoiId; return targetPoiId;
} }
public void setTargetPoiId(int targetPoiId) { public void setTargetPoiId(int catId, int valueId) {
this.targetPoiId = targetPoiId; if(catId <= 31) {
this.targetPoiId = (valueId << 6) | (catId << 1) ;
} else {
this.targetPoiId = (valueId << 16) | (catId << 1) | 1;
}
} }
public int getInternalId() { public int getInternalId() {