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) {
BinaryMapIndexReader index = mapReader;
for (BinaryIndexPart p : index.getIndexes()) {
if (p instanceof BinaryMapPoiReaderAdapter.PoiRegion) {
transportRepositories.put(index.getFile().getName(), resource);
for (BinaryIndexPart p : index.getPoiIndexes()) {
travelRepositories.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() {
File indCache = context.getAppPath(INDEXES_CACHE);
@ -1115,24 +1098,6 @@ public class ResourceManager {
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() {
Collection<BinaryMapReaderResource> fileReaders = getFileReaders();
List<BinaryMapIndexReader> readers = new ArrayList<>(fileReaders.size());

View file

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