use of net.osmand.binary.MapZooms.MapZoomPair in project OsmAnd-tools by osmandapp.
the class ObfRegionSplitter method splitRegionMapData.
private Map<String, Map<MapZoomPair, TLongObjectHashMap<BinaryMapDataObject>>> splitRegionMapData(ObfFileInMemory allMapObjects, OsmandRegions osmandRegions) throws IOException {
Map<String, Map<MapZoomPair, TLongObjectHashMap<BinaryMapDataObject>>> result = new HashMap<>();
for (MapZoomPair p : allMapObjects.getZooms()) {
TLongObjectHashMap<BinaryMapDataObject> objects = allMapObjects.get(p);
for (BinaryMapDataObject obj : objects.valueCollection()) {
int x = obj.getPoint31XTile(0);
int y = obj.getPoint31YTile(0);
List<BinaryMapDataObject> l = osmandRegions.query(x, y);
for (BinaryMapDataObject b : l) {
if (osmandRegions.contain(b, x, y)) {
String dw = osmandRegions.getDownloadName(b);
WorldRegion wr = osmandRegions.getRegionDataByDownloadName(dw);
if (dw == null || wr == null) {
continue;
}
if (!Algorithms.isEmpty(dw) && wr.isRegionMapDownload()) {
Map<MapZoomPair, TLongObjectHashMap<BinaryMapDataObject>> mp = result.get(dw);
if (mp == null) {
mp = new LinkedHashMap<>();
result.put(dw, mp);
}
TLongObjectHashMap<BinaryMapDataObject> list = mp.get(p);
if (list == null) {
list = new TLongObjectHashMap<>();
mp.put(p, list);
}
list.put(obj.getId(), obj);
}
}
}
}
}
return result;
}
Aggregations