- improve way-labeling
- let nomination search places instead of tags
This commit is contained in:
@@ -119,7 +119,7 @@ public final class SymbolLayer extends TextureLayer {
|
||||
textures = to;
|
||||
mCanvas.setBitmap(to.bitmap);
|
||||
|
||||
int maxIndices = TextureRenderer.MAX_ITEMS * TextureRenderer.INDICES_PER_SPRITE;
|
||||
// int maxIndices = TextureRenderer.MAX_ITEMS * TextureRenderer.INDICES_PER_SPRITE;
|
||||
|
||||
for (SymbolItem it = symbols; it != null;) {
|
||||
float width, height;
|
||||
@@ -143,7 +143,7 @@ public final class SymbolLayer extends TextureLayer {
|
||||
|
||||
}
|
||||
|
||||
if (y + height > TEXTURE_HEIGHT || curIndices == maxIndices) {
|
||||
if (y + height > TEXTURE_HEIGHT) { // || curIndices == maxIndices) {
|
||||
Log.d(TAG, "reached max symbols: " + numIndices);
|
||||
|
||||
to.offset = offsetIndices;
|
||||
@@ -249,13 +249,6 @@ public final class SymbolLayer extends TextureLayer {
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
// FIXME this does not work, need to draw bitmap on next
|
||||
// texture...
|
||||
// if (pos == bufLen) {
|
||||
// sbuf.put(buf, 0, pos);
|
||||
// pos = 0;
|
||||
// }
|
||||
|
||||
x += width;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,15 @@ public class TextItem {
|
||||
return this;
|
||||
}
|
||||
|
||||
public TextItem move(TextItem ti, float dx, float dy, float scale) {
|
||||
this.x = dx + (ti.x * scale);
|
||||
this.y = dy + (ti.y * scale);
|
||||
this.string = ti.string;
|
||||
this.text = ti.text;
|
||||
this.width = ti.width;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TextItem next;
|
||||
|
||||
public float x, y;
|
||||
|
||||
@@ -35,9 +35,9 @@ public final class TextLayer extends TextureLayer {
|
||||
private static int mFontPadX = 1;
|
||||
private static int mFontPadY = 1;
|
||||
|
||||
TextItem labels;
|
||||
|
||||
public TextItem labels;
|
||||
private Canvas mCanvas;
|
||||
private float mScale;
|
||||
|
||||
public TextItem getLabels() {
|
||||
return labels;
|
||||
@@ -47,6 +47,31 @@ public final class TextLayer extends TextureLayer {
|
||||
type = Layer.SYMBOL;
|
||||
mCanvas = new Canvas();
|
||||
fixed = true;
|
||||
mScale = 1;
|
||||
}
|
||||
|
||||
public void setScale(float scale) {
|
||||
mScale = scale;
|
||||
}
|
||||
|
||||
public boolean removeText(TextItem item) {
|
||||
TextItem prev = null;
|
||||
|
||||
for (TextItem it = labels; it != null; it = it.next) {
|
||||
if (it == item) {
|
||||
if (prev == null)
|
||||
labels = it.next;
|
||||
else
|
||||
prev.next = it.next;
|
||||
|
||||
verticesCnt -= 4;
|
||||
return true;
|
||||
}
|
||||
|
||||
prev = it;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addText(TextItem item) {
|
||||
@@ -170,8 +195,14 @@ public final class TextLayer extends TextureLayer {
|
||||
|
||||
float ux = -vy;
|
||||
float uy = vx;
|
||||
|
||||
hw /= mScale;
|
||||
float hh2 = hh + it.text.fontDescent / 2;
|
||||
hh -= it.text.fontDescent / 2;
|
||||
|
||||
hh /= mScale;
|
||||
hh2 /= mScale;
|
||||
|
||||
x1 = (short) (SCALE * (vx * hw - ux * hh));
|
||||
y1 = (short) (SCALE * (vy * hw - uy * hh));
|
||||
x2 = (short) (SCALE * (-vx * hw - ux * hh));
|
||||
|
||||
Reference in New Issue
Block a user