Fix routing

This commit is contained in:
Victor Shcherb 2020-06-24 11:16:19 +02:00
parent 3030c73f8a
commit c820fa3033
2 changed files with 34 additions and 28 deletions

View file

@ -1,9 +1,25 @@
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.InvalidProtocolBufferException;
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.ResultMatcher;
import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
@ -18,24 +34,6 @@ import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
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 {
protected static final Log LOG = PlatformUtil.getLog(BinaryMapRouteReaderAdapter.class);
private static final int SHIFT_COORDINATES = 4;

View file

@ -532,25 +532,33 @@ public class GeneralRouter implements VehicleRouter {
}
class IntHolder {
private final int[] array;
private final int[] array;
private final boolean extra;
IntHolder(int[] ts, boolean extra) {
array = ts;
this.extra = extra;
}
@Override public int hashCode() { return Arrays.hashCode(array) + (extra ? 1 : 0) ; }
@Override public boolean equals(Object other) {
if (array == other) { return true; }
if (! (other instanceof IntHolder) ) {
return false;
}
@Override
public int hashCode() {
return Arrays.hashCode(array) + (extra ? 1 : 0);
}
@Override
public boolean equals(Object other) {
if (array == other) {
return true;
}
if (!(other instanceof IntHolder)) {
return false;
}
if (((IntHolder) other).extra != this.extra) {
return false;
}
//noinspection unchecked
return Arrays.equals(array, ((IntHolder) other).array);
}
// noinspection unchecked
return Arrays.equals(array, ((IntHolder) other).array);
}
}
private Float getCache(RouteDataObjectAttribute attr, RouteDataObject road) {