only show label symbol when label is also visible

This commit is contained in:
Hannes Janetzek 2013-08-04 14:33:25 +02:00
parent f82ee186d0
commit f55ed24926

View File

@ -497,7 +497,8 @@ class TextRenderLayer extends BasicRenderLayer {
l.bbox.setNormalized(l.x, l.y, cos, -sin, l.bbox.setNormalized(l.x, l.y, cos, -sin,
l.width + MIN_CAPTION_DIST, l.width + MIN_CAPTION_DIST,
l.text.fontHeight + MIN_CAPTION_DIST); l.text.fontHeight + MIN_CAPTION_DIST,
l.text.dy);
boolean overlaps = false; boolean overlaps = false;
@ -514,17 +515,7 @@ class TextRenderLayer extends BasicRenderLayer {
lp = (Label) lp.next; lp = (Label) lp.next;
} }
if (ti.text.texture != null) {
SymbolItem s = SymbolItem.pool.get();
s.symbol = ti.text.texture;
s.x = l.x;
s.y = l.y;
s.billboard = true;
sl.addSymbol(s);
}
if (!overlaps) { if (!overlaps) {
addLabel(l); addLabel(l);
l.item = TextItem.copy(ti); l.item = TextItem.copy(ti);
l.tile = t; l.tile = t;
@ -535,9 +526,17 @@ class TextRenderLayer extends BasicRenderLayer {
} }
for (Label ti = mLabels; ti != null; ti = (Label) ti.next) { for (Label ti = mLabels; ti != null; ti = (Label) ti.next) {
if (ti.text.caption) if (ti.text.caption){
if (ti.text.texture != null) {
SymbolItem s = SymbolItem.pool.get();
s.symbol = ti.text.texture;
s.x = ti.x;
s.y = ti.y;
s.billboard = true;
sl.addSymbol(s);
}
continue; continue;
}
// flip label upside-down // flip label upside-down
if (cos * (ti.x2 - ti.x1) - sin * (ti.y2 - ti.y1) < 0) { if (cos * (ti.x2 - ti.x1) - sin * (ti.y2 - ti.y1) < 0) {
float tmp = ti.x1; float tmp = ti.x1;