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; import android.os.SystemClock;
public class TextOverlay extends BasicOverlay { 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_CAPTION_DIST = 5;
private final static float MIN_WAY_DIST = 3; private final static float MIN_WAY_DIST = 3;
@ -158,7 +158,6 @@ private final static String TAG = TextOverlay.class.getName();
} }
} }
// class ActiveTile { // class ActiveTile {
// MapTile tile; // MapTile tile;
// int activeLabels; // int activeLabels;
@ -217,7 +216,7 @@ private final static String TAG = TextOverlay.class.getName();
// remove Label l from mLabels and return l.next // remove Label l from mLabels and return l.next
private Label removeLabel(Label l) { private Label removeLabel(Label l) {
Label ret = (Label) l.next; Label ret = (Label) l.next;
mLabels = (Label)mPool.release(mLabels, l); mLabels = (Label) mPool.release(mLabels, l);
return ret; return ret;
} }
@ -386,7 +385,6 @@ private final static String TAG = TextOverlay.class.getName();
int maxx = Tile.SIZE << (zoom - 1); int maxx = Tile.SIZE << (zoom - 1);
if (dbg != null) if (dbg != null)
addDebugLayers(dbg); addDebugLayers(dbg);
@ -557,12 +555,18 @@ private final static String TAG = TextOverlay.class.getName();
l.text.fontHeight + MIN_CAPTION_DIST); l.text.fontHeight + MIN_CAPTION_DIST);
boolean overlaps = false; 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.bbox.overlaps(lp.bbox)) {
if (l.text.priority < lp.text.priority) {
lp = removeLabel(lp);
continue;
}
overlaps = true; overlaps = true;
break; break;
} }
lp = (Label) lp.next;
} }
if (!overlaps) { if (!overlaps) {
addLabel(l); addLabel(l);

View File

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

View File

@ -982,19 +982,19 @@
<rule e="node" k="place" v="*"> <rule e="node" k="place" v="*">
<rule e="node" k="*" v="suburb|town|village"> <rule e="node" k="*" v="suburb|town|village">
<caption k="name" font-size="20" fill="#eeeeee" <caption k="name" font-size="20" fill="#eeeeee"
stroke="#000020" stroke-width="4.0" /> stroke="#000020" stroke-width="4.0" priority="2"/>
</rule> </rule>
<rule e="node" k="*" v="island" zoom-min="10"> <rule e="node" k="*" v="island" zoom-min="10">
<caption k="name" font-style="bold" font-size="20" fill="#ffffff" <caption k="name" font-style="bold" font-size="20" fill="#ffffff"
stroke="#ffffff" stroke-width="1.0" /> stroke="#ffffff" stroke-width="1.0" priority="1"/>
</rule> </rule>
<rule e="node" k="*" v="city"> <rule e="node" k="*" v="city">
<caption k="name" font-style="bold" font-size="22" fill="#ffffff" <caption k="name" font-style="bold" font-size="22" fill="#ffffff"
stroke="#002020" stroke-width="4.0" /> stroke="#002020" stroke-width="4.0" priority="1"/>
</rule> </rule>
<rule e="node" k="*" v="country"> <rule e="node" k="*" v="country">
<caption k="name" font-size="22" fill="#ffffff" <caption k="name" font-size="22" fill="#ffffff"
stroke="#000000" stroke-width="2.0" /> stroke="#000000" stroke-width="2.0" priority="0"/>
</rule> </rule>
</rule> </rule>