Make small refactoring

This commit is contained in:
Alex Sytnyk 2018-07-25 17:43:21 +03:00
parent c876c0aadb
commit 63646badb4

View file

@ -64,15 +64,17 @@ public class MapTextLayer extends OsmandMapLayer {
paintTextIcon.setFakeBoldText(provider.isFakeBoldText()); paintTextIcon.setFakeBoldText(provider.isFakeBoldText());
for (Object o : textObjects.get(l)) { for (Object o : textObjects.get(l)) {
double lat = provider.getTextLocation(o).getLatitude(); LatLon loc = provider.getTextLocation(o);
double lon = provider.getTextLocation(o).getLongitude();
int x = (int) tileBox.getPixXFromLatLon(lat, lon);
int y = (int) tileBox.getPixYFromLatLon(lat, lon);
int tx = tileBox.getPixXFromLonNoRot(lon);
int ty = tileBox.getPixYFromLatNoRot(lat);
String name = provider.getText(o); String name = provider.getText(o);
if (loc == null || TextUtils.isEmpty(name)) {
continue;
}
int x = (int) tileBox.getPixXFromLatLon(loc.getLatitude(), loc.getLongitude());
int y = (int) tileBox.getPixYFromLatLon(loc.getLatitude(), loc.getLongitude());
int tx = tileBox.getPixXFromLonNoRot(loc.getLongitude());
int ty = tileBox.getPixYFromLatNoRot(loc.getLatitude());
if (!TextUtils.isEmpty(name)) {
int lines = 0; int lines = 0;
while (lines < TEXT_LINES) { while (lines < TEXT_LINES) {
if (set.contains(division(tx, ty, 0, lines)) || set.contains(division(tx, ty, -1, lines)) if (set.contains(division(tx, ty, 0, lines)) || set.contains(division(tx, ty, -1, lines))
@ -95,7 +97,6 @@ public class MapTextLayer extends OsmandMapLayer {
} }
} }
} }
}
private int division(int x, int y, int sx, int sy) { private int division(int x, int y, int sx, int sy) {
// make numbers positive // make numbers positive