diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml
index 8a8de225de..9f362ca1a4 100644
--- a/OsmAnd/res/values-ru/strings.xml
+++ b/OsmAnd/res/values-ru/strings.xml
@@ -1,4 +1,5 @@
-
+
+
Скрыть планируемые объекты
Использовать безопасное подключение к серверу
Использовать HTTPS
@@ -1969,4 +1970,5 @@
Прочее
Плагины
Легенда
-
\ No newline at end of file
+ Обновить
+
diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml
index f48bcb55a1..f43b2d81bc 100644
--- a/OsmAnd/res/values-zh-rTW/strings.xml
+++ b/OsmAnd/res/values-zh-rTW/strings.xml
@@ -1965,4 +1965,5 @@
更新
-
\ No newline at end of file
+ 隱藏已提出的物件
+
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index 9b7e9a86e4..d726606822 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -61,9 +61,11 @@ import net.osmand.plus.base.FailSafeFuntions;
import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.dialogs.WhatsNewDialogFragment;
+import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.helpers.GpxImportHelper;
import net.osmand.plus.helpers.WakeLockHelper;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
+import net.osmand.plus.mapcontextmenu.MapContextMenuFragment;
import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor;
import net.osmand.plus.mapcontextmenu.editors.PointEditor;
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
@@ -91,7 +93,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class MapActivity extends AccessibleActivity {
+public class MapActivity extends AccessibleActivity implements DownloadEvents {
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
private static final int LONG_KEYPRESS_DELAY = 500;
@@ -480,11 +482,16 @@ public class MapActivity extends AccessibleActivity {
app.getResourceManager().setBusyIndicator(new BusyIndicator(this, progress));
}
+ getMapLayers().getDownloadedRegionsLayer().updateObjects();
+
OsmandPlugin.onMapActivityResume(this);
mapView.refreshMap(true);
if (atlasMapRendererView != null) {
atlasMapRendererView.handleOnResume();
}
+
+ app.getDownloadThread().setUiActivity(this);
+
getMyApplication().getAppCustomization().resumeActivity(MapActivity.class, this);
if (System.currentTimeMillis() - tm > 50) {
System.err.println("OnCreate for MapActivity took " + (System.currentTimeMillis() - tm) + " ms");
@@ -710,6 +717,7 @@ public class MapActivity extends AccessibleActivity {
@Override
protected void onPause() {
+ app.getDownloadThread().resetUiActivity(this);
if (atlasMapRendererView != null) {
atlasMapRendererView.handleOnPause();
}
@@ -1021,4 +1029,38 @@ public class MapActivity extends AccessibleActivity {
openDrawer();
}
}
+
+ // DownloadEvents
+ @Override
+ public void newDownloadIndexes() {
+ MapContextMenuFragment contextMenuFragment = getContextMenu().findMenuFragment();
+ if (contextMenuFragment != null) {
+ contextMenuFragment.newDownloadIndexes();
+ }
+ if (getMapLayers().getDownloadedRegionsLayer().updateObjects()) {
+ refreshMap();
+ }
+ }
+
+ @Override
+ public void downloadInProgress() {
+ MapContextMenuFragment contextMenuFragment = getContextMenu().findMenuFragment();
+ if (contextMenuFragment != null) {
+ contextMenuFragment.downloadInProgress();
+ }
+ if (getMapLayers().getDownloadedRegionsLayer().updateObjects()) {
+ refreshMap();
+ }
+ }
+
+ @Override
+ public void downloadHasFinished() {
+ MapContextMenuFragment contextMenuFragment = getContextMenu().findMenuFragment();
+ if (contextMenuFragment != null) {
+ contextMenuFragment.downloadHasFinished();
+ }
+ if (getMapLayers().getDownloadedRegionsLayer().updateObjects()) {
+ refreshMap();
+ }
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java
index cfb0d70bbc..d5cbea1cf5 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java
@@ -466,5 +466,8 @@ public class MapActivityLayers {
public TransportInfoLayer getTransportInfoLayer() {
return transportInfoLayer;
}
-
+
+ public DownloadedRegionsLayer getDownloadedRegionsLayer() {
+ return downloadedRegionsLayer;
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
index c24d64f699..799e2b8e59 100644
--- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java
@@ -232,12 +232,11 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
String desc = getDescriptionName(fileName);
if (desc != null) {
return desc;
- } else if (this.isAudio()) {
- return ctx.getString(R.string.shared_string_audio) + " " + formatDateTime(ctx, file.lastModified());
+ return formatDateTime(ctx, file.lastModified());
} else if (this.isVideo()) {
- return ctx.getString(R.string.shared_string_video) + " " + formatDateTime(ctx, file.lastModified());
+ return formatDateTime(ctx, file.lastModified());
} else if (this.isPhoto()) {
- return ctx.getString(R.string.shared_string_photo) + " " + formatDateTime(ctx, file.lastModified());
+ return formatDateTime(ctx, file.lastModified());
}
return "";
}
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadResources.java b/OsmAnd/src/net/osmand/plus/download/DownloadResources.java
index dcb2de9ecc..801317e71d 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadResources.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadResources.java
@@ -24,6 +24,7 @@ public class DownloadResources extends DownloadResourceGroup {
private Map indexFileNames = new LinkedHashMap<>();
private Map indexActivatedFileNames = new LinkedHashMap<>();
private List rawResources;
+ private Map > groupByRegion;
private List itemsToUpdate = new ArrayList<>();
public static final String WORLD_SEAMARKS_KEY = "world_seamarks_basemap";
@@ -67,17 +68,14 @@ public class DownloadResources extends DownloadResourceGroup {
return res;
}
- public List getIndexItems(String fileNamePrefix) {
- List res = new LinkedList<>();
- if (rawResources == null) {
- return res;
- }
- for (IndexItem item : rawResources) {
- if (item.getFileName().toLowerCase().startsWith(fileNamePrefix)) {
- res.add(item);
+ public List getIndexItems(WorldRegion region) {
+ if (groupByRegion != null) {
+ List res = groupByRegion.get(region);
+ if (res != null) {
+ return res;
}
}
- return res;
+ return new LinkedList<>();
}
public void updateLoadedFiles() {
@@ -276,6 +274,8 @@ public class DownloadResources extends DownloadResourceGroup {
}
}
}
+ this.groupByRegion = groupByRegion;
+
LinkedList queue = new LinkedList();
LinkedList parent = new LinkedList();
DownloadResourceGroup worldSubregions = new DownloadResourceGroup(this, DownloadResourceGroupType.SUBREGIONS);
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
index 6e2cd192c3..d06fa1e907 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
@@ -550,18 +550,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
}
}
- @Override
- public void onResume() {
- super.onResume();
- getMyApplication().getDownloadThread().setUiActivity(this);
- }
-
- @Override
- public void onPause() {
- super.onPause();
- getMyApplication().getDownloadThread().resetUiActivity(this);
- }
-
@Override
public void onDestroyView() {
super.onDestroyView();
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java
index 7d360daab8..64b915e4ff 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java
@@ -23,6 +23,8 @@ import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.util.Algorithms;
import java.io.File;
+import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
public class MapDataMenuController extends MenuController {
@@ -146,11 +148,13 @@ public class MapDataMenuController extends MenuController {
@Override
public void updateData() {
if (indexItem == null) {
- otherIndexItems = downloadThread.getIndexes().getIndexItems(region.getRegionDownloadNameLC());
- for (IndexItem i : otherIndexItems) {
+ otherIndexItems = new LinkedList<>(downloadThread.getIndexes().getIndexItems(region));
+ Iterator it = otherIndexItems.iterator();
+ while (it.hasNext()) {
+ IndexItem i = it.next();
if (i.getType() == DownloadActivityType.NORMAL_FILE) {
indexItem = i;
- otherIndexItems.remove(i);
+ it.remove();
break;
}
}
@@ -226,6 +230,7 @@ public class MapDataMenuController extends MenuController {
}
protected void onPostExecute(Void result) {
+ getMapActivity().getMapLayers().getDownloadedRegionsLayer().updateObjects();
getMapActivity().refreshMap();
}
diff --git a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java
index 6dba8d4bfd..9583928b3f 100644
--- a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java
@@ -20,7 +20,10 @@ import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox;
import net.osmand.map.OsmandRegions;
import net.osmand.map.WorldRegion;
+import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
+import net.osmand.plus.download.DownloadActivityType;
+import net.osmand.plus.download.IndexItem;
import net.osmand.plus.resources.ResourceManager;
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProviderSelection;
@@ -39,44 +42,45 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
private static final int ZOOM_THRESHOLD = 2;
+ private OsmandApplication app;
private OsmandMapTileView view;
- private Paint paint;
+ private Paint paintDownloaded;
+ private Path pathDownloaded;
private Paint paintSelected;
- private Path path;
private Path pathSelected;
+ private Paint paintDownloading;
+ private Path pathDownloading;
+ private Paint paintOutdated;
+ private Path pathOutdated;
private OsmandRegions osmandRegions;
-
private TextPaint textPaint;
private ResourceManager rm;
private MapLayerData> data;
- private List selectedObjects;
+ private List outdatedObjects = new LinkedList<>();
+ private List downloadingObjects = new LinkedList<>();
+ private List selectedObjects = new LinkedList<>();
private static int ZOOM_TO_SHOW_MAP_NAMES = 6;
private static int ZOOM_AFTER_BASEMAP = 12;
+ private static int ZOOM_TO_SHOW_BORDERS_ST = 5;
+ private static int ZOOM_TO_SHOW_BORDERS = 7;
+ private static int ZOOM_TO_SHOW_SELECTION_ST = 3;
+ private static int ZOOM_TO_SHOW_SELECTION = 10;
+
@Override
public void initLayer(final OsmandMapTileView view) {
this.view = view;
- rm = view.getApplication().getResourceManager();
+ app = view.getApplication();
+ rm = app.getResourceManager();
osmandRegions = rm.getOsmandRegions();
- paint = new Paint();
- paint.setStyle(Style.FILL_AND_STROKE);
- paint.setStrokeWidth(1);
- paint.setColor(Color.argb(100, 50, 200, 50));
- paint.setAntiAlias(true);
- paint.setStrokeCap(Cap.ROUND);
- paint.setStrokeJoin(Join.ROUND);
-
- paintSelected = new Paint();
- paintSelected.setStyle(Style.FILL_AND_STROKE);
- paintSelected.setStrokeWidth(1);
- paintSelected.setColor(Color.argb(100, 255, 143, 0));
- paintSelected.setAntiAlias(true);
- paintSelected.setStrokeCap(Cap.ROUND);
- paintSelected.setStrokeJoin(Join.ROUND);
+ paintDownloaded = getPaint(Color.argb(100, 50, 200, 50));
+ paintSelected = getPaint(Color.argb(100, 255, 143, 0));
+ paintDownloading = getPaint(Color.argb(40, 50, 200, 50));
+ paintOutdated = getPaint(Color.argb(100, 0, 128, 255));
textPaint = new TextPaint();
final WindowManager wmgr = (WindowManager) view.getApplication().getSystemService(Context.WINDOW_SERVICE);
@@ -86,8 +90,11 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
textPaint.setAntiAlias(true);
textPaint.setTextAlign(Paint.Align.CENTER);
- path = new Path();
+ pathDownloaded = new Path();
pathSelected = new Path();
+ pathDownloading = new Path();
+ pathOutdated = new Path();
+
data = new MapLayerData>() {
@Override
@@ -96,9 +103,9 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
}
public boolean queriedBoxContains(final RotatedTileBox queriedData, final RotatedTileBox newBox) {
- if (newBox.getZoom() < ZOOM_TO_SHOW_BORDERS) {
- if (queriedData != null && queriedData.getZoom() < ZOOM_TO_SHOW_BORDERS) {
- return queriedData != null && queriedData.containsTileBox(newBox);
+ if (newBox.getZoom() < ZOOM_TO_SHOW_SELECTION) {
+ if (queriedData != null && queriedData.getZoom() < ZOOM_TO_SHOW_SELECTION) {
+ return queriedData.containsTileBox(newBox);
} else {
return false;
}
@@ -121,10 +128,17 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
};
}
- private static int ZOOM_TO_SHOW_BORDERS_ST = 5;
- private static int ZOOM_TO_SHOW_BORDERS = 7;
- private static int ZOOM_TO_SHOW_SELECTION_ST = 3;
- private static int ZOOM_TO_SHOW_SELECTION = 10;
+
+ private Paint getPaint(int color) {
+ Paint paint = new Paint();
+ paint.setStyle(Style.FILL_AND_STROKE);
+ paint.setStrokeWidth(1);
+ paint.setColor(color);
+ paint.setAntiAlias(true);
+ paint.setStrokeCap(Cap.ROUND);
+ paint.setStrokeJoin(Join.ROUND);
+ return paint;
+ }
@Override
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
@@ -133,47 +147,62 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
return;
}
// draw objects
- final List currentObjects = data.results;
- if (zoom >= ZOOM_TO_SHOW_BORDERS_ST && zoom < ZOOM_TO_SHOW_BORDERS && osmandRegions.isInitialized() &&
- currentObjects != null) {
- path.reset();
- for (BinaryMapDataObject o : currentObjects) {
- String downloadName = osmandRegions.getDownloadName(o);
- boolean downloaded = checkIfObjectDownloaded(downloadName);
- if (!downloaded) {
- continue;
- }
- double lat = MapUtils.get31LatitudeY(o.getPoint31YTile(0));
- double lon = MapUtils.get31LongitudeX(o.getPoint31XTile(0));
- path.moveTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat));
- for (int j = 1; j < o.getPointsLength(); j++) {
- lat = MapUtils.get31LatitudeY(o.getPoint31YTile(j));
- lon = MapUtils.get31LongitudeX(o.getPoint31XTile(j));
- path.lineTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat));
- }
+ if (osmandRegions.isInitialized() && zoom >= ZOOM_TO_SHOW_SELECTION_ST && zoom < ZOOM_TO_SHOW_SELECTION) {
+ final List currentObjects = new LinkedList<>();
+ if (data.results != null) {
+ currentObjects.addAll(data.results);
}
- canvas.drawPath(path, paint);
- }
+ final List downloadingObjects = new LinkedList<>(this.downloadingObjects);
+ final List outdatedObjects = new LinkedList<>(this.outdatedObjects);
+ final List selectedObjects = new LinkedList<>(this.selectedObjects);
- final List selectedObjects = this.selectedObjects;
- if (zoom >= ZOOM_TO_SHOW_SELECTION_ST && zoom < ZOOM_TO_SHOW_SELECTION && osmandRegions.isInitialized() &&
- selectedObjects != null) {
- pathSelected.reset();
- for (BinaryMapDataObject o : selectedObjects) {
- double lat = MapUtils.get31LatitudeY(o.getPoint31YTile(0));
- double lon = MapUtils.get31LongitudeX(o.getPoint31XTile(0));
- pathSelected.moveTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat));
- for (int j = 1; j < o.getPointsLength(); j++) {
- lat = MapUtils.get31LatitudeY(o.getPoint31YTile(j));
- lon = MapUtils.get31LongitudeX(o.getPoint31XTile(j));
- pathSelected.lineTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat));
+ if (selectedObjects.size() > 0) {
+ currentObjects.removeAll(selectedObjects);
+ drawBorders(canvas, tileBox, selectedObjects, pathSelected, paintSelected);
+ }
+
+ if (zoom >= ZOOM_TO_SHOW_BORDERS_ST && zoom < ZOOM_TO_SHOW_BORDERS) {
+ downloadingObjects.removeAll(selectedObjects);
+ if (downloadingObjects.size() > 0) {
+ currentObjects.removeAll(downloadingObjects);
+ drawBorders(canvas, tileBox, downloadingObjects, pathDownloading, paintDownloading);
+ }
+ outdatedObjects.removeAll(selectedObjects);
+ if (outdatedObjects.size() > 0) {
+ currentObjects.removeAll(outdatedObjects);
+ drawBorders(canvas, tileBox, outdatedObjects, pathOutdated, paintOutdated);
+ }
+ if (currentObjects.size() > 0) {
+ Iterator it = currentObjects.iterator();
+ while (it.hasNext()) {
+ BinaryMapDataObject o = it.next();
+ boolean downloaded = checkIfObjectDownloaded(osmandRegions.getDownloadName(o));
+ if (!downloaded) {
+ it.remove();
+ }
+ }
+ if (currentObjects.size() > 0) {
+ drawBorders(canvas, tileBox, currentObjects, pathDownloaded, paintDownloaded);
+ }
}
}
- canvas.drawPath(pathSelected, paintSelected);
}
}
-
+ private void drawBorders(Canvas canvas, RotatedTileBox tileBox, final List objects, Path path, Paint paint) {
+ path.reset();
+ for (BinaryMapDataObject o : objects) {
+ double lat = MapUtils.get31LatitudeY(o.getPoint31YTile(0));
+ double lon = MapUtils.get31LongitudeX(o.getPoint31XTile(0));
+ path.moveTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat));
+ for (int j = 1; j < o.getPointsLength(); j++) {
+ lat = MapUtils.get31LatitudeY(o.getPoint31YTile(j));
+ lon = MapUtils.get31LongitudeX(o.getPoint31XTile(j));
+ path.lineTo(tileBox.getPixXFromLonNoRot(lon), tileBox.getPixYFromLatNoRot(lat));
+ }
+ }
+ canvas.drawPath(path, paint);
+ }
private boolean checkIfObjectDownloaded(String downloadName) {
final String regionName = Algorithms.capitalizeFirstLetterAndLowercase(downloadName)
@@ -208,21 +237,62 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
} catch (IOException e) {
return result;
}
+
Iterator it = result.iterator();
while (it.hasNext()) {
BinaryMapDataObject o = it.next();
- if (tileBox.getZoom() < ZOOM_TO_SHOW_BORDERS) {
+ if (tileBox.getZoom() < ZOOM_TO_SHOW_SELECTION) {
//
} else {
if (!osmandRegions.contain(o, left / 2 + right / 2, top / 2 + bottom / 2)) {
it.remove();
+ continue;
}
}
}
+
+ updateObjects(result);
+
return result;
}
+ public boolean updateObjects() {
+ int zoom = view.getZoom();
+ if (osmandRegions.isInitialized() && data.results != null
+ && zoom >= ZOOM_TO_SHOW_SELECTION_ST && zoom < ZOOM_TO_SHOW_SELECTION) {
+ return updateObjects(data.results);
+ }
+ return false;
+ }
+ private boolean updateObjects(List objects) {
+ List outdatedObjects = new LinkedList<>();
+ List downloadingObjects = new LinkedList<>();
+ for (BinaryMapDataObject o : objects) {
+ String fullName = osmandRegions.getFullName(o);
+ WorldRegion region = osmandRegions.getRegionData(fullName);
+ if (region != null && region.getRegionDownloadName() != null) {
+ List indexItems = app.getDownloadThread().getIndexes().getIndexItems(region);
+ for (IndexItem item : indexItems) {
+ if (item.getType() == DownloadActivityType.NORMAL_FILE) {
+ if (app.getDownloadThread().isDownloading(item)) {
+ downloadingObjects.add(o);
+ } else if (item.isOutdated()) {
+ outdatedObjects.add(o);
+ }
+ }
+ }
+ }
+ }
+
+ boolean res = !this.downloadingObjects.equals(downloadingObjects)
+ || !this.outdatedObjects.equals(outdatedObjects);
+
+ this.downloadingObjects = downloadingObjects;
+ this.outdatedObjects = outdatedObjects;
+
+ return res;
+ }
private boolean checkIfMapEmpty(RotatedTileBox tileBox) {
// RotatedTileBox cb = rm.getRenderer().getCheckedBox();
@@ -388,18 +458,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
int point31x = MapUtils.get31TileNumberX(pointLatLon.getLongitude());
int point31y = MapUtils.get31TileNumberY(pointLatLon.getLatitude());
- int left = MapUtils.get31TileNumberX(tb.getLeftTopLatLon().getLongitude());
- int right = MapUtils.get31TileNumberX(tb.getRightBottomLatLon().getLongitude());
- int top = MapUtils.get31TileNumberY(tb.getLeftTopLatLon().getLatitude());
- int bottom = MapUtils.get31TileNumberY(tb.getRightBottomLatLon().getLatitude());
-
- List result;
- try {
- result = osmandRegions.queryBbox(left, right, top, bottom);
- } catch (IOException e) {
- return;
- }
-
+ List result = new LinkedList<>(data.results);
Iterator it = result.iterator();
while (it.hasNext()) {
BinaryMapDataObject o = it.next();
@@ -422,7 +481,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
String fullName = osmandRegions.getFullName((BinaryMapDataObject) o);
final WorldRegion region = osmandRegions.getRegionData(fullName);
if (region != null) {
- return region.getLevel();
+ return region.getLevel() - 1000;
}
}
return 0;
@@ -432,7 +491,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
public void setSelectedObject(Object o) {
if (o instanceof BinaryMapDataObject) {
List list = new LinkedList<>();
- if (selectedObjects != null) {
+ if (selectedObjects. size() > 0) {
list.addAll(selectedObjects);
}
list.add((BinaryMapDataObject) o);
@@ -442,6 +501,6 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
@Override
public void clearSelectedObject() {
- selectedObjects = null;
+ selectedObjects = new LinkedList<>();
}
}