本文整理汇总了Java中org.oscim.utils.pool.Inlist类的典型用法代码示例。如果您正苦于以下问题:Java Inlist类的具体用法?Java Inlist怎么用?Java Inlist使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Inlist类属于org.oscim.utils.pool包,在下文中一共展示了Inlist类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import org.oscim.utils.pool.Inlist; //导入依赖的package包/类
public BufferItem get(int size) {
BufferItem b = mPool;
if (b == null) {
b = new BufferItem();
} else {
mPool = b.next;
b.next = null;
}
if (b.size < size)
b.growBuffer(size);
mUsedBuffers = Inlist.push(mUsedBuffers, b);
return b;
}
示例2: getTexture
import org.oscim.utils.pool.Inlist; //导入依赖的package包/类
private TextureItem getTexture(Bitmap bitmap) {
TextureItem t;
for (t = prevTextures; t != null; t = t.next) {
if (t.bitmap == bitmap) {
prevTextures = Inlist.remove(prevTextures, t);
textures = Inlist.appendItem(textures, t);
t.offset = 0;
t.indices = 0;
return t;
}
}
return null;
}
示例3: put
import org.oscim.utils.pool.Inlist; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public K put(K key, boolean replace) {
if (key.next != null)
throw new IllegalStateException("item not unhooked");
int hash = secondaryHash(key.hashCode());
HashItem[] tab = table;
int index = hash & (tab.length - 1);
for (HashItem e = tab[index]; e != null; e = e.next) {
if (e.hash == hash && key.equals(e)) {
if (replace) {
tab[index] = Inlist.remove(tab[index], e);
tab[index] = Inlist.push(tab[index], key);
}
//V oldValue = e.value;
//e.value = value;
return (K) e; //oldValue;
}
}
// No entry key is present; create one
if (size++ > threshold) {
tab = doubleCapacity();
index = hash & (tab.length - 1);
}
addNewEntry(key, hash, index);
return null;
}
示例4: addItem
import org.oscim.utils.pool.Inlist; //导入依赖的package包/类
public Sprite addItem(T item, int width, int height) {
Rect r = mAtlas.getRegion(width, height);
if (r == null) {
//create new atlas
return null;
}
Sprite sprite = new Sprite(item, mAtlas, r);
items = Inlist.appendItem(items, sprite);
draw(item, r);
return sprite;
}
示例5: addItem
import org.oscim.utils.pool.Inlist; //导入依赖的package包/类
public Sprite addItem(T item, int width, int height) {
Rect r = mAtlas.getRegion(width, height);
if (r == null) {
//create new atlas
return null;
}
Sprite sprite = new Sprite(item, mAtlas, r);
items = Inlist.append(items, sprite);
draw(item, r);
return sprite;
}
示例6: init
import org.oscim.utils.pool.Inlist; //导入依赖的package包/类
@Override
public void init(int num) {
int[] textureIds = new int[num];
GLES20.glGenTextures(num, textureIds, 0);
for (int i = 0; i < num; i++) {
initTexture(textureIds[i]);
TextureItem to = new TextureItem(textureIds[i]);
pool = Inlist.push(pool, to);
}
count = num;
fill = num;
}
示例7: getTexture
import org.oscim.utils.pool.Inlist; //导入依赖的package包/类
private TextureItem getTexture(TextureItem prevTextures, Bitmap bitmap) {
TextureItem to;
for (to = prevTextures; to != null; to = to.next) {
if (to.bitmap == bitmap) {
prevTextures = Inlist.remove(prevTextures, to);
textures = Inlist.append(textures, to);
break;
}
}
return to;
}
示例8: renderPointOfInterestSymbol
import org.oscim.utils.pool.Inlist; //导入依赖的package包/类
@Override
public void renderPointOfInterestSymbol(Symbol symbol) {
if (symbol.texture == null){
Log.d(TAG, "missing symbol for " + mElement.tags.asString());
return;
}
SymbolItem it = SymbolItem.pool.get();
it.x = mElement.points[0];
it.y = mElement.points[1];
it.symbol = symbol.texture;
it.billboard = true;
mTile.symbols = Inlist.push(mTile.symbols, it);
}
示例9: process
import org.oscim.utils.pool.Inlist; //导入依赖的package包/类
/**
* TileLoaderThemeHook
*/
@Override
public boolean process(MapTile tile, RenderBuckets buckets, MapElement el,
RenderStyle style, int level) {
if (!(style instanceof ExtrusionStyle))
return false;
ExtrusionStyle extrusion = (ExtrusionStyle) style;
ExtendedMapElement element = (ExtendedMapElement) el;
int height = element.buildingHeight > 0 ? element.buildingHeight : 12 * 100; // 12m default
int minHeight = element.buildingMinHeight;
float[] colors = extrusion.colors;
if (element.buildingColor != 0 || element.roofColor != 0) {
// As defined in style
float alpha = 0.9f;
colors = new float[16];
System.arraycopy(extrusion.colors, 0, colors, 0, colors.length);
if (element.roofColor != 0) {
colors[0] = alpha * Color.rToFloat(element.roofColor);
colors[1] = alpha * Color.gToFloat(element.roofColor);
colors[2] = alpha * Color.bToFloat(element.roofColor);
colors[3] = alpha;
}
if (element.buildingColor != 0) {
colors[4] = alpha * Color.rToFloat(element.buildingColor);
colors[5] = alpha * Color.gToFloat(element.buildingColor);
colors[6] = alpha * Color.bToFloat(element.buildingColor);
colors[7] = alpha;
colors[8] = alpha * Color.rToFloat(element.buildingColor);
colors[9] = alpha * Color.gToFloat(element.buildingColor);
colors[10] = alpha * Color.bToFloat(element.buildingColor);
colors[11] = alpha;
}
}
ExtrusionBuckets ebs = get(tile);
for (ExtrusionBucket b = ebs.buckets; b != null; b = b.next()) {
if (b.colors == colors) {
b.add(element, height, minHeight);
return true;
}
}
double lat = MercatorProjection.toLatitude(tile.y);
float groundScale = (float) MercatorProjection.groundResolutionWithScale(lat, 1 << tile.zoomLevel);
ebs.buckets = Inlist.push(ebs.buckets, new ExtrusionBucket(0, groundScale, colors));
ebs.buckets.add(element, height, minHeight);
return true;
}
示例10: releaseItems
import org.oscim.utils.pool.Inlist; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public K releaseItems() {
if (size == 0)
return null;
int collisions = 0;
int max = 0;
int sum = 0;
HashItem items = null;
HashItem last;
for (int i = 0, n = table.length; i < n; i++) {
HashItem item = table[i];
if (item == null)
continue;
table[i] = null;
if (STATS) {
sum = 0;
last = item;
while (last != null) {
if (last.next == null)
break;
sum++;
last = last.next;
}
max = Math.max(max, sum);
collisions += sum;
} else {
last = Inlist.last(item);
}
last.next = items;
items = item;
}
if (STATS)
System.out.println("collisions: " + collisions + " " + max + " " + size);
Arrays.fill(table, null);
size = 0;
return (K) items;
}
示例11: render
import org.oscim.utils.pool.Inlist; //导入依赖的package包/类
/** TileLoaderThemeHook */
@Override
public boolean render(MapTile tile, RenderBuckets buckets, MapElement element,
RenderStyle style, int level) {
if (!(style instanceof ExtrusionStyle))
return false;
ExtrusionStyle extrusion = (ExtrusionStyle) style;
int height = 0;
int minHeight = 0;
String v = element.tags.getValue(Tag.KEY_HEIGHT);
if (v != null)
height = Integer.parseInt(v);
v = element.tags.getValue(Tag.KEY_MIN_HEIGHT);
if (v != null)
minHeight = Integer.parseInt(v);
/* 12m default */
if (height == 0)
height = 12 * 100;
ExtrusionBuckets ebs = get(tile);
for (ExtrusionBucket b = ebs.buckets; b != null; b = b.next()) {
if (b.colors == extrusion.colors) {
b.add(element, height, minHeight);
return true;
}
}
double lat = MercatorProjection.toLatitude(tile.y);
float groundScale = (float) MercatorProjection
.groundResolution(lat, 1 << tile.zoomLevel);
ebs.buckets = Inlist.push(ebs.buckets,
new ExtrusionBucket(0, groundScale,
extrusion.colors));
ebs.buckets.add(element, height, minHeight);
return true;
}