• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Tile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.oscim.core.Tile的典型用法代码示例。如果您正苦于以下问题:Java Tile类的具体用法?Java Tile怎么用?Java Tile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Tile类属于org.oscim.core包,在下文中一共展示了Tile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTileUrl

import org.oscim.core.Tile; //导入依赖的package包/类
@Override
public String getTileUrl(Tile tile) {
    String tileUrl = null;
    if (mProviderClient == null)
        return null;
    Uri contentUri = Uri.parse(mUri + "/" + tile.zoomLevel + "/" + tile.tileX + "/" + tile.tileY);
    try {
        Cursor cursor = mProviderClient.query(contentUri, TILE_COLUMNS, null, null, null);
        if (cursor != null) {
            cursor.moveToFirst();
            tileUrl = cursor.getString(0);
            cursor.close();
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    return tileUrl;
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:19,代码来源:OnlineTileSource.java


示例2: process

import org.oscim.core.Tile; //导入依赖的package包/类
@Override
public void process(MapElement el) {
    ExtendedMapElement element = (ExtendedMapElement) el;
    if (!mTileClipper.clip(element))
        return;
    element.scale(scale, scale);
    element.translate(-dx, -dy);
    if (element.hasLabelPosition && element.labelPosition != null) {
        element.labelPosition.x = element.labelPosition.x * scale - dx;
        element.labelPosition.y = element.labelPosition.y * scale - dy;
        if (element.labelPosition.x < 0 || element.labelPosition.x > Tile.SIZE
                || element.labelPosition.y < 0 || element.labelPosition.y > Tile.SIZE)
            element.labelPosition = null;
    }
    mapDataSink.process(element);
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:17,代码来源:MapTrekTileSource.java


示例3: NativeTileDataSink

import org.oscim.core.Tile; //导入依赖的package包/类
NativeTileDataSink(ITileDataSink mapDataSink, Tile tile, int dz, int x, int y) {
    this.mapDataSink = mapDataSink;
    this.tile = tile;
    scale = 1;
    if (dz > 0) {
        scale = 1 << dz;
        dx = (tile.tileX - (x << dz)) * Tile.SIZE;
        dy = (tile.tileY - (y << dz)) * Tile.SIZE;
        mTileClipper = new TileClipper((dx - CLIP_BUFFER) / scale, (dy - CLIP_BUFFER) / scale,
                (dx + Tile.SIZE + CLIP_BUFFER) / scale, (dy + Tile.SIZE + CLIP_BUFFER) / scale);
        mBuildingTileClipper = new TileClipper((dx - BUILDING_CLIP_BUFFER) / scale, (dy - BUILDING_CLIP_BUFFER) / scale,
                (dx + Tile.SIZE + BUILDING_CLIP_BUFFER) / scale, (dy + Tile.SIZE + BUILDING_CLIP_BUFFER) / scale);
        /*
        mBuildingTileClipper = new TileClipper(dx / scale, dy / scale,
                (dx + Tile.SIZE) / scale, (dy + Tile.SIZE) / scale);
                */
    }
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:19,代码来源:MapTrekDataSource.java


示例4: saveTile

import org.oscim.core.Tile; //导入依赖的package包/类
public void saveTile(Tile tile, ByteArrayOutputStream data, boolean success) {
    byte[] bytes = null;
    if (success) {
        bytes = data.toByteArray();
    }

    synchronized (this.cacheBuffers) {
        data.reset();
        this.cacheBuffers.add(data);
    }

    if (success) {
        ContentValues values = new ContentValues();
        values.put("x", tile.tileX);
        values.put("y", tile.tileY);
        values.put("z", tile.zoomLevel);
        values.put("time", 0);
        values.put("last_access", 0);
        values.put("data", bytes);
        context.getContentResolver().insert(SharedTileProvider.PROVIDER_URI, values);
    }
}
 
开发者ID:microg,项目名称:android_packages_apps_GmsCore,代码行数:23,代码来源:SharedTileCache.java


示例5: getTileApi11

import org.oscim.core.Tile; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public TileReader getTileApi11(Tile tile) {
	InputStream in = null;

	mStmtGetTile.bindLong(1, tile.tileX);
	mStmtGetTile.bindLong(2, tile.tileY);
	mStmtGetTile.bindLong(3, tile.zoomLevel);

	try {
		ParcelFileDescriptor result = mStmtGetTile.simpleQueryForBlobFileDescriptor();
		in = new FileInputStream(result.getFileDescriptor());
	} catch (SQLiteDoneException e) {
		log.debug("not in cache {}", tile);
		return null;
	} finally {
		mStmtGetTile.clearBindings();
	}

	if (dbg)
		log.debug("load tile {}", tile);

	return new CacheTileReader(tile, in);
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:24,代码来源:TileCache.java


示例6: toScreenPoint

import org.oscim.core.Tile; //导入依赖的package包/类
/**
 * Get the screen pixel for map coordinates
 * 
 * @param out Point projected to screen coordinate
 */
public synchronized void toScreenPoint(double x, double y, Point out) {

	double cs = mPos.scale * Tile.SIZE;
	double cx = mPos.x * cs;
	double cy = mPos.y * cs;

	mv[0] = (float) (x * cs - cx);
	mv[1] = (float) (y * cs - cy);

	mv[2] = 0;
	mv[3] = 1;

	mViewProjMatrix.prj(mv);

	out.x = (mv[0] * (mWidth / 2));
	out.y = -(mv[1] * (mHeight / 2));
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:23,代码来源:Viewport.java


示例7: setMatrix

import org.oscim.core.Tile; //导入依赖的package包/类
protected void setMatrix(GLMatrix mvp, GLViewport v, boolean project, float coordScale) {
	MapPosition oPos = mMapPosition;

	double tileScale = Tile.SIZE * v.pos.scale;

	double x = oPos.x - v.pos.x;
	double y = oPos.y - v.pos.y;

	if (mFlipOnDateLine) {
		//wrap around date-line
		while (x < 0.5)
			x += 1.0;
		while (x > 0.5)
			x -= 1.0;
	}

	mvp.setTransScale((float) (x * tileScale),
	                  (float) (y * tileScale),
	                  (float) (v.pos.scale / oPos.scale) / coordScale);

	mvp.multiplyLhs(project ? v.viewproj : v.view);
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:23,代码来源:BucketRenderer.java


示例8: addLabels

import org.oscim.core.Tile; //导入依赖的package包/类
private void addLabels(int x, int y, int z) {
	int s = Tile.SIZE;

	TextBucket tl = mTextBucket;
	tl.clear();

	StringBuilder sb = mStringBuffer;

	for (int yy = -2; yy < 2; yy++) {
		for (int xx = -2; xx < 2; xx++) {

			sb.setLength(0);
			sb.append(x + xx)
			    .append(" / ")
			    .append(y + yy)
			    .append(" / ")
			    .append(z);

			TextItem ti = TextItem.pool.get();
			ti.set(s * xx + s / 2, s * yy + s / 2, sb.toString(), mText);
			tl.addText(ti);
		}
	}
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:25,代码来源:GridRenderer.java


示例9: calculateTileBitmask

import org.oscim.core.Tile; //导入依赖的package包/类
static int calculateTileBitmask(Tile tile, int zoomLevelDifference) {
	if (zoomLevelDifference == 1) {
		return getFirstLevelTileBitmask(tile);
	}

	// calculate the XY numbers of the second level sub-tile
	long subtileX = tile.tileX >>> (zoomLevelDifference - 2);
	long subtileY = tile.tileY >>> (zoomLevelDifference - 2);

	// calculate the XY numbers of the parent tile
	long parentTileX = subtileX >>> 1;
	long parentTileY = subtileY >>> 1;

	// determine the correct bitmask for all 16 sub-tiles
	if (parentTileX % 2 == 0 && parentTileY % 2 == 0) {
		return getSecondLevelTileBitmaskUpperLeft(subtileX, subtileY);
	} else if (parentTileX % 2 == 1 && parentTileY % 2 == 0) {
		return getSecondLevelTileBitmaskUpperRight(subtileX, subtileY);
	} else if (parentTileX % 2 == 0 && parentTileY % 2 == 1) {
		return getSecondLevelTileBitmaskLowerLeft(subtileX, subtileY);
	} else {
		return getSecondLevelTileBitmaskLowerRight(subtileX, subtileY);
	}
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:25,代码来源:QueryCalculations.java


示例10: setTile

import org.oscim.core.Tile; //导入依赖的package包/类
void setTile(Tile tile) {
	/* tile position in pixels at tile zoom */
	long x = tile.tileX * Tile.SIZE;
	long y = tile.tileY * Tile.SIZE + Tile.SIZE;

	/* size of the map in pixel at tile zoom */
	long mapExtents = Tile.SIZE << tile.zoomLevel;

	/* offset relative to lat/lon == 0 */
	dx = (x - (mapExtents >> 1));
	dy = (y - (mapExtents >> 1));

	/* scales longitude(1e6) to map-pixel */
	divx = (180.0 * COORD_SCALE) / (mapExtents >> 1);

	/* scale latidute to map-pixel */
	divy = (Math.PI * 2.0) / (mapExtents >> 1);
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:19,代码来源:MapDatabase.java


示例11: sendRequest

import org.oscim.core.Tile; //导入依赖的package包/类
@Override
public void sendRequest(Tile tile) throws IOException {
	if (tile == null) {
		throw new IllegalArgumentException("Tile cannot be null.");
	}
	URL url = new URL(mTileSource.getTileUrl(tile));
	HttpURLConnection conn = mClient.open(url);

	for (Entry<String, String> opt : mTileSource.getRequestHeader().entrySet())
		conn.addRequestProperty(opt.getKey(), opt.getValue());

	try {
		inputStream = conn.getInputStream();
	} catch (FileNotFoundException e) {
		throw new IOException("ERROR " + conn.getResponseCode()
		        + ": " + conn.getResponseMessage());
	}
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:19,代码来源:OkHttpEngine.java


示例12: doWork

import org.oscim.core.Tile; //导入依赖的package包/类
/** running on worker thread */
@Override
public boolean doWork(Task t) {
	Viewport v = mMap.viewport();
	BoundingBox bbox;
	synchronized (v) {
		bbox = v.getBBox();
		v.getMapPosition(t.position);
	}

	double scale = t.position.scale * Tile.SIZE;

	t.position.x = (long) (t.position.x * scale) / scale;
	t.position.y = (long) (t.position.y * scale) / scale;
	processFeatures(t, bbox);

	mMap.render();
	return true;
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:20,代码来源:AbstractVectorLayer.java


示例13: parseLineString

import org.oscim.core.Tile; //导入依赖的package包/类
private void parseLineString(ValueGetter data, boolean haveZ, boolean haveM) {

		int count = data.getInt();

		for (int i = 0; i < count; i++) {
			float x = (float) data.getDouble();
			float y = (float) data.getDouble();

			if (mFlipY)
				y = Tile.SIZE - y;

			mGeom.addPoint(x, y);

			// ignore
			if (haveZ)
				data.getDouble();
			if (haveM)
				data.getDouble();
		}
	}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:21,代码来源:WKBReader.java


示例14: update

import org.oscim.core.Tile; //导入依赖的package包/类
public void update(GLViewport v) {
	double scale = (v.pos.scale * Tile.SIZE);

	float x = (float) ((mMapPosition.x - v.pos.x) * scale);
	float y = (float) ((mMapPosition.y - v.pos.y) * scale);
	float z = (float) (v.pos.scale / mMapPosition.scale);

	v.proj.get(projection.getValues());
	v.mvp.setTransScale(x, y, z);
	v.mvp.setValue(10, z);
	v.mvp.multiplyLhs(v.view);
	v.mvp.get(view.getValues());

	combined.set(projection);

	Matrix4.mul(combined.val, view.val);

	//if (updateFrustum) {
	invProjectionView.set(combined);
	Matrix4.inv(invProjectionView.val);
	frustum.update(invProjectionView);
	//}
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:24,代码来源:MapCamera.java


示例15: animateTo

import org.oscim.core.Tile; //导入依赖的package包/类
public synchronized void animateTo(GeoPoint geoPoint) {
	double f = Tile.SIZE << ABS_ZOOMLEVEL;

	mStartX = mAbsX * f;
	mStartY = mAbsY * f;

	mEndX = MercatorProjection.longitudeToX(geoPoint.getLongitude()) * f;
	mEndY = MercatorProjection.latitudeToY(geoPoint.getLatitude()) * f;

	mEndX -= mStartX;
	mEndY -= mStartY;

	mAnimMove = true;
	mAnimScale = false;
	mAnimFling = false;
	animStart(300);
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:18,代码来源:MapViewPosition.java


示例16: GLRenderer

import org.oscim.core.Tile; //导入依赖的package包/类
/**
 * @param mapView
 *            the MapView
 */
public GLRenderer(MapView mapView) {

	mMapView = mapView;
	mMapViewPosition = mapView.getMapViewPosition();
	mMapPosition = new MapPosition();

	mMatrices = new Matrices();

	// tile fill coords
	short min = (short) 0;
	short max = (short) (Tile.SIZE * COORD_SCALE);
	mFillCoords = new short[8];
	mFillCoords[0] = min;
	mFillCoords[1] = max;
	mFillCoords[2] = max;
	mFillCoords[3] = max;
	mFillCoords[4] = min;
	mFillCoords[5] = min;
	mFillCoords[6] = max;
	mFillCoords[7] = min;
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:26,代码来源:GLRenderer.java


示例17: MapTileLoader

import org.oscim.core.Tile; //导入依赖的package包/类
/**
 */
public MapTileLoader(TileManager tileManager) {
	super(tileManager);

	mClipper = new LineClipper(0, 0, Tile.SIZE, Tile.SIZE, true);

	//		MapElement m = mDebugWay = new MapElement();
	//		m.startLine();
	//		int s = Tile.SIZE;
	//		m.addPoint(0, 0);
	//		m.addPoint(0, s);
	//		m.addPoint(s, s);
	//		m.addPoint(s, 0);
	//		m.addPoint(0, 0);
	//		m.tags = new Tag[] { new Tag("debug", "box") };
	//		m.type = GeometryType.LINE;
	//
	//		m = mDebugPoint = new MapElement();
	//		m.startPoints();
	//		m.addPoint(s >> 1, 10);
	//		m.type = GeometryType.POINT;
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:24,代码来源:MapTileLoader.java


示例18: executeJob

import org.oscim.core.Tile; //导入依赖的package包/类
@Override
public boolean executeJob(MapTile tile) {
	Log.d(TAG, "load tile " + tile);
	tile.layers = new Layers();

	LineLayer ll = tile.layers.getLineLayer(0);
	ll.line = mLineStyle;
	ll.width = 2;

	int m = 20;
	int s = Tile.SIZE - m * 2;
	GeometryBuffer g = mGeom;

	g.clear();
	g.startLine();
	g.addPoint(m, m);
	g.addPoint(m, s);
	g.addPoint(s, s);
	g.addPoint(s, m);
	g.addPoint(m, m);

	ll.addLine(g);

	return true;
}
 
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:26,代码来源:TestTileLayer.java


示例19: update

import org.oscim.core.Tile; //导入依赖的package包/类
@Override
public synchronized void update(GLViewport v) {
    if (!v.changed() && !mUpdate) return;
    mMapPosition.copy(v.pos);

    double mx = v.pos.x;
    double my = v.pos.y;
    double scale = Tile.SIZE * v.pos.scale;
    mMap.viewport().getMapExtents(mBox, 100);
    long flip = (long) (Tile.SIZE * v.pos.scale) >> 1;

    /* check visibility */
    float symbolX = (float) ((mMapPoint.x - mx) * scale);
    float symbolY = (float) ((mMapPoint.y - my) * scale);

    if (symbolX > flip)
        symbolX -= (flip << 1);
    else if (symbolX < -flip)
        symbolX += (flip << 1);
    buckets.clear();
    if (!GeometryUtils.pointInPoly(symbolX, symbolY, mBox, 8, 0)) {
        return;
    }

    mMapPosition.bearing = -mMapPosition.bearing;
    if (arrowRegion == null) return;
    SymbolItem symbolItem = SymbolItem.pool.get();
    symbolItem.set(symbolX, symbolY, arrowRegion, this.arrowHeading, true);
    symbolItem.offset = CENTER_OFFSET;
    mSymbolBucket.pushSymbol(symbolItem);

    buckets.set(mSymbolBucket);
    buckets.prepare();
    buckets.compile(true);
    compile();
    mUpdate = false;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:38,代码来源:LocationRenderer.java


示例20: update

import org.oscim.core.Tile; //导入依赖的package包/类
@Override
public void update(GLViewport v) {
    buckets.clear();
    if (invalidLine || !layer.isEnabled()) {
        setReady(false);
        return;
    }

    mMapPosition.copy(v.pos);
    v.getMapExtents(buffer, 100f);
    for (int i = 0, n = 8; i < n; i++)
        MathUtils.clampToMinMax(buffer, i, MAX_VALUE);


    doubles[0] = v.pos.x;
    doubles[1] = v.pos.y;
    doubles[2] = Tile.SIZE * v.pos.scale;

    buffer[8] = (float) ((doubles[3] - doubles[0]) * doubles[2]);
    buffer[9] = (float) ((doubles[4] - doubles[1]) * doubles[2]);

    buffer[10] = (float) ((doubles[5] - doubles[0]) * doubles[2]);
    buffer[11] = (float) ((doubles[6] - doubles[1]) * doubles[2]);

    if (MathUtils.clampLineToIntersectRect(buffer, 0, 8, 12, 16) == 0) return;

    buckets.set(ll);
    g.clear();
    g.startLine();

    g.addPoint(buffer[10], buffer[11]);
    g.addPoint(buffer[8], buffer[9]);
    ll.addLine(g);
    compile();
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:36,代码来源:DirectLineLayer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XMLDTDContentModelSource类代码示例发布时间:2022-05-23
下一篇:
Java EffectivePolicyModifier类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap