当前位置: 首页>>代码示例>>Java>>正文


Java Inlist类代码示例

本文整理汇总了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;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:17,代码来源:NativeBufferPool.java

示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:16,代码来源:SymbolBucket.java

示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:29,代码来源:KeyMap.java

示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:15,代码来源:SpriteManager.java

示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:15,代码来源:SpriteManager.java

示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:15,代码来源:TextureItem.java

示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:14,代码来源:SymbolLayer.java

示例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);
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:15,代码来源:MapTileLoader.java

示例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;
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:60,代码来源:BuildingLayer.java

示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:43,代码来源:KeyMap.java

示例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;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:47,代码来源:BuildingLayer.java


注:本文中的org.oscim.utils.pool.Inlist类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。