Make small refactoring
This commit is contained in:
parent
c876c0aadb
commit
63646badb4
1 changed files with 25 additions and 24 deletions
|
@ -64,33 +64,34 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(name)) {
|
int x = (int) tileBox.getPixXFromLatLon(loc.getLatitude(), loc.getLongitude());
|
||||||
int lines = 0;
|
int y = (int) tileBox.getPixYFromLatLon(loc.getLatitude(), loc.getLongitude());
|
||||||
while (lines < TEXT_LINES) {
|
int tx = tileBox.getPixXFromLonNoRot(loc.getLongitude());
|
||||||
if (set.contains(division(tx, ty, 0, lines)) || set.contains(division(tx, ty, -1, lines))
|
int ty = tileBox.getPixYFromLatNoRot(loc.getLatitude());
|
||||||
|| set.contains(division(tx, ty, +1, lines))) {
|
|
||||||
break;
|
int lines = 0;
|
||||||
}
|
while (lines < TEXT_LINES) {
|
||||||
lines++;
|
if (set.contains(division(tx, ty, 0, lines)) || set.contains(division(tx, ty, -1, lines))
|
||||||
|
|| set.contains(division(tx, ty, +1, lines))) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (lines != 0) {
|
lines++;
|
||||||
int r = provider.getTextShift(o, tileBox);
|
}
|
||||||
drawWrappedText(canvas, name, paintTextIcon.getTextSize(), x,
|
if (lines != 0) {
|
||||||
y + r + 2 + paintTextIcon.getTextSize() / 2, lines);
|
int r = provider.getTextShift(o, tileBox);
|
||||||
while (lines > 0) {
|
drawWrappedText(canvas, name, paintTextIcon.getTextSize(), x,
|
||||||
set.add(division(tx, ty, 1, lines - 1));
|
y + r + 2 + paintTextIcon.getTextSize() / 2, lines);
|
||||||
set.add(division(tx, ty, -1, lines - 1));
|
while (lines > 0) {
|
||||||
set.add(division(tx, ty, 0, lines - 1));
|
set.add(division(tx, ty, 1, lines - 1));
|
||||||
lines--;
|
set.add(division(tx, ty, -1, lines - 1));
|
||||||
}
|
set.add(division(tx, ty, 0, lines - 1));
|
||||||
|
lines--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue