Improve regions layer

This commit is contained in:
Victor Shcherb 2015-11-22 20:54:36 +03:00
parent 404bf0e805
commit bfbd0ff810

View file

@ -493,18 +493,15 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
Iterator<BinaryMapDataObject> it = result.iterator(); Iterator<BinaryMapDataObject> it = result.iterator();
while (it.hasNext()) { while (it.hasNext()) {
BinaryMapDataObject o = it.next(); BinaryMapDataObject o = it.next();
if (!osmandRegions.isDownloadOfType(o, OsmandRegions.MAP_TYPE) || !osmandRegions.contain(o, point31x, point31y)) { if (!osmandRegions.contain(o, point31x, point31y) ) {
it.remove(); it.remove();
} }
} }
selectedObjects = result;
OsmandRegions osmandRegions = app.getRegions(); OsmandRegions osmandRegions = app.getRegions();
for (BinaryMapDataObject o : result) { for (BinaryMapDataObject o : result) {
String fullName = osmandRegions.getFullName(o); String fullName = osmandRegions.getFullName(o);
WorldRegion region = osmandRegions.getRegionData(fullName); WorldRegion region = osmandRegions.getRegionData(fullName);
if (region != null) { if (region != null && region.isRegionMapDownload()) {
List<IndexItem> indexItems = app.getDownloadThread().getIndexes().getIndexItems(region); List<IndexItem> indexItems = app.getDownloadThread().getIndexes().getIndexItems(region);
List<IndexItem> dataItems = new LinkedList<>(); List<IndexItem> dataItems = new LinkedList<>();
IndexItem regularMapItem = null; IndexItem regularMapItem = null;
@ -550,9 +547,6 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
if (o instanceof DownloadMapObject) { if (o instanceof DownloadMapObject) {
DownloadMapObject mapObject = ((DownloadMapObject) o); DownloadMapObject mapObject = ((DownloadMapObject) o);
List<BinaryMapDataObject> list = new LinkedList<>(); List<BinaryMapDataObject> list = new LinkedList<>();
if (selectedObjects. size() > 0) {
list.addAll(selectedObjects);
}
list.add(mapObject.dataObject); list.add(mapObject.dataObject);
selectedObjects = list; selectedObjects = list;
} }