use Inlist.List for MapTile.labels/symbols
This commit is contained in:
parent
6dddf614dd
commit
bf2e0e44a8
vtm-gdx-html/src/org/oscim/gdx/emu/org/oscim/layers/tile/vector
vtm/src/org/oscim
layers/tile/vector
tiling
@ -343,7 +343,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
||||
return;
|
||||
|
||||
PointF p = mElement.getPoint(0);
|
||||
mTile.addLabel(TextItem.pool.get().set(p.x, p.y, value, text));
|
||||
mTile.labels.push(TextItem.pool.get().set(p.x, p.y, value, text));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -354,7 +354,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
||||
|
||||
for (int i = 0, n = mElement.getNumPoints(); i < n; i++) {
|
||||
PointF p = mElement.getPoint(i);
|
||||
mTile.addLabel(TextItem.pool.get().set(p.x, p.y, value, text));
|
||||
mTile.labels.push(TextItem.pool.get().set(p.x, p.y, value, text));
|
||||
}
|
||||
}
|
||||
|
||||
@ -391,7 +391,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
||||
|
||||
SymbolItem it = SymbolItem.pool.get();
|
||||
it.set(p.x, p.y, symbol.texture, true);
|
||||
mTile.addSymbol(it);
|
||||
mTile.symbols.push(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
||||
x /= (n / 2);
|
||||
y /= (n / 2);
|
||||
|
||||
mTile.addLabel(TextItem.pool.get().set(x, y, value, text));
|
||||
mTile.labels.push(TextItem.pool.get().set(x, y, value, text));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -371,7 +371,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
||||
|
||||
for (int i = 0, n = mElement.getNumPoints(); i < n; i++) {
|
||||
PointF p = mElement.getPoint(i);
|
||||
mTile.addLabel(TextItem.pool.get().set(p.x, p.y, value, text));
|
||||
mTile.labels.push(TextItem.pool.get().set(p.x, p.y, value, text));
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,7 +407,7 @@ public class VectorTileLoader extends TileLoader implements IRenderTheme.Callbac
|
||||
|
||||
SymbolItem it = SymbolItem.pool.get();
|
||||
it.set(p.x, p.y, symbol.texture, true);
|
||||
mTile.addSymbol(it);
|
||||
mTile.symbols.push(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,8 +214,9 @@ public final class WayDecorator {
|
||||
t.x2 = x2;
|
||||
t.y2 = y2;
|
||||
t.length = (short) segmentLength;
|
||||
|
||||
t.edges = edge;
|
||||
tile.addLabel(t);
|
||||
tile.labels.push(t);
|
||||
|
||||
i = last;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class LabelPlacement {
|
||||
private Label addWayLabels(MapTile t, Label l, float dx, float dy,
|
||||
double scale) {
|
||||
|
||||
for (TextItem ti = t.labels; ti != null; ti = ti.next) {
|
||||
for (TextItem ti : t.labels) {
|
||||
if (ti.text.caption)
|
||||
continue;
|
||||
|
||||
@ -225,7 +225,8 @@ public class LabelPlacement {
|
||||
|
||||
private Label addNodeLabels(MapTile t, Label l, float dx, float dy,
|
||||
double scale, float cos, float sin) {
|
||||
O: for (TextItem ti = t.labels; ti != null; ti = ti.next) {
|
||||
|
||||
O: for (TextItem ti : t.labels) {
|
||||
if (!ti.text.caption)
|
||||
continue;
|
||||
|
||||
@ -443,7 +444,7 @@ public class LabelPlacement {
|
||||
float dy = (float) (t.tileY * Tile.SIZE - tileY);
|
||||
dx = flipLongitude(dx, maxx);
|
||||
|
||||
for (SymbolItem ti = t.symbols; ti != null; ti = ti.next) {
|
||||
for (SymbolItem ti : t.symbols) {
|
||||
if (ti.texRegion == null)
|
||||
continue;
|
||||
|
||||
|
@ -20,7 +20,7 @@ import org.oscim.core.Tile;
|
||||
import org.oscim.renderer.elements.ElementLayers;
|
||||
import org.oscim.renderer.elements.SymbolItem;
|
||||
import org.oscim.renderer.elements.TextItem;
|
||||
import org.oscim.utils.pool.Inlist;
|
||||
import org.oscim.utils.pool.Inlist.List;
|
||||
import org.oscim.utils.quadtree.Node;
|
||||
|
||||
/**
|
||||
@ -81,18 +81,12 @@ public class MapTile extends Tile {
|
||||
* FIXME move to VectorMapTile
|
||||
* Tile data set by TileLoader.
|
||||
*/
|
||||
public TextItem labels;
|
||||
public SymbolItem symbols;
|
||||
|
||||
public final List<SymbolItem> symbols = new List<SymbolItem>();
|
||||
public final List<TextItem> labels = new List<TextItem>();
|
||||
|
||||
public ElementLayers layers;
|
||||
|
||||
public void addLabel(TextItem it) {
|
||||
labels = Inlist.push(labels, it);
|
||||
}
|
||||
|
||||
public void addSymbol(SymbolItem it) {
|
||||
symbols = Inlist.push(symbols, it);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tile is in view region. Set by TileRenderer.
|
||||
*/
|
||||
@ -234,8 +228,8 @@ public class MapTile extends Tile {
|
||||
layers = null;
|
||||
}
|
||||
|
||||
labels = TextItem.pool.releaseAll(labels);
|
||||
symbols = SymbolItem.pool.releaseAll(symbols);
|
||||
TextItem.pool.releaseAll(labels.clear());
|
||||
SymbolItem.pool.releaseAll(symbols.clear());
|
||||
|
||||
state = STATE_NONE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user