Add ferry rendering + add text to route information
This commit is contained in:
parent
7cc9caa7d4
commit
44ec3a2849
7 changed files with 62 additions and 6 deletions
|
@ -3,6 +3,7 @@ package net.osmand.binary;
|
|||
import gnu.trove.iterator.TLongObjectIterator;
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
import gnu.trove.list.array.TLongArrayList;
|
||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
import gnu.trove.map.hash.TLongObjectHashMap;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -137,6 +138,8 @@ public class BinaryMapRouteReaderAdapter {
|
|||
|
||||
List<RouteSubregion> subregions = new ArrayList<RouteSubregion>();
|
||||
List<RouteTypeRule> routeEncodingRules = new ArrayList<BinaryMapRouteReaderAdapter.RouteTypeRule>();
|
||||
int nameTypeRule = -1;
|
||||
int refTypeRule = -1;
|
||||
|
||||
public double getLeftLongitude() {
|
||||
return leftLongitude;
|
||||
|
@ -163,6 +166,11 @@ public class BinaryMapRouteReaderAdapter {
|
|||
routeEncodingRules.add(null);
|
||||
}
|
||||
routeEncodingRules.set(id, new RouteTypeRule(tags, val));
|
||||
if(tags.equals("name")) {
|
||||
nameTypeRule = id;
|
||||
} else if(tags.equals("ref")) {
|
||||
refTypeRule = id;
|
||||
}
|
||||
}
|
||||
|
||||
public List<RouteSubregion> getSubregions(){
|
||||
|
@ -300,6 +308,17 @@ public class BinaryMapRouteReaderAdapter {
|
|||
}
|
||||
codedIS.popLimit(oldLimit);
|
||||
break;
|
||||
case RouteData.STRINGNAMES_FIELD_NUMBER:
|
||||
o.names = new TIntObjectHashMap<String>();
|
||||
int sizeL = codedIS.readRawVarint32();
|
||||
int old = codedIS.pushLimit(sizeL);
|
||||
while (codedIS.getBytesUntilLimit() > 0) {
|
||||
int stag = codedIS.readRawVarint32();
|
||||
int pId = codedIS.readRawVarint32();
|
||||
o.names.put(stag, ((char)pId)+"");
|
||||
}
|
||||
codedIS.popLimit(old);
|
||||
break;
|
||||
case RouteData.POINTS_FIELD_NUMBER:
|
||||
len = codedIS.readRawVarint32();
|
||||
oldLimit = codedIS.pushLimit(len);
|
||||
|
@ -349,6 +368,7 @@ public class BinaryMapRouteReaderAdapter {
|
|||
routeTree.dataObjects = new ArrayList<RouteDataObject>();
|
||||
idTables.clear();
|
||||
restrictions.clear();
|
||||
List<String> stringTable = null;
|
||||
while(true){
|
||||
int t = codedIS.readTag();
|
||||
int tag = WireFormat.getTagFieldNumber(t);
|
||||
|
@ -371,6 +391,12 @@ public class BinaryMapRouteReaderAdapter {
|
|||
if (o.id < idTables.size()) {
|
||||
o.id = idTables.get((int) o.id);
|
||||
}
|
||||
if (o.names != null && stringTable != null) {
|
||||
int[] keys = o.names.keys();
|
||||
for (int j = 0; j < keys.length; j++) {
|
||||
o.names.put(keys[j], stringTable.get(o.names.get(keys[j]).charAt(0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -440,8 +466,8 @@ public class BinaryMapRouteReaderAdapter {
|
|||
case RouteDataBlock.STRINGTABLE_FIELD_NUMBER :
|
||||
length = codedIS.readRawVarint32();
|
||||
oldLimit = codedIS.pushLimit(length);
|
||||
// map.readStringTable();
|
||||
codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
|
||||
stringTable = map.readStringTable();
|
||||
// codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
|
||||
codedIS.popLimit(oldLimit);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.binary;
|
||||
|
||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
|
||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
|
||||
|
||||
|
@ -16,6 +17,7 @@ public class RouteDataObject {
|
|||
public long[] restrictions;
|
||||
public int[][] pointTypes;
|
||||
public long id;
|
||||
public TIntObjectHashMap<String> names;
|
||||
|
||||
public RouteDataObject(RouteRegion region) {
|
||||
this.region = region;
|
||||
|
@ -34,6 +36,20 @@ public class RouteDataObject {
|
|||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
if(names != null ) {
|
||||
return names.get(region.nameTypeRule);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getRef(){
|
||||
if(names != null ) {
|
||||
return names.get(region.refTypeRule);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getPoint31XTile(int i) {
|
||||
return pointsX[i];
|
||||
|
|
|
@ -418,6 +418,9 @@ public class BinaryMapIndexWriter {
|
|||
|
||||
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();
|
||||
|
|
|
@ -744,9 +744,9 @@ public class IndexCreator {
|
|||
MapRenderingTypes rt = MapRenderingTypes.getDefault();
|
||||
MapZooms zooms = MapZooms.getDefault(); // MapZooms.parseZooms("15-");
|
||||
// creator.setNodesDBFile(new File("/home/victor/projects/OsmAnd/data/osm-gen/nodes.tmp.odb"));
|
||||
// creator.generateIndexes(new File("/home/victor/projects/OsmAnd/temp/map.osm"),
|
||||
creator.generateIndexes(new File("/home/victor/projects/OsmAnd/temp/map.osm"),
|
||||
// creator.generateIndexes(new File("/home/victor/projects/OsmAnd/data/osm-maps/luxembourg.osm.pbf"),
|
||||
creator.generateIndexes(new File("/home/victor/projects/OsmAnd/data/osm-maps/RU-SPE.osm.bz2"),
|
||||
// creator.generateIndexes(new File("/home/victor/projects/OsmAnd/data/osm-maps/RU-SPE.osm.bz2"),
|
||||
new ConsoleProgressImplementation(1), null, zooms, rt, log);
|
||||
|
||||
|
||||
|
|
|
@ -88,6 +88,10 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator {
|
|||
|
||||
private void indexMultiPolygon(Entity e, OsmDbAccessorContext ctx) throws SQLException {
|
||||
if (e instanceof Relation && "multipolygon".equals(e.getTag(OSMTagKey.TYPE))) { //$NON-NLS-1$
|
||||
if(e.getTag(OSMTagKey.ADMIN_LEVEL) != null) {
|
||||
// don't index boundaries as multipolygon (only areas ideally are multipolygon)
|
||||
return;
|
||||
}
|
||||
ctx.loadEntityRelation((Relation) e);
|
||||
Map<Entity, String> entities = ((Relation) e).getMemberEntities();
|
||||
|
||||
|
|
|
@ -25,6 +25,10 @@ public class MapRoutingTypes {
|
|||
TAGS_TO_ACCEPT.add("route");
|
||||
|
||||
// TEXT tags
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
TAGS_TEXT.add("int_ref");
|
||||
>>>>>>> Add ferry rendering + add text to route information
|
||||
TAGS_TEXT.add("ref");
|
||||
TAGS_TEXT.add("name");
|
||||
TAGS_TEXT.add("direction");
|
||||
|
|
|
@ -898,8 +898,11 @@ public class BinaryRoutePlanner {
|
|||
+ " start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\" complete_time=\"{4}\" complete_distance=\"{6}\">",
|
||||
startLat + "", startLon + "", endLat + "", endLon + "", completeTime + "", ctx.config.routerName, completeDistance+""));
|
||||
for (RouteSegmentResult res : result) {
|
||||
String name = "Unknown";// res.object.getName();
|
||||
String ref = "";// res.object.getNameByType(res.object.getMapIndex().refEncodingType);
|
||||
String name = res.getObject().getName();
|
||||
String ref = res.getObject().getRef();
|
||||
if(name == null) {
|
||||
name = "";
|
||||
}
|
||||
if (ref != null) {
|
||||
name += " " + ref;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue