本文整理汇总了Java中org.oscim.core.Tile.SIZE属性的典型用法代码示例。如果您正苦于以下问题:Java Tile.SIZE属性的具体用法?Java Tile.SIZE怎么用?Java Tile.SIZE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.oscim.core.Tile
的用法示例。
在下文中一共展示了Tile.SIZE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
@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);
}
示例2: NativeTileDataSink
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);
*/
}
}
示例3: setMatrix
/**
* Utility: Set matrices.mvp matrix relative to the difference of current
* MapPosition and mMapPosition.
* Use this to 'stick' your layer to the map.
*
* @param position
* current MapPosition
* @param matrices
* current Matrices
* @param project
* if true apply view- and projection, or just view otherwise.
*/
protected void setMatrix(MapPosition position, Matrices matrices, boolean project) {
MapPosition oPos = mMapPosition;
double tileScale = Tile.SIZE * position.scale;
double x = oPos.x - position.x;
double y = oPos.y - position.y;
// wrap around date-line
// while (x < -1)
// x += 1.0;
// while (x > 2)
// x -= 1.0;
matrices.mvp.setTransScale((float) (x * tileScale), (float) (y * tileScale),
(float) ((position.scale / oPos.scale) / GLRenderer.COORD_SCALE));
matrices.mvp.multiplyLhs(project ? matrices.viewproj : matrices.view);
}
示例4: update
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);
//}
}
示例5: doWork
/** 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;
}
示例6: MapTileLoader
/**
*/
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;
}
示例7: ExtrusionBucket
/**
* ExtrusionLayer for polygon geometries.
*/
public ExtrusionBucket(int level, float groundResolution, float[] colors) {
super(RenderBucket.EXTRUSION, true, false);
this.level = level;
this.colors = colors;
this.color = 0;
mGroundResolution = groundResolution;
mIndices = new VertexData[5];
for (int i = 0; i <= IND_MESH; i++)
mIndices[i] = new VertexData();
mClipper = new LineClipper(0, 0, Tile.SIZE, Tile.SIZE);
}
示例8: update
@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;
}
示例9: update
@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();
}
示例10: TransformTileDataSink
TransformTileDataSink(MapTile baseTile, MapTile tile, ITileDataSink mapDataSink) {
this.mapDataSink = mapDataSink;
int dz = tile.zoomLevel - baseTile.zoomLevel;
scale = (float) Math.pow(2, dz);
dx = (tile.tileX - (baseTile.tileX << dz)) * Tile.SIZE;
dy = (tile.tileY - (baseTile.tileY << 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);
}
示例11: GridRendererMT
public GridRendererMT(final int numLines, final LineStyle lineStyle, final TextStyle textStyle) {
final int size = Tile.SIZE;
/* not needed to set but we know: 16 lines 'a' two points */
mLines = new GeometryBuffer(2 * 16, 16);
final float pos = -size * 4;
/* 8 vertical lines */
for (int i = 0; i < 8 * numLines; i++) {
final float x = pos + i * size / numLines;
mLines.startLine();
mLines.addPoint(x, pos);
mLines.addPoint(x, pos + size * 8);
}
/* 8 horizontal lines */
for (int j = 0; j < 8 * numLines; j++) {
final float y = pos + j * size / numLines;
mLines.startLine();
mLines.addPoint(pos, y);
mLines.addPoint(pos + size * 8, y);
}
_textStyle = textStyle;
mLineBucket = new LineBucket(0);
mLineBucket.line = lineStyle;
if (_textStyle != null) {
mTextBucket = new TextBucket();
mTextBucket.next = mLineBucket;
} else {
mTextBucket = null;
mLineBucket.addLine(mLines);
buckets.set(mLineBucket);
}
}
示例12: parsePolygon
private void parsePolygon(ValueGetter data, boolean haveZ, boolean haveM) {
int count = data.getInt();
for (int i = 0; i < count; i++) {
if (i > 0)
mGeom.startHole();
int points = data.getInt();
for (int j = 0; j < points; j++) {
float x = (float) data.getDouble();
float y = (float) data.getDouble();
if (mFlipY)
y = Tile.SIZE - y;
// drop redundant closing point
if (j < points - 1)
mGeom.addPoint(x, y);
// ignore
if (haveZ)
data.getDouble();
if (haveM)
data.getDouble();
}
}
}
示例13: parsePolygon
private void parsePolygon(ValueGetter data, boolean haveZ, boolean haveM) {
int count = data.getInt();
for (int i = 0; i < count; i++) {
if (i > 0)
mGeom.startHole();
int points = data.getInt();
for (int j = 0; j < points; j++) {
float x = (float) data.getDouble();
float y = (float) data.getDouble();
if (mFlipY)
y = Tile.SIZE - y;
// drop redundant closing point
if (j < points - 1)
mGeom.addPoint(x, y);
// ignore
if (haveZ)
data.getDouble();
if (haveM)
data.getDouble();
}
}
}
示例14: init
public void init() {
if (mCurrentTiles != null)
mCurrentTiles.releaseTiles();
mIndex.drop();
/* Pass VBOs and VertexItems back to pools */
for (int i = 0; i < mTilesEnd; i++) {
MapTile t = mTiles[i];
if (t == null)
continue;
/* Check if tile is used by another thread */
if (!t.isLocked())
t.clear();
/* In case the tile is still loading or used by
* another thread: clear when returned from loader
* or becomes unlocked */
t.setState(DEADBEEF);
}
/* clear references to cached MapTiles */
Arrays.fill(mTiles, null);
mTilesEnd = 0;
mTilesCount = 0;
/* set up TileSet large enough to hold current tiles */
int num = Math.max(mMap.getWidth(), mMap.getHeight());
int size = Tile.SIZE >> 1;
int numTiles = (num * num) / (size * size) * 4;
mNewTiles = new TileSet(numTiles);
mCurrentTiles = new TileSet(numTiles);
}
示例15: fromScreenPoint
/**
* Get the map position for x,y in screen coordinates.
*
* @param x screen coordinate
* @param y screen coordinate
*/
public synchronized void fromScreenPoint(double x, double y, Point out) {
// scale to -1..1
float mx = (float) (1 - (x / mWidth * 2));
float my = (float) (1 - (y / mHeight * 2));
unproject(-mx, my, getDepth(-my), mu, 0);
double cs = mPos.scale * Tile.SIZE;
double cx = mPos.x * cs;
double cy = mPos.y * cs;
double dx = cx + mu[0];
double dy = cy + mu[1];
dx /= cs;
dy /= cs;
while (dx > 1)
dx -= 1;
while (dx < 0)
dx += 1;
if (dy > 1)
dy = 1;
else if (dy < 0)
dy = 0;
out.x = dx;
out.y = dy;
}