removed unused methods

This commit is contained in:
simon 2020-12-15 15:19:45 +02:00
parent 203934cc1d
commit c7dddc3f23
2 changed files with 25 additions and 60 deletions

View file

@ -803,27 +803,10 @@ public class ResourceManager {
private void collectTravelFiles(BinaryMapIndexReader mapReader, BinaryMapReaderResource resource) { private void collectTravelFiles(BinaryMapIndexReader mapReader, BinaryMapReaderResource resource) {
BinaryMapIndexReader index = mapReader; BinaryMapIndexReader index = mapReader;
for (BinaryIndexPart p : index.getIndexes()) { for (BinaryIndexPart p : index.getPoiIndexes()) {
if (p instanceof BinaryMapPoiReaderAdapter.PoiRegion) { travelRepositories.put(index.getFile().getName(), resource);
transportRepositories.put(index.getFile().getName(), resource);
} }
} }
}
private List<BinaryMapIndexReader> getTravelRepositories(double topLat, double leftLon, double bottomLat, double rightLon) {
List<String> fileNames = new ArrayList<>(travelRepositories.keySet());
Collections.sort(fileNames, Algorithms.getStringVersionComparator());
List<BinaryMapIndexReader> res = new ArrayList<>();
for (String fileName : fileNames) {
BinaryMapReaderResource r = travelRepositories.get(fileName);
if (r != null && r.isUseForPublicTransport() &&
r.getShallowReader().containTransportData(topLat, leftLon, bottomLat, rightLon)) {
res.add(r.getReader(BinaryMapReaderResourceType.POI));
}
}
return res;
}
public void initMapBoundariesCacheNative() { public void initMapBoundariesCacheNative() {
File indCache = context.getAppPath(INDEXES_CACHE); File indCache = context.getAppPath(INDEXES_CACHE);
@ -1115,24 +1098,6 @@ public class ResourceManager {
fileReaders.clear(); fileReaders.clear();
} }
public List<BinaryMapIndexReader> getTravelFiles() {
Collection<BinaryMapReaderResource> fileReaders = getFileReaders();
List<BinaryMapIndexReader> readers = new ArrayList<>(fileReaders.size());
for (BinaryMapReaderResource res : fileReaders) {
if (!res.filename.toString().toLowerCase()
.contains(IndexConstants.BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT)) {
continue;
}
BinaryMapIndexReader index = res.getReader(BinaryMapReaderResourceType.POI);
for (BinaryIndexPart p : index.getIndexes()) {
if (p instanceof BinaryMapPoiReaderAdapter.PoiRegion) {
readers.add(index);
}
}
}
return readers;
}
public BinaryMapIndexReader[] getRoutingMapFiles() { public BinaryMapIndexReader[] getRoutingMapFiles() {
Collection<BinaryMapReaderResource> fileReaders = getFileReaders(); Collection<BinaryMapReaderResource> fileReaders = getFileReaders();
List<BinaryMapIndexReader> readers = new ArrayList<>(fileReaders.size()); List<BinaryMapIndexReader> readers = new ArrayList<>(fileReaders.size());

View file

@ -69,30 +69,30 @@ public class TravelObfHelper implements TravelHelper {
@NonNull @NonNull
public List<WikivoyageSearchResult> search(final String searchQuery) { public List<WikivoyageSearchResult> search(final String searchQuery) {
// TODO remove // TODO remove
this.files = application.getResourceManager().getTravelFiles(); //this.files = application.getResourceManager().getTravelFiles();
List<WikivoyageSearchResult> res = new ArrayList<>(); List<WikivoyageSearchResult> res = new ArrayList<>();
List<Amenity> searchObjects = new ArrayList<>(); // List<Amenity> searchObjects = new ArrayList<>();
for (BinaryMapIndexReader reader : files) { // for (BinaryMapIndexReader reader : files) {
try { // try {
BinaryMapIndexReader.SearchRequest<Amenity> searchRequest = BinaryMapIndexReader. // BinaryMapIndexReader.SearchRequest<Amenity> searchRequest = BinaryMapIndexReader.
buildSearchPoiRequest(0, 0, searchQuery, // buildSearchPoiRequest(0, 0, searchQuery,
0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, null); // 0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, null);
//
searchObjects = reader.searchPoiByName(searchRequest); // searchObjects = reader.searchPoiByName(searchRequest);
} catch (IOException e) { // } catch (IOException e) {
LOG.error(e); // LOG.error(e);
} // }
} // }
for (MapObject obj : searchObjects) { // for (MapObject obj : searchObjects) {
//TODO map // //TODO map
WikivoyageSearchResult r = new WikivoyageSearchResult(); // WikivoyageSearchResult r = new WikivoyageSearchResult();
r.articleTitles = Collections.singletonList(obj.getName()); // r.articleTitles = Collections.singletonList(obj.getName());
r.langs = Collections.singletonList(obj.getName()); // r.langs = Collections.singletonList(obj.getName());
r.imageTitle = (obj.getName()); // r.imageTitle = (obj.getName());
r.isPartOf = Collections.singletonList(obj.getName()); // r.isPartOf = Collections.singletonList(obj.getName());
r.routeId = "routeid";//obj.getId(); // r.routeId = "routeid";//obj.getId();
res.add(r); // res.add(r);
} // }
return res; return res;
} }