本文整理汇总了Java中org.oscim.core.Tile类的典型用法代码示例。如果您正苦于以下问题:Java Tile类的具体用法?Java Tile怎么用?Java Tile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tile类属于org.oscim.core包,在下文中一共展示了Tile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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);
*/
}
}
示例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);
}
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
示例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());
}
}
示例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;
}
示例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();
}
}
示例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);
//}
}
示例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);
}