Fix issue with road only maps (sort names)
This commit is contained in:
parent
bde81ccbf5
commit
b96abd5416
3 changed files with 17 additions and 9 deletions
|
@ -66,9 +66,9 @@ public class BinaryInspector {
|
|||
// test cases show info
|
||||
if(args.length == 1 && "test".equals(args[0])) {
|
||||
in.inspector(new String[]{
|
||||
"-vpoi",
|
||||
// "-vpoi",
|
||||
// "-vmap", "-vmapobjects", // "-vmapcoordinates",
|
||||
// "-vrouting",
|
||||
"-vrouting",
|
||||
// "-vaddress", "-vcities",//"-vstreetgroups",
|
||||
// "-vstreets", "-vbuildings", "-vintersections",
|
||||
// "-zoom=15",
|
||||
|
@ -535,16 +535,15 @@ public class BinaryInspector {
|
|||
b.setLength(0);
|
||||
b.append("Road ");
|
||||
b.append(obj.id);
|
||||
for(int i = 0; i < obj.getTypes().length; i++) {
|
||||
for (int i = 0; i < obj.getTypes().length; i++) {
|
||||
RouteTypeRule rr = obj.region.quickGetEncodingRule(obj.getTypes()[i]);
|
||||
b.append(" ").append(rr.getTag()).append("='").append(rr.getValue()).append("'");
|
||||
}
|
||||
if (obj.getNames() != null) {
|
||||
TIntObjectIterator<String> it = obj.getNames().iterator();
|
||||
while (it.hasNext()) {
|
||||
it.advance();
|
||||
RouteTypeRule rr = obj.region.quickGetEncodingRule(it.key());
|
||||
b.append(" ").append(rr.getTag()).append("='").append(it.value()).append("'");
|
||||
int[] nameIds = obj.getNameIds();
|
||||
if (nameIds != null) {
|
||||
for (int key : nameIds) {
|
||||
RouteTypeRule rr = obj.region.quickGetEncodingRule(key);
|
||||
b.append(" ").append(rr.getTag()).append("='").append(obj.getNames().get(key)).append("'");
|
||||
}
|
||||
}
|
||||
println(b.toString());
|
||||
|
|
|
@ -451,11 +451,14 @@ public class BinaryMapRouteReaderAdapter {
|
|||
o.names = new TIntObjectHashMap<String>();
|
||||
int sizeL = codedIS.readRawVarint32();
|
||||
int old = codedIS.pushLimit(sizeL);
|
||||
TIntArrayList list = new TIntArrayList();
|
||||
while (codedIS.getBytesUntilLimit() > 0) {
|
||||
int stag = codedIS.readRawVarint32();
|
||||
int pId = codedIS.readRawVarint32();
|
||||
o.names.put(stag, ((char)pId)+"");
|
||||
list.add(stag);
|
||||
}
|
||||
o.nameIds = list.toArray();
|
||||
codedIS.popLimit(old);
|
||||
break;
|
||||
case RouteData.POINTS_FIELD_NUMBER:
|
||||
|
|
|
@ -26,6 +26,7 @@ public class RouteDataObject {
|
|||
public long id;
|
||||
public TIntObjectHashMap<String> names;
|
||||
public final static float NONE_MAX_SPEED = 40f;
|
||||
public int[] nameIds;
|
||||
|
||||
public RouteDataObject(RouteRegion region) {
|
||||
this.region = region;
|
||||
|
@ -33,6 +34,7 @@ public class RouteDataObject {
|
|||
|
||||
public RouteDataObject(RouteRegion region, int[] nameIds, String[] nameValues) {
|
||||
this.region = region;
|
||||
this.nameIds = nameIds;
|
||||
if (nameIds.length > 0) {
|
||||
names = new TIntObjectHashMap<String>();
|
||||
}
|
||||
|
@ -86,6 +88,10 @@ public class RouteDataObject {
|
|||
return null;
|
||||
}
|
||||
|
||||
public int[] getNameIds() {
|
||||
return nameIds;
|
||||
}
|
||||
|
||||
public TIntObjectHashMap<String> getNames() {
|
||||
return names;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue