commit
7f4c2883cc
20 changed files with 53 additions and 77 deletions
|
@ -545,7 +545,7 @@ public final class DescriptorProtos {
|
||||||
.computeStringSizeNoTag(element);
|
.computeStringSizeNoTag(element);
|
||||||
}
|
}
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
size += 1 * getDependencyList().size();
|
size += getDependencyList().size();
|
||||||
}
|
}
|
||||||
for (com.google.protobuf.DescriptorProtos.DescriptorProto element : getMessageTypeList()) {
|
for (com.google.protobuf.DescriptorProtos.DescriptorProto element : getMessageTypeList()) {
|
||||||
size += com.google.protobuf.CodedOutputStream
|
size += com.google.protobuf.CodedOutputStream
|
||||||
|
|
|
@ -72,6 +72,6 @@ public class GeoidAltitudeCorrection {
|
||||||
rf.read(b);
|
rf.read(b);
|
||||||
int ch1 = b[0] < 0 ? b[0] + 256 : b[0];
|
int ch1 = b[0] < 0 ? b[0] + 256 : b[0];
|
||||||
int ch2 = b[1] < 0 ? b[1] + 256 : b[1];
|
int ch2 = b[1] < 0 ? b[1] + 256 : b[1];
|
||||||
return (short)((ch1 << 8) + (ch2 << 0));
|
return (short)((ch1 << 8) + ch2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ public class TspAnt {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String tourToString(int tour[]) {
|
public static String tourToString(int tour[]) {
|
||||||
String t = new String();
|
String t = "";
|
||||||
for (int i : tour)
|
for (int i : tour)
|
||||||
t = t + " " + i;
|
t = t + " " + i;
|
||||||
return t;
|
return t;
|
||||||
|
|
|
@ -190,7 +190,7 @@ public class BinaryInspector {
|
||||||
ous.writeRawByte((v >>> 24) & 0xFF);
|
ous.writeRawByte((v >>> 24) & 0xFF);
|
||||||
ous.writeRawByte((v >>> 16) & 0xFF);
|
ous.writeRawByte((v >>> 16) & 0xFF);
|
||||||
ous.writeRawByte((v >>> 8) & 0xFF);
|
ous.writeRawByte((v >>> 8) & 0xFF);
|
||||||
ous.writeRawByte((v >>> 0) & 0xFF);
|
ous.writeRawByte(v & 0xFF);
|
||||||
//written += 4;
|
//written += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,13 +227,13 @@ public class BinaryInspector {
|
||||||
String pattern = partsToExtractFrom.get(f);
|
String pattern = partsToExtractFrom.get(f);
|
||||||
boolean minus = true;
|
boolean minus = true;
|
||||||
for (int i = 0; i < indexes[c].getIndexes().size(); i++) {
|
for (int i = 0; i < indexes[c].getIndexes().size(); i++) {
|
||||||
partsSet[c].add(new Float(i + 1f));
|
partsSet[c].add(i + 1f);
|
||||||
BinaryIndexPart part = indexes[c].getIndexes().get(i);
|
BinaryIndexPart part = indexes[c].getIndexes().get(i);
|
||||||
if(part instanceof MapIndex){
|
if(part instanceof MapIndex){
|
||||||
List<MapRoot> roots = ((MapIndex) part).getRoots();
|
List<MapRoot> roots = ((MapIndex) part).getRoots();
|
||||||
int rsize = roots.size();
|
int rsize = roots.size();
|
||||||
for(int j=0; j<rsize; j++){
|
for(int j=0; j<rsize; j++){
|
||||||
partsSet[c].add(new Float((i+1f)+(j+1)/10f));
|
partsSet[c].add((i + 1f) + (j + 1) / 10f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ public class BinaryInspector {
|
||||||
if (!partSet.contains(Float.valueOf(i + 1f))) {
|
if (!partSet.contains(Float.valueOf(i + 1f))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
list.add(new Float(i + 1f));
|
list.add(i + 1f);
|
||||||
|
|
||||||
BinaryIndexPart part = index.getIndexes().get(i);
|
BinaryIndexPart part = index.getIndexes().get(i);
|
||||||
String map;
|
String map;
|
||||||
|
@ -388,7 +388,7 @@ public class BinaryInspector {
|
||||||
}
|
}
|
||||||
String name = p.getName() == null ? "" : p.getName();
|
String name = p.getName() == null ? "" : p.getName();
|
||||||
println(MessageFormat.format("{0} {1} data {3} - {2,number,#} bytes",
|
println(MessageFormat.format("{0} {1} data {3} - {2,number,#} bytes",
|
||||||
new Object[]{Integer.valueOf(i), partname, p.getLength(), name}));
|
new Object[]{i, partname, p.getLength(), name}));
|
||||||
if(p instanceof TransportIndex){
|
if(p instanceof TransportIndex){
|
||||||
TransportIndex ti = ((TransportIndex) p);
|
TransportIndex ti = ((TransportIndex) p);
|
||||||
int sh = (31 - BinaryMapIndexReader.TRANSPORT_STOP_ZOOM);
|
int sh = (31 - BinaryMapIndexReader.TRANSPORT_STOP_ZOOM);
|
||||||
|
@ -449,7 +449,7 @@ public class BinaryInspector {
|
||||||
int type = cityType[j];
|
int type = cityType[j];
|
||||||
final List<City> cities = index.getCities(region, null, type);
|
final List<City> cities = index.getCities(region, null, type);
|
||||||
|
|
||||||
print(MessageFormat.format("\t{0}, {1,number,#} group(s)", new Object[]{cityType_String[j], Integer.valueOf(cities.size())}));
|
print(MessageFormat.format("\t{0}, {1,number,#} group(s)", new Object[]{cityType_String[j], cities.size()}));
|
||||||
if (BinaryMapAddressReaderAdapter.CITY_TOWN_TYPE == type) {
|
if (BinaryMapAddressReaderAdapter.CITY_TOWN_TYPE == type) {
|
||||||
if (!verbose.vstreetgroups && !verbose.vcities) {
|
if (!verbose.vstreetgroups && !verbose.vcities) {
|
||||||
println("");
|
println("");
|
||||||
|
@ -465,7 +465,7 @@ public class BinaryInspector {
|
||||||
int size = index.preloadStreets(c, null);
|
int size = index.preloadStreets(c, null);
|
||||||
List<Street> streets = new ArrayList<Street>(c.getStreets());
|
List<Street> streets = new ArrayList<Street>(c.getStreets());
|
||||||
print(MessageFormat.format("\t\t''{0}'' [{1,number,#}], {2,number,#} street(s) size {3,number,#} bytes",
|
print(MessageFormat.format("\t\t''{0}'' [{1,number,#}], {2,number,#} street(s) size {3,number,#} bytes",
|
||||||
new Object[]{c.getEnName(), Long.valueOf(c.getId()), Integer.valueOf(streets.size()), Integer.valueOf(size)}));
|
new Object[]{c.getEnName(), c.getId(), Integer.valueOf(streets.size()), Integer.valueOf(size)}));
|
||||||
if(!verbose.vstreets)
|
if(!verbose.vstreets)
|
||||||
{
|
{
|
||||||
println("");
|
println("");
|
||||||
|
@ -483,13 +483,13 @@ public class BinaryInspector {
|
||||||
final List<Street> intersections = t.getIntersectedStreets();
|
final List<Street> intersections = t.getIntersectedStreets();
|
||||||
|
|
||||||
println(MessageFormat.format("\t\t\t''{0}'' [{1,number,#}], {2,number,#} building(s), {3,number,#} intersections(s)",
|
println(MessageFormat.format("\t\t\t''{0}'' [{1,number,#}], {2,number,#} building(s), {3,number,#} intersections(s)",
|
||||||
new Object[]{t.getEnName(), Long.valueOf(t.getId()), Integer.valueOf(buildings.size()), Integer.valueOf(intersections.size())}));
|
new Object[]{t.getEnName(), t.getId(), Integer.valueOf(buildings.size()), Integer.valueOf(intersections.size())}));
|
||||||
|
|
||||||
if (buildings != null && !buildings.isEmpty() && verbose.vbuildings) {
|
if (buildings != null && !buildings.isEmpty() && verbose.vbuildings) {
|
||||||
println("\t\t\t\tBuildings:");
|
println("\t\t\t\tBuildings:");
|
||||||
for (Building b : buildings) {
|
for (Building b : buildings) {
|
||||||
println(MessageFormat.format("\t\t\t\t{0} [{1,number,#}]",
|
println(MessageFormat.format("\t\t\t\t{0} [{1,number,#}]",
|
||||||
new Object[]{b.getName(true), Long.valueOf(b.getId())}));
|
new Object[]{b.getName(true), b.getId()}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.binary;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import net.osmand.NativeLibrary;
|
import net.osmand.NativeLibrary;
|
||||||
import net.osmand.bridge.ObfInspector;
|
import net.osmand.bridge.ObfInspector;
|
||||||
|
@ -21,9 +22,7 @@ public class BinaryInspectorNative {
|
||||||
// test cases show info
|
// test cases show info
|
||||||
NativeLibrary.loadAllLibs(null);
|
NativeLibrary.loadAllLibs(null);
|
||||||
StringVector vector = new StringVector();
|
StringVector vector = new StringVector();
|
||||||
for(int i = 0; i < args.length; i++) {
|
Collections.addAll(vector, args);
|
||||||
vector.add(args[i]);
|
|
||||||
}
|
|
||||||
ObfInspector.inspector(vector);
|
ObfInspector.inspector(vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -339,7 +339,7 @@ public class BinaryMapIndexReader {
|
||||||
int ch2 = readByte();
|
int ch2 = readByte();
|
||||||
int ch3 = readByte();
|
int ch3 = readByte();
|
||||||
int ch4 = readByte();
|
int ch4 = readByte();
|
||||||
return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
|
return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + ch4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2013,7 +2013,7 @@ public class BinaryMapIndexReader {
|
||||||
if(pair == null) {
|
if(pair == null) {
|
||||||
throw new NullPointerException("Type " + types[j] + "was not found");
|
throw new NullPointerException("Type " + types[j] + "was not found");
|
||||||
}
|
}
|
||||||
b.append(pair.toSimpleString()+"("+types[j]+")");
|
b.append(pair.toSimpleString()).append("(").append(types[j]).append(")");
|
||||||
}
|
}
|
||||||
b.append("]");
|
b.append("]");
|
||||||
if(obj.getAdditionalTypes() != null && obj.getAdditionalTypes().length > 0){
|
if(obj.getAdditionalTypes() != null && obj.getAdditionalTypes().length > 0){
|
||||||
|
@ -2026,7 +2026,7 @@ public class BinaryMapIndexReader {
|
||||||
if(pair == null) {
|
if(pair == null) {
|
||||||
throw new NullPointerException("Type " + obj.getAdditionalTypes()[j] + "was not found");
|
throw new NullPointerException("Type " + obj.getAdditionalTypes()[j] + "was not found");
|
||||||
}
|
}
|
||||||
b.append(pair.toSimpleString()+"("+obj.getAdditionalTypes()[j]+")");
|
b.append(pair.toSimpleString()).append("(").append(obj.getAdditionalTypes()[j]).append(")");
|
||||||
|
|
||||||
}
|
}
|
||||||
b.append("]");
|
b.append("]");
|
||||||
|
@ -2043,7 +2043,7 @@ public class BinaryMapIndexReader {
|
||||||
if(pair == null) {
|
if(pair == null) {
|
||||||
throw new NullPointerException("Type " + keys[j] + "was not found");
|
throw new NullPointerException("Type " + keys[j] + "was not found");
|
||||||
}
|
}
|
||||||
b.append(pair.toSimpleString()+"("+keys[j]+")");
|
b.append(pair.toSimpleString()).append("(").append(keys[j]).append(")");
|
||||||
b.append(" - ").append(names.get(keys[j]));
|
b.append(" - ").append(names.get(keys[j]));
|
||||||
}
|
}
|
||||||
b.append("]");
|
b.append("]");
|
||||||
|
|
|
@ -1329,7 +1329,7 @@ public final class OsmandOdb {
|
||||||
.computeStringSizeNoTag(element);
|
.computeStringSizeNoTag(element);
|
||||||
}
|
}
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
size += 1 * getSList().size();
|
size += getSList().size();
|
||||||
}
|
}
|
||||||
size += getUnknownFields().getSerializedSize();
|
size += getUnknownFields().getSerializedSize();
|
||||||
memoizedSerializedSize = size;
|
memoizedSerializedSize = size;
|
||||||
|
@ -1713,13 +1713,13 @@ public final class OsmandOdb {
|
||||||
.computeStringSizeNoTag(element);
|
.computeStringSizeNoTag(element);
|
||||||
}
|
}
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
size += 1 * getKeyList().size();
|
size += getKeyList().size();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
int dataSize = 0;
|
int dataSize = 0;
|
||||||
dataSize = 4 * getValList().size();
|
dataSize = 4 * getValList().size();
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
size += 1 * getValList().size();
|
size += getValList().size();
|
||||||
}
|
}
|
||||||
for (net.osmand.binary.OsmandOdb.IndexedStringTable element : getSubtablesList()) {
|
for (net.osmand.binary.OsmandOdb.IndexedStringTable element : getSubtablesList()) {
|
||||||
size += com.google.protobuf.CodedOutputStream
|
size += com.google.protobuf.CodedOutputStream
|
||||||
|
@ -4965,7 +4965,7 @@ public final class OsmandOdb {
|
||||||
.computeBytesSizeNoTag(element);
|
.computeBytesSizeNoTag(element);
|
||||||
}
|
}
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
size += 1 * getPolygonInnerCoordinatesList().size();
|
size += getPolygonInnerCoordinatesList().size();
|
||||||
}
|
}
|
||||||
if (hasAdditionalTypes()) {
|
if (hasAdditionalTypes()) {
|
||||||
size += com.google.protobuf.CodedOutputStream
|
size += com.google.protobuf.CodedOutputStream
|
||||||
|
@ -7393,7 +7393,7 @@ public final class OsmandOdb {
|
||||||
.computeInt32SizeNoTag(element);
|
.computeInt32SizeNoTag(element);
|
||||||
}
|
}
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
size += 1 * getShiftToIndexList().size();
|
size += getShiftToIndexList().size();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
int dataSize = 0;
|
int dataSize = 0;
|
||||||
|
@ -7402,7 +7402,7 @@ public final class OsmandOdb {
|
||||||
.computeInt32SizeNoTag(element);
|
.computeInt32SizeNoTag(element);
|
||||||
}
|
}
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
size += 1 * getShiftToCityIndexList().size();
|
size += getShiftToCityIndexList().size();
|
||||||
}
|
}
|
||||||
size += getUnknownFields().getSerializedSize();
|
size += getUnknownFields().getSerializedSize();
|
||||||
memoizedSerializedSize = size;
|
memoizedSerializedSize = size;
|
||||||
|
@ -15798,7 +15798,7 @@ public final class OsmandOdb {
|
||||||
.computeStringSizeNoTag(element);
|
.computeStringSizeNoTag(element);
|
||||||
}
|
}
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
size += 1 * getSubcategoriesList().size();
|
size += getSubcategoriesList().size();
|
||||||
}
|
}
|
||||||
size += getUnknownFields().getSerializedSize();
|
size += getUnknownFields().getSerializedSize();
|
||||||
memoizedSerializedSize = size;
|
memoizedSerializedSize = size;
|
||||||
|
@ -16740,7 +16740,7 @@ public final class OsmandOdb {
|
||||||
.computeUInt32SizeNoTag(element);
|
.computeUInt32SizeNoTag(element);
|
||||||
}
|
}
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
size += 1 * getCategoriesList().size();
|
size += getCategoriesList().size();
|
||||||
}
|
}
|
||||||
size += getUnknownFields().getSerializedSize();
|
size += getUnknownFields().getSerializedSize();
|
||||||
memoizedSerializedSize = size;
|
memoizedSerializedSize = size;
|
||||||
|
@ -17651,7 +17651,7 @@ public final class OsmandOdb {
|
||||||
.computeUInt32SizeNoTag(element);
|
.computeUInt32SizeNoTag(element);
|
||||||
}
|
}
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
size += 1 * getCategoriesList().size();
|
size += getCategoriesList().size();
|
||||||
}
|
}
|
||||||
if (hasName()) {
|
if (hasName()) {
|
||||||
size += com.google.protobuf.CodedOutputStream
|
size += com.google.protobuf.CodedOutputStream
|
||||||
|
@ -18265,7 +18265,7 @@ public final class OsmandOdb {
|
||||||
.computeSInt64SizeNoTag(element);
|
.computeSInt64SizeNoTag(element);
|
||||||
}
|
}
|
||||||
size += dataSize;
|
size += dataSize;
|
||||||
size += 1 * getRouteIdList().size();
|
size += getRouteIdList().size();
|
||||||
}
|
}
|
||||||
size += getUnknownFields().getSerializedSize();
|
size += getUnknownFields().getSerializedSize();
|
||||||
memoizedSerializedSize = size;
|
memoizedSerializedSize = size;
|
||||||
|
|
|
@ -146,9 +146,7 @@ public class DataTileManager<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private long evTile(int tileX, int tileY){
|
private long evTile(int tileX, int tileY){
|
||||||
long tx = tileX;
|
return ((tileX) << zoom) + tileY;
|
||||||
long ty = tileY;
|
|
||||||
return ((tx) << zoom) + ty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@ public class QuadTree<T> {
|
||||||
bounds = new QuadRect(b.left, b.top, b.right, b.bottom);
|
bounds = new QuadRect(b.left, b.top, b.right, b.bottom);
|
||||||
children = new Node[4];
|
children = new Node[4];
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
private float ratio;
|
private float ratio;
|
||||||
private int maxDepth;
|
private int maxDepth;
|
||||||
private Node<T> root;
|
private Node<T> root;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class Base64 {
|
||||||
// store the octets
|
// store the octets
|
||||||
bits24 = (octetString[i++] & 0xFF) << 16;
|
bits24 = (octetString[i++] & 0xFF) << 16;
|
||||||
bits24 |= (octetString[i++] & 0xFF) << 8;
|
bits24 |= (octetString[i++] & 0xFF) << 8;
|
||||||
bits24 |= (octetString[i++] & 0xFF) << 0;
|
bits24 |= (octetString[i++] & 0xFF);
|
||||||
|
|
||||||
bits6 = (bits24 & 0x00FC0000) >> 18;
|
bits6 = (bits24 & 0x00FC0000) >> 18;
|
||||||
out[outIndex++] = alphabet[bits6];
|
out[outIndex++] = alphabet[bits6];
|
||||||
|
|
|
@ -139,9 +139,9 @@ public class RenderingRule {
|
||||||
public StringBuilder toString(String indent, StringBuilder bls ) {
|
public StringBuilder toString(String indent, StringBuilder bls ) {
|
||||||
bls.append("RenderingRule [");
|
bls.append("RenderingRule [");
|
||||||
for(RenderingRuleProperty p : getProperties()){
|
for(RenderingRuleProperty p : getProperties()){
|
||||||
bls.append(" " + p.getAttrName() + "= ");
|
bls.append(" ").append(p.getAttrName()).append("= ");
|
||||||
if(p.isString()){
|
if(p.isString()){
|
||||||
bls.append("\"" + getStringPropertyValue(p.getAttrName()) + "\"");
|
bls.append("\"").append(getStringPropertyValue(p.getAttrName())).append("\"");
|
||||||
} else if(p.isFloat()){
|
} else if(p.isFloat()){
|
||||||
bls.append(getFloatPropertyValue(p.getAttrName()));
|
bls.append(getFloatPropertyValue(p.getAttrName()));
|
||||||
} else if(p.isColor()){
|
} else if(p.isColor()){
|
||||||
|
@ -153,7 +153,7 @@ public class RenderingRule {
|
||||||
bls.append("]");
|
bls.append("]");
|
||||||
indent += " ";
|
indent += " ";
|
||||||
for(RenderingRule rc : getIfElseChildren()){
|
for(RenderingRule rc : getIfElseChildren()){
|
||||||
bls.append("\n"+indent);
|
bls.append("\n").append(indent);
|
||||||
rc.toString(indent, bls);
|
rc.toString(indent, bls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -544,10 +544,7 @@ public class BinaryRoutePlanner {
|
||||||
if(speed > ctx.getRouter().getMaxDefaultSpeed()) {
|
if(speed > ctx.getRouter().getMaxDefaultSpeed()) {
|
||||||
speed = ctx.getRouter().getMaxDefaultSpeed();
|
speed = ctx.getRouter().getMaxDefaultSpeed();
|
||||||
}
|
}
|
||||||
float distStartObstacles = obstaclesTime +
|
return obstaclesTime + distOnRoadToPass / speed;
|
||||||
distOnRoadToPass / speed;
|
|
||||||
return distStartObstacles;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private long calculateRoutePointId(final RouteDataObject road, int intervalId, boolean positive) {
|
private long calculateRoutePointId(final RouteDataObject road, int intervalId, boolean positive) {
|
||||||
|
|
|
@ -207,8 +207,7 @@ public class BinaryRoutePlannerOld {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static double h(RoutingContext ctx, double distToFinalPoint, RouteSegment next) {
|
protected static double h(RoutingContext ctx, double distToFinalPoint, RouteSegment next) {
|
||||||
double result = distToFinalPoint / ctx.getRouter().getMaxDefaultSpeed();
|
return distToFinalPoint / ctx.getRouter().getMaxDefaultSpeed();
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void println(String logMsg) {
|
private static void println(String logMsg) {
|
||||||
|
@ -530,8 +529,7 @@ public class BinaryRoutePlannerOld {
|
||||||
// already in queue remove it
|
// already in queue remove it
|
||||||
if (!graphSegments.remove(next)) {
|
if (!graphSegments.remove(next)) {
|
||||||
// exist in different queue!
|
// exist in different queue!
|
||||||
RouteSegment cpy = new RouteSegment(next.getRoad(), next.getSegmentStart());
|
next = new RouteSegment(next.getRoad(), next.getSegmentStart());
|
||||||
next = cpy;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
next.distanceFromStart = distFromStart;
|
next.distanceFromStart = distFromStart;
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class GeneralRouter extends VehicleRouter {
|
||||||
RouteTypeRule r = reg.quickGetEncodingRule(types[i]);
|
RouteTypeRule r = reg.quickGetEncodingRule(types[i]);
|
||||||
Float sp = highwaySpeed.get(r.getTag()+"$"+r.getValue());
|
Float sp = highwaySpeed.get(r.getTag()+"$"+r.getValue());
|
||||||
if(sp != null){
|
if(sp != null){
|
||||||
if(sp.floatValue() > 0) {
|
if(sp > 0) {
|
||||||
accepted = true;
|
accepted = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -336,7 +336,7 @@ public class NewGeneralRouter extends VehicleRouter {
|
||||||
boolean val = false;
|
boolean val = false;
|
||||||
if(defParams.containsKey(p)) {
|
if(defParams.containsKey(p)) {
|
||||||
RoutingParameter t = defParams.get(p);
|
RoutingParameter t = defParams.get(p);
|
||||||
val = t.type == RoutingParameterType.BOOLEAN && t.value != null && ((Boolean)t.value).booleanValue();
|
val = t.type == RoutingParameterType.BOOLEAN && t.value != null && (Boolean) t.value;
|
||||||
}
|
}
|
||||||
if(not && val){
|
if(not && val){
|
||||||
parameterValue = false;
|
parameterValue = false;
|
||||||
|
|
|
@ -213,15 +213,9 @@ public class RouteResultPreparation {
|
||||||
double startLon = start.getLongitude();
|
double startLon = start.getLongitude();
|
||||||
double endLat = end.getLatitude();
|
double endLat = end.getLatitude();
|
||||||
double endLon = end.getLongitude();
|
double endLon = end.getLongitude();
|
||||||
StringBuilder add = new StringBuilder();
|
println(MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{4}\" \n"
|
||||||
add.append("loadedTiles = \"").append(ctx.loadedTiles).append("\" ");
|
|
||||||
add.append("visitedSegments = \"").append(ctx.visitedSegments).append("\" ");
|
|
||||||
add.append("complete_distance = \"").append(completeDistance).append("\" ");
|
|
||||||
add.append("complete_time = \"").append(completeTime).append("\" ");
|
|
||||||
add.append("routing_time = \"").append(ctx.routingTime).append("\" ");
|
|
||||||
println(MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{4}\" \n"
|
|
||||||
+ " start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\" {5} >", startLat
|
+ " start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\" {5} >", startLat
|
||||||
+ "", startLon + "", endLat + "", endLon + "", ctx.config.routerName, add.toString()));
|
+ "", startLon + "", endLat + "", endLon + "", ctx.config.routerName, "loadedTiles = \"" + ctx.loadedTiles + "\" " + "visitedSegments = \"" + ctx.visitedSegments + "\" " + "complete_distance = \"" + completeDistance + "\" " + "complete_time = \"" + completeTime + "\" " + "routing_time = \"" + ctx.routingTime + "\" "));
|
||||||
if (PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST) {
|
if (PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST) {
|
||||||
for (RouteSegmentResult res : result) {
|
for (RouteSegmentResult res : result) {
|
||||||
String name = res.getObject().getName();
|
String name = res.getObject().getName();
|
||||||
|
|
|
@ -144,8 +144,7 @@ public class TestRouting {
|
||||||
public static void info() {
|
public static void info() {
|
||||||
println("Run router tests is console utility to test route calculation for osmand. It is also possible to calculate one route from -start to -end.");
|
println("Run router tests is console utility to test route calculation for osmand. It is also possible to calculate one route from -start to -end.");
|
||||||
println("\nUsage for run tests : runTestsSuite [-routingXmlPath=PATH] [-verbose] [-obfDir=PATH] [-start=lat;lon] [-end=lat;lon] [-testDir=PATH] {individualTestPath}");
|
println("\nUsage for run tests : runTestsSuite [-routingXmlPath=PATH] [-verbose] [-obfDir=PATH] [-start=lat;lon] [-end=lat;lon] [-testDir=PATH] {individualTestPath}");
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static void println(String string) {
|
private static void println(String string) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class Algorithms {
|
||||||
int ch4 = in.read();
|
int ch4 = in.read();
|
||||||
if ((ch1 | ch2 | ch3 | ch4) < 0)
|
if ((ch1 | ch2 | ch3 | ch4) < 0)
|
||||||
throw new EOFException();
|
throw new EOFException();
|
||||||
return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
|
return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + ch4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String capitalizeFirstLetterAndLowercase(String s) {
|
public static String capitalizeFirstLetterAndLowercase(String s) {
|
||||||
|
@ -162,7 +162,7 @@ public class Algorithms {
|
||||||
o = o << 8 | (0xff & bytes[offset + 3]);
|
o = o << 8 | (0xff & bytes[offset + 3]);
|
||||||
o = o << 8 | (0xff & bytes[offset + 2]);
|
o = o << 8 | (0xff & bytes[offset + 2]);
|
||||||
o = o << 8 | (0xff & bytes[offset + 1]);
|
o = o << 8 | (0xff & bytes[offset + 1]);
|
||||||
o = o << 8 | (0xff & bytes[offset + 0]);
|
o = o << 8 | (0xff & bytes[offset]);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ public class Algorithms {
|
||||||
int o = (0xff & bytes[offset + 3]) << 24;
|
int o = (0xff & bytes[offset + 3]) << 24;
|
||||||
o |= (0xff & bytes[offset + 2]) << 16;
|
o |= (0xff & bytes[offset + 2]) << 16;
|
||||||
o |= (0xff & bytes[offset + 1]) << 8;
|
o |= (0xff & bytes[offset + 1]) << 8;
|
||||||
o |= (0xff & bytes[offset + 0]);
|
o |= (0xff & bytes[offset]);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ public class Algorithms {
|
||||||
|
|
||||||
public static int parseSmallIntFromBytes(byte[] bytes, int offset) {
|
public static int parseSmallIntFromBytes(byte[] bytes, int offset) {
|
||||||
int s = (0xff & bytes[offset + 1]) << 8;
|
int s = (0xff & bytes[offset + 1]) << 8;
|
||||||
s |= (0xff & bytes[offset + 0]);
|
s |= (0xff & bytes[offset]);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,7 @@ public class MapUtils {
|
||||||
|
|
||||||
private static double scalarMultiplication(double xA, double yA, double xB, double yB, double xC, double yC) {
|
private static double scalarMultiplication(double xA, double yA, double xB, double yB, double xC, double yC) {
|
||||||
// Scalar multiplication between (AB, AC)
|
// Scalar multiplication between (AB, AC)
|
||||||
double multiple = (xB - xA) * (xC - xA) + (yB- yA) * (yC -yA);
|
return (xB - xA) * (xC - xA) + (yB- yA) * (yC -yA);
|
||||||
return multiple;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getOrthogonalDistance(double lat, double lon, double fromLat, double fromLon, double toLat, double toLon) {
|
public static double getOrthogonalDistance(double lat, double lon, double fromLat, double fromLon, double toLat, double toLon) {
|
||||||
|
@ -85,8 +84,7 @@ public class MapUtils {
|
||||||
//double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
|
//double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
|
||||||
//return R * c * 1000;
|
//return R * c * 1000;
|
||||||
// simplyfy haversine:
|
// simplyfy haversine:
|
||||||
double c = 2 * R * 1000 * Math.asin(Math.sqrt(a));
|
return (2 * R * 1000 * Math.asin(Math.sqrt(a)));
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,8 +169,7 @@ public class MapUtils {
|
||||||
latitude = latitude < 0 ? - 89.9 : 89.9;
|
latitude = latitude < 0 ? - 89.9 : 89.9;
|
||||||
eval = Math.log( Math.tan(toRadians(latitude)) + 1/Math.cos(toRadians(latitude)) );
|
eval = Math.log( Math.tan(toRadians(latitude)) + 1/Math.cos(toRadians(latitude)) );
|
||||||
}
|
}
|
||||||
double result = (1 - eval / Math.PI) / 2 * getPowZoom(zoom);
|
return (1 - eval / Math.PI) / 2 * getPowZoom(zoom);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getTileEllipsoidNumberY(float zoom, double latitude){
|
public static double getTileEllipsoidNumberY(float zoom, double latitude){
|
||||||
|
@ -238,8 +235,7 @@ public class MapUtils {
|
||||||
|
|
||||||
public static double getLatitudeFromTile(float zoom, double y){
|
public static double getLatitudeFromTile(float zoom, double y){
|
||||||
int sign = y < 0 ? -1 : 1;
|
int sign = y < 0 ? -1 : 1;
|
||||||
double result = Math.atan(sign*Math.sinh(Math.PI * (1 - 2 * y / getPowZoom(zoom)))) * 180d / Math.PI;
|
return Math.atan(sign*Math.sinh(Math.PI * (1 - 2 * y / getPowZoom(zoom)))) * 180d / Math.PI;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -270,11 +266,7 @@ public class MapUtils {
|
||||||
// System.out.println(buildShortOsmUrl(52.30103d, 4.862927d, 18)); // http://osm.org/go/0E4_JiVhs
|
// System.out.println(buildShortOsmUrl(52.30103d, 4.862927d, 18)); // http://osm.org/go/0E4_JiVhs
|
||||||
// System.out.println(buildShortOsmUrl(40.59d, -115.213d, 9)); // http://osm.org/go/TelHTB--
|
// System.out.println(buildShortOsmUrl(40.59d, -115.213d, 9)); // http://osm.org/go/TelHTB--
|
||||||
public static String buildShortOsmUrl(double latitude, double longitude, int zoom){
|
public static String buildShortOsmUrl(double latitude, double longitude, int zoom){
|
||||||
StringBuilder str = new StringBuilder(10);
|
return BASE_SHORT_OSM_URL + createShortLocString(latitude, longitude, zoom) + "?m";
|
||||||
str.append(BASE_SHORT_OSM_URL);
|
|
||||||
str.append(createShortLocString(latitude, longitude, zoom));
|
|
||||||
str.append("?m");
|
|
||||||
return str.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createShortLocString(double latitude, double longitude, int zoom) {
|
public static String createShortLocString(double latitude, double longitude, int zoom) {
|
||||||
|
|
|
@ -477,8 +477,7 @@ public class OpeningHoursParser {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(Character.isWhitespace(ch) || ch == ','){
|
if(Character.isWhitespace(ch) || ch == ','){
|
||||||
continue;
|
} else if (ch == '-') {
|
||||||
} else if (ch == '-') {
|
|
||||||
if(previousDay != -1){
|
if(previousDay != -1){
|
||||||
startDay = previousDay;
|
startDay = previousDay;
|
||||||
} else if (previousMonth != -1) {
|
} else if (previousMonth != -1) {
|
||||||
|
|
Loading…
Reference in a new issue