use theme priority(for tag group) also for node labels

This commit is contained in:
Hannes Janetzek 2013-04-30 13:24:59 +02:00
parent 5a2cfe16a5
commit 01b6a8acf4
3 changed files with 252 additions and 248 deletions

View File

@ -60,7 +60,7 @@ import android.opengl.GLES20;
import android.os.SystemClock;
public class TextOverlay extends BasicOverlay {
private final static String TAG = TextOverlay.class.getName();
private final static String TAG = TextOverlay.class.getName();
private final static float MIN_CAPTION_DIST = 5;
private final static float MIN_WAY_DIST = 3;
@ -158,7 +158,6 @@ private final static String TAG = TextOverlay.class.getName();
}
}
// class ActiveTile {
// MapTile tile;
// int activeLabels;
@ -217,7 +216,7 @@ private final static String TAG = TextOverlay.class.getName();
// remove Label l from mLabels and return l.next
private Label removeLabel(Label l) {
Label ret = (Label) l.next;
mLabels = (Label)mPool.release(mLabels, l);
mLabels = (Label) mPool.release(mLabels, l);
return ret;
}
@ -386,7 +385,6 @@ private final static String TAG = TextOverlay.class.getName();
int maxx = Tile.SIZE << (zoom - 1);
if (dbg != null)
addDebugLayers(dbg);
@ -557,12 +555,18 @@ private final static String TAG = TextOverlay.class.getName();
l.text.fontHeight + MIN_CAPTION_DIST);
boolean overlaps = false;
for (Label lp = mLabels; lp != null; lp = (Label) lp.next) {
for (Label lp = mLabels; lp != null;) {
if (l.bbox.overlaps(lp.bbox)) {
if (l.text.priority < lp.text.priority) {
lp = removeLabel(lp);
continue;
}
overlaps = true;
break;
}
lp = (Label) lp.next;
}
if (!overlaps) {
addLabel(l);
@ -630,15 +634,15 @@ private final static String TAG = TextOverlay.class.getName();
} else {
if (ti.width > ti.length * scale) {
ll = dbg.getLineLayer(1);
ll = dbg.getLineLayer(1);
overlaps = 3;
}
else if (overlaps == 1)
ll = dbg.getLineLayer(0);
ll = dbg.getLineLayer(0);
else if (overlaps == 2)
ll = dbg.getLineLayer(3);
ll = dbg.getLineLayer(3);
else
ll = dbg.getLineLayer(2);
ll = dbg.getLineLayer(2);
}
float[] points = mDebugPoints;
float width = (ti.x2 - ti.x1) / 2f;
@ -656,29 +660,29 @@ private final static String TAG = TextOverlay.class.getName();
private static void addDebugLayers(Layers dbg) {
dbg.clear();
LineLayer ll = dbg.getLineLayer(0);
LineLayer ll = dbg.getLineLayer(0);
ll.line = new Line((Color.BLUE & 0xaaffffff), 1, Cap.BUTT);
ll.width = 2;
ll = dbg.getLineLayer(3);
ll = dbg.getLineLayer(3);
ll.line = new Line((Color.YELLOW & 0xaaffffff), 1, Cap.BUTT);
ll.width = 2;
ll = dbg.getLineLayer(1);
ll = dbg.getLineLayer(1);
ll.line = new Line((Color.RED & 0xaaffffff), 1, Cap.BUTT);
ll.width = 2;
ll = dbg.getLineLayer(2);
ll = dbg.getLineLayer(2);
ll.line = new Line((Color.GREEN & 0xaaffffff), 1, Cap.BUTT);
ll.width = 2;
ll = dbg.getLineLayer(4);
ll = dbg.getLineLayer(4);
ll.line = new Line((Color.CYAN & 0xaaffffff), 1, Cap.BUTT);
ll.width = 2;
ll = dbg.getLineLayer(5);
ll = dbg.getLineLayer(5);
ll.line = new Line((Color.MAGENTA & 0xaaffffff), 1, Cap.BUTT);
ll.width = 2;
}
@Override
public synchronized void update(MapPosition curPos, boolean positionChanged,
Matrices matrices) {
Matrices matrices) {
if (mNextLayer != null) {
// keep text layer, not recrating its canvas each time

View File

@ -1060,27 +1060,27 @@
<rule e="node" k="place" v="*">
<rule e="node" k="*" v="suburb" zoom-max="14">
<caption k="name" font-style="italic" font-size="17" fill="#606060"
stroke="#ffffff" stroke-width="2.0" />
stroke="#ffffff" stroke-width="2.0" priority="4"/>
</rule>
<rule e="node" k="*" v="village" zoom-max="14">
<caption k="name" font-size="17" fill="#2020cc"
stroke="#ffffff" stroke-width="2.0" />
stroke="#ffffff" stroke-width="2.0" priority="3"/>
</rule>
<rule e="node" k="*" v="island" zoom-min="10">
<caption k="name" font-style="bold" font-size="20" fill="#000000"
stroke="#ffffff" stroke-width="2.0" />
stroke="#ffffff" stroke-width="2.0" priority="1"/>
</rule>
<rule e="node" k="*" v="town">
<caption k="name" font-size="19" fill="#000000"
stroke="#ffffff" stroke-width="2.0" />
stroke="#ffffff" stroke-width="2.0" priority="2"/>
</rule>
<rule e="node" k="*" v="city">
<caption k="name" font-size="20" fill="#000000"
stroke="#ffffff" stroke-width="2.0" />
stroke="#ffffff" stroke-width="2.0" priority="1"/>
</rule>
<rule e="node" k="*" v="country">
<caption k="name" font-style="bold" font-size="20" fill="#000000"
stroke="#ffffff" stroke-width="2.0" />
stroke="#ffffff" stroke-width="2.0" priority="0"/>
</rule>
</rule>

File diff suppressed because it is too large Load Diff