cleanups
This commit is contained in:
parent
dae474922a
commit
fbc39c65cb
@ -98,6 +98,7 @@ public class MapViewPosition {
|
||||
mapPosition.angle = mRotation;
|
||||
mapPosition.zoomLevel = mZoomLevel;
|
||||
mapPosition.scale = mScale;
|
||||
|
||||
byte z = mZoomLevel;
|
||||
mapPosition.x = MercatorProjection.longitudeToPixelX(mLongitude, z);
|
||||
mapPosition.y = MercatorProjection.latitudeToPixelY(mLatitude, z);
|
||||
@ -114,7 +115,7 @@ public class MapViewPosition {
|
||||
// updateMatrix();
|
||||
|
||||
// not so sure about this, but works...
|
||||
float tilt = FloatMath.sin((float) Math.toRadians(mTilt)) * 4;
|
||||
float tilt = (float) Math.sin(Math.toRadians(mTilt)) * 4;
|
||||
|
||||
unproject(-1, 1, tilt, coords, 0); // top-left
|
||||
unproject(1, 1, tilt, coords, 2); // top-right
|
||||
@ -365,6 +366,21 @@ public class MapViewPosition {
|
||||
updateMatrix();
|
||||
}
|
||||
|
||||
public boolean tilt(float move) {
|
||||
float tilt = mTilt + move;
|
||||
if (tilt > MAX_ANGLE)
|
||||
tilt = MAX_ANGLE;
|
||||
else if (tilt < 0)
|
||||
tilt = 0;
|
||||
|
||||
if (mTilt == tilt)
|
||||
return false;
|
||||
|
||||
mTilt = tilt;
|
||||
updateMatrix();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setTilt(float f) {
|
||||
mTilt = f;
|
||||
updateMatrix();
|
||||
@ -433,16 +449,4 @@ public class MapViewPosition {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean tilt(float moveX) {
|
||||
float tilt = mTilt + moveX;
|
||||
if (tilt > MAX_ANGLE)
|
||||
tilt = MAX_ANGLE;
|
||||
else if (tilt < 0)
|
||||
tilt = 0;
|
||||
if (mTilt == tilt)
|
||||
return false;
|
||||
|
||||
mTilt = tilt;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -417,8 +417,7 @@ public class TouchHandler
|
||||
if (mTimeEnd - mTimeStart > 150 || mSumScale > 1.1 || mSumScale < 0.9) {
|
||||
mBeginScale = true;
|
||||
scale = mSumScale;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class ScanBox {
|
||||
static Edge bc = new Edge();
|
||||
static Edge ca = new Edge();
|
||||
|
||||
static void scanSpans(Edge e0, Edge e1, float ymin, float ymax) {
|
||||
static void scanSpans(Edge e0, Edge e1) {
|
||||
|
||||
// sort edge by x-coordinate
|
||||
if (e0.x0 == e1.x0 && e0.y0 == e1.y0) {
|
||||
@ -86,8 +86,8 @@ public class ScanBox {
|
||||
|
||||
float x0, x1;
|
||||
|
||||
int y = (int) Math.max(ymin, FloatMath.floor(e1.y0));
|
||||
int bottom = (int) Math.min(ymax, FloatMath.ceil(e1.y1));
|
||||
int y = (int) Math.max(0, FloatMath.floor(e1.y0));
|
||||
int bottom = (int) Math.min(mMax, FloatMath.ceil(e1.y1));
|
||||
|
||||
for (; y < bottom; y++) {
|
||||
// float x0 = (m0 * Math.min(e0.dy, y + d0 - e0.y0) + e0.x0);
|
||||
@ -97,7 +97,7 @@ public class ScanBox {
|
||||
if (e0.dy < x0)
|
||||
x0 = e0.dy;
|
||||
|
||||
x0 = m0 * x0 + e0.x0;
|
||||
x0 = e0.x0 + m0 * x0;
|
||||
|
||||
if (x0 < 0)
|
||||
x0 = 0;
|
||||
@ -108,7 +108,7 @@ public class ScanBox {
|
||||
if (e1.dy < x1)
|
||||
x1 = e1.dy;
|
||||
|
||||
x1 = m1 * x1 + e1.x0;
|
||||
x1 = e1.x0 + m1 * x1;
|
||||
|
||||
if (x1 < 0)
|
||||
x1 = 0;
|
||||
@ -121,7 +121,7 @@ public class ScanBox {
|
||||
}
|
||||
}
|
||||
|
||||
static void scanTriangle(float ymin, float ymax) {
|
||||
static void scanTriangle() {
|
||||
|
||||
if (ab.dy > bc.dy) {
|
||||
Edge t = ab;
|
||||
@ -140,25 +140,28 @@ public class ScanBox {
|
||||
}
|
||||
|
||||
if (ab.dy != 0)
|
||||
scanSpans(ca, ab, ymin, ymax);
|
||||
scanSpans(ca, ab);
|
||||
|
||||
if (bc.dy != 0)
|
||||
scanSpans(ca, bc, ymin, ymax);
|
||||
scanSpans(ca, bc);
|
||||
}
|
||||
|
||||
private static int mMax;
|
||||
|
||||
public static void scan(float[] coords, TilesData tiles, int max) {
|
||||
sTiles = tiles;
|
||||
cntDoubles = 0;
|
||||
mMax = max;
|
||||
|
||||
ab.set(coords[0], coords[1], coords[2], coords[3]);
|
||||
bc.set(coords[2], coords[3], coords[4], coords[5]);
|
||||
ca.set(coords[4], coords[5], coords[0], coords[1]);
|
||||
scanTriangle();
|
||||
|
||||
scanTriangle(0, max);
|
||||
// Log.d("..", ">doubles " + cntDoubles);
|
||||
ab.set(coords[4], coords[5], coords[6], coords[7]);
|
||||
bc.set(coords[6], coords[7], coords[0], coords[1]);
|
||||
ca.set(coords[0], coords[1], coords[4], coords[5]);
|
||||
|
||||
scanTriangle(0, max);
|
||||
scanTriangle();
|
||||
|
||||
// Log.d("..", "<doubles " + cntDoubles);
|
||||
}
|
||||
|
@ -247,8 +247,7 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
|
||||
@Override
|
||||
public void renderPointOfInterestCaption(Caption caption) {
|
||||
// Log.d(TAG, "renderPointOfInterestCaption: " + mPoiX + " " + mPoiY +
|
||||
// " "
|
||||
// + mTagName);
|
||||
// " " + mTagName);
|
||||
|
||||
if (mTagName == null)
|
||||
return;
|
||||
@ -430,8 +429,8 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
|
||||
mDebugDrawPolygons = !debugSettings.mDisablePolygons;
|
||||
mDebugDrawUnmatched = debugSettings.mDrawUnmatchted;
|
||||
|
||||
// fixed now....
|
||||
if (tile.newData || tile.isReady) {
|
||||
// fixed now....
|
||||
Log.d(TAG, "XXX tile already loaded "
|
||||
+ tile + " "
|
||||
+ tile.newData + " "
|
||||
@ -468,8 +467,7 @@ public class TileGenerator implements IRenderCallback, IMapDatabaseCallback {
|
||||
}
|
||||
|
||||
if (debugSettings.mDrawTileFrames) {
|
||||
mTagName = new Tag("name", countLines + " " + countNodes + " "
|
||||
+ tile.toString(), false);
|
||||
mTagName = new Tag("name", tile.toString(), false);
|
||||
mPoiX = Tile.TILE_SIZE >> 1;
|
||||
mPoiY = 10;
|
||||
TileGenerator.renderTheme.matchNode(this, debugTagWay, (byte) 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user