Renamed methods

This commit is contained in:
PaulStets 2018-05-13 16:55:09 +03:00
parent c3d4b9ec13
commit cba23728d1
5 changed files with 9 additions and 14 deletions

View file

@ -694,9 +694,9 @@ public class OsmandRegions {
} }
} }
public List<WorldRegion> getWoldRegions(LatLon latLon) throws IOException { public List<WorldRegion> getWoldRegionsAt(LatLon latLon) throws IOException {
List<WorldRegion> result = new ArrayList<>(); List<WorldRegion> result = new ArrayList<>();
List<BinaryMapDataObject> mapDataObjects = getBinaryMapDataObjects(latLon); List<BinaryMapDataObject> mapDataObjects = getBinaryMapDataObjectsAt(latLon);
for (BinaryMapDataObject obj : mapDataObjects) { for (BinaryMapDataObject obj : mapDataObjects) {
String fullName = getFullName(obj); String fullName = getFullName(obj);
if (fullName != null) { if (fullName != null) {
@ -709,8 +709,8 @@ public class OsmandRegions {
return result; return result;
} }
public BinaryMapDataObject findBinaryMapDataObject(LatLon latLon) throws IOException { public BinaryMapDataObject getSmallestBinaryMapDataObjectAt(LatLon latLon) throws IOException {
List<BinaryMapDataObject> mapDataObjects = getBinaryMapDataObjects(latLon); List<BinaryMapDataObject> mapDataObjects = getBinaryMapDataObjectsAt(latLon);
BinaryMapDataObject res = null; BinaryMapDataObject res = null;
double smallestArea = -1; double smallestArea = -1;
for (BinaryMapDataObject o : mapDataObjects) { for (BinaryMapDataObject o : mapDataObjects) {
@ -726,7 +726,7 @@ public class OsmandRegions {
return res; return res;
} }
private List<BinaryMapDataObject> getBinaryMapDataObjects(LatLon latLon) throws IOException { private List<BinaryMapDataObject> getBinaryMapDataObjectsAt(LatLon latLon) throws IOException {
int point31x = MapUtils.get31TileNumberX(latLon.getLongitude()); int point31x = MapUtils.get31TileNumberX(latLon.getLongitude());
int point31y = MapUtils.get31TileNumberY(latLon.getLatitude()); int point31y = MapUtils.get31TileNumberY(latLon.getLatitude());

View file

@ -161,7 +161,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
protected BinaryMapDataObject doInBackground(LatLon... latLons) { protected BinaryMapDataObject doInBackground(LatLon... latLons) {
try { try {
if (latLons != null && latLons.length > 0) { if (latLons != null && latLons.length > 0) {
return app.getRegions().findBinaryMapDataObject(latLons[0]); return app.getRegions().getSmallestBinaryMapDataObjectAt(latLons[0]);
} }
} catch (IOException e) { } catch (IOException e) {
// ignore // ignore

View file

@ -5,15 +5,12 @@ import android.support.annotation.Nullable;
import net.osmand.IndexConstants; import net.osmand.IndexConstants;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.binary.BinaryMapDataObject;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.map.OsmandRegions; import net.osmand.map.OsmandRegions;
import net.osmand.map.WorldRegion; import net.osmand.map.WorldRegion;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.download.DownloadOsmandIndexesHelper.AssetIndexItem; import net.osmand.plus.download.DownloadOsmandIndexesHelper.AssetIndexItem;
import net.osmand.plus.inapp.InAppPurchaseHelper; import net.osmand.plus.inapp.InAppPurchaseHelper;
import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -23,7 +20,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -465,7 +461,7 @@ public class DownloadResources extends DownloadResourceGroup {
List<IndexItem> res = new ArrayList<>(); List<IndexItem> res = new ArrayList<>();
OsmandRegions regions = app.getRegions(); OsmandRegions regions = app.getRegions();
DownloadIndexesThread downloadThread = app.getDownloadThread(); DownloadIndexesThread downloadThread = app.getDownloadThread();
List<WorldRegion> downloadRegions = regions.getWoldRegions(latLon); List<WorldRegion> downloadRegions = regions.getWoldRegionsAt(latLon);
for (WorldRegion downloadRegion : downloadRegions) { for (WorldRegion downloadRegion : downloadRegions) {
if (includeDownloaded || !isIndexItemDownloaded(downloadThread, type, downloadRegion, res)) { if (includeDownloaded || !isIndexItemDownloaded(downloadThread, type, downloadRegion, res)) {
addIndexItem(downloadThread, type, downloadRegion, res); addIndexItem(downloadThread, type, downloadRegion, res);

View file

@ -408,7 +408,7 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
Amenity amenity = cityItem.getAmenity(); Amenity amenity = cityItem.getAmenity();
BinaryMapDataObject o = null; BinaryMapDataObject o = null;
try { try {
o = osmandRegions.findBinaryMapDataObject(amenity.getLocation()); o = osmandRegions.getSmallestBinaryMapDataObjectAt(amenity.getLocation());
} catch (IOException e) { } catch (IOException e) {
// ignore // ignore
} }

View file

@ -12,7 +12,6 @@ import android.text.Html;
import android.util.Log; import android.util.Log;
import net.osmand.IndexConstants; import net.osmand.IndexConstants;
import net.osmand.ResultMatcher;
import net.osmand.data.Amenity; import net.osmand.data.Amenity;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.map.OsmandRegions; import net.osmand.map.OsmandRegions;
@ -99,7 +98,7 @@ public class WikiArticleHelper {
List<WorldRegion> regions = null; List<WorldRegion> regions = null;
if (articleLatLon != null) { if (articleLatLon != null) {
try { try {
regions = application.getRegions().getWoldRegions(articleLatLon); regions = application.getRegions().getWoldRegionsAt(articleLatLon);
} catch (IOException e) { } catch (IOException e) {
Log.e(TAG, e.getMessage(), e); Log.e(TAG, e.getMessage(), e);
} }