Fix routing
This commit is contained in:
parent
3030c73f8a
commit
c820fa3033
2 changed files with 34 additions and 28 deletions
|
@ -1,9 +1,25 @@
|
||||||
package net.osmand.binary;
|
package net.osmand.binary;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import com.google.protobuf.CodedInputStream;
|
import com.google.protobuf.CodedInputStream;
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
import com.google.protobuf.InvalidProtocolBufferException;
|
||||||
import com.google.protobuf.WireFormat;
|
import com.google.protobuf.WireFormat;
|
||||||
|
|
||||||
|
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 net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.ResultMatcher;
|
import net.osmand.ResultMatcher;
|
||||||
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
|
||||||
|
@ -18,24 +34,6 @@ import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
import net.osmand.util.OpeningHoursParser;
|
import net.osmand.util.OpeningHoursParser;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
public class BinaryMapRouteReaderAdapter {
|
public class BinaryMapRouteReaderAdapter {
|
||||||
protected static final Log LOG = PlatformUtil.getLog(BinaryMapRouteReaderAdapter.class);
|
protected static final Log LOG = PlatformUtil.getLog(BinaryMapRouteReaderAdapter.class);
|
||||||
private static final int SHIFT_COORDINATES = 4;
|
private static final int SHIFT_COORDINATES = 4;
|
||||||
|
|
|
@ -532,25 +532,33 @@ public class GeneralRouter implements VehicleRouter {
|
||||||
}
|
}
|
||||||
|
|
||||||
class IntHolder {
|
class IntHolder {
|
||||||
private final int[] array;
|
private final int[] array;
|
||||||
private final boolean extra;
|
private final boolean extra;
|
||||||
|
|
||||||
IntHolder(int[] ts, boolean extra) {
|
IntHolder(int[] ts, boolean extra) {
|
||||||
array = ts;
|
array = ts;
|
||||||
this.extra = extra;
|
this.extra = extra;
|
||||||
}
|
}
|
||||||
@Override public int hashCode() { return Arrays.hashCode(array) + (extra ? 1 : 0) ; }
|
|
||||||
@Override public boolean equals(Object other) {
|
@Override
|
||||||
if (array == other) { return true; }
|
public int hashCode() {
|
||||||
if (! (other instanceof IntHolder) ) {
|
return Arrays.hashCode(array) + (extra ? 1 : 0);
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (array == other) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(other instanceof IntHolder)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (((IntHolder) other).extra != this.extra) {
|
if (((IntHolder) other).extra != this.extra) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//noinspection unchecked
|
// noinspection unchecked
|
||||||
return Arrays.equals(array, ((IntHolder) other).array);
|
return Arrays.equals(array, ((IntHolder) other).array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Float getCache(RouteDataObjectAttribute attr, RouteDataObject road) {
|
private Float getCache(RouteDataObjectAttribute attr, RouteDataObject road) {
|
||||||
|
|
Loading…
Reference in a new issue