sed 's/m\(in\|ax\)\(X\|Y\)/\L\2m\1/g'
This commit is contained in:
parent
c48c620963
commit
52813ea29f
@ -35,10 +35,10 @@ public class QuadTreeTest {
|
||||
ArrayList<Item> items = new ArrayList<Item>(numItems + 16);
|
||||
|
||||
for (int i = 0; i < numItems; i++) {
|
||||
box.minX = (int) (rand.nextDouble() * 10000 - 5000);
|
||||
box.minY = (int) (rand.nextDouble() * 10000 - 5000);
|
||||
box.maxX = (int) (box.minX + rand.nextDouble() * 500);
|
||||
box.maxY = (int) (box.minY + rand.nextDouble() * 500);
|
||||
box.xmin = (int) (rand.nextDouble() * 10000 - 5000);
|
||||
box.ymin = (int) (rand.nextDouble() * 10000 - 5000);
|
||||
box.xmax = (int) (box.xmin + rand.nextDouble() * 500);
|
||||
box.ymax = (int) (box.ymin + rand.nextDouble() * 500);
|
||||
|
||||
Item it = new Item(box, i);
|
||||
q.insert(box, it);
|
||||
@ -77,8 +77,8 @@ public class QuadTreeTest {
|
||||
}, it);
|
||||
|
||||
if (f == matched[0])
|
||||
out.println((it.bbox.maxX - it.bbox.minX)
|
||||
+ " x " + (it.bbox.maxY - it.bbox.minY)
|
||||
out.println((it.bbox.xmax - it.bbox.xmin)
|
||||
+ " x " + (it.bbox.ymax - it.bbox.ymin)
|
||||
+ " ==> " + it);
|
||||
}
|
||||
|
||||
@ -135,8 +135,8 @@ public class QuadTreeTest {
|
||||
int cnt = numItems;
|
||||
for (Item it : items) {
|
||||
if (!q.remove(it.bbox, it)) {
|
||||
out.println((it.bbox.maxX - it.bbox.minX)
|
||||
+ " x " + (it.bbox.maxY - it.bbox.minY)
|
||||
out.println((it.bbox.xmax - it.bbox.xmin)
|
||||
+ " x " + (it.bbox.ymax - it.bbox.ymin)
|
||||
+ " ==> " + it);
|
||||
|
||||
q.search(it.bbox, new SearchCb<Item>() {
|
||||
@ -160,8 +160,8 @@ public class QuadTreeTest {
|
||||
cnt = numItems;
|
||||
for (Item it : items) {
|
||||
if (!q.remove(it.bbox, it))
|
||||
out.println((it.bbox.maxX - it.bbox.minX)
|
||||
+ " x " + (it.bbox.maxY - it.bbox.minY)
|
||||
out.println((it.bbox.xmax - it.bbox.xmin)
|
||||
+ " x " + (it.bbox.ymax - it.bbox.ymin)
|
||||
+ " => " + it);
|
||||
|
||||
Assert.assertEquals(--cnt, q.size());
|
||||
@ -208,8 +208,8 @@ public class QuadTreeTest {
|
||||
}
|
||||
//Assert.assertEquals(cnt, found[0]);
|
||||
if (f == matched[0])
|
||||
out.println((it.bbox.maxX - it.bbox.minX)
|
||||
+ " x " + (it.bbox.maxY - it.bbox.minY)
|
||||
out.println((it.bbox.xmax - it.bbox.xmin)
|
||||
+ " x " + (it.bbox.ymax - it.bbox.ymin)
|
||||
+ " ==> " + it);
|
||||
}
|
||||
|
||||
|
@ -22,16 +22,16 @@ package org.oscim.core;
|
||||
public class Box {
|
||||
|
||||
/** The min x. */
|
||||
public double minX;
|
||||
public double xmin;
|
||||
|
||||
/** The max x. */
|
||||
public double maxX;
|
||||
public double xmax;
|
||||
|
||||
/** The min y. */
|
||||
public double minY;
|
||||
public double ymin;
|
||||
|
||||
/** The max y. */
|
||||
public double maxY;
|
||||
public double ymax;
|
||||
|
||||
/**
|
||||
* Instantiates a new Box with all values being 0.
|
||||
@ -43,23 +43,23 @@ public class Box {
|
||||
/**
|
||||
* Instantiates a new Box.
|
||||
*
|
||||
* @param minX the min x
|
||||
* @param minY the min y
|
||||
* @param maxX the max x
|
||||
* @param maxY the max y
|
||||
* @param xmin the min x
|
||||
* @param ymin the min y
|
||||
* @param xmax the max x
|
||||
* @param ymax the max y
|
||||
*/
|
||||
public Box(double minX, double minY, double maxX, double maxY) {
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
public Box(double xmin, double ymin, double xmax, double ymax) {
|
||||
this.xmin = xmin;
|
||||
this.ymin = ymin;
|
||||
this.xmax = xmax;
|
||||
this.ymax = ymax;
|
||||
}
|
||||
|
||||
public Box(Box bbox) {
|
||||
this.minX = bbox.minX;
|
||||
this.minY = bbox.minY;
|
||||
this.maxX = bbox.maxX;
|
||||
this.maxY = bbox.maxY;
|
||||
this.xmin = bbox.xmin;
|
||||
this.ymin = bbox.ymin;
|
||||
this.xmax = bbox.xmax;
|
||||
this.ymax = bbox.ymax;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,38 +70,38 @@ public class Box {
|
||||
* @return true, if point is inside box.
|
||||
*/
|
||||
public boolean contains(double x, double y) {
|
||||
return (x >= minX && x <= maxY && y >= minY && y <= maxY);
|
||||
return (x >= xmin && x <= ymax && y >= ymin && y <= ymax);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Box contains Point.
|
||||
*/
|
||||
public boolean contains(Point p) {
|
||||
return (p.x >= minX && p.x <= maxY && p.y >= minY && p.y <= maxY);
|
||||
return (p.x >= xmin && p.x <= ymax && p.y >= ymin && p.y <= ymax);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this Box is inside box.
|
||||
*/
|
||||
public boolean inside(Box box) {
|
||||
return minX >= box.minX && maxX <= box.maxX && minY >= box.minY && maxY <= box.maxY;
|
||||
return xmin >= box.xmin && xmax <= box.xmax && ymin >= box.ymin && ymax <= box.ymax;
|
||||
}
|
||||
|
||||
public double getWidth() {
|
||||
return maxX - minX;
|
||||
return xmax - xmin;
|
||||
}
|
||||
|
||||
public double getHeight() {
|
||||
return maxY - minY;
|
||||
return ymax - ymin;
|
||||
}
|
||||
|
||||
public boolean overlap(Box other) {
|
||||
return !(minX > other.maxX || maxX < other.minX || minY > other.maxY || maxY < other.minY);
|
||||
return !(xmin > other.xmax || xmax < other.xmin || ymin > other.ymax || ymax < other.ymin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + minX + ',' + minY + ',' + maxX + ',' + maxY + ']';
|
||||
return "[" + xmin + ',' + ymin + ',' + xmax + ',' + ymax + ']';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public class Animator {
|
||||
}
|
||||
|
||||
public synchronized void animateFling(float velocityX, float velocityY,
|
||||
int minX, int maxX, int minY, int maxY) {
|
||||
int xmin, int xmax, int ymin, int ymax) {
|
||||
|
||||
if (velocityX * velocityX + velocityY * velocityY < 2048)
|
||||
return;
|
||||
@ -166,8 +166,8 @@ public class Animator {
|
||||
float flingFactor = 240 / CanvasAdapter.dpi;
|
||||
mVelocity.x = velocityX * flingFactor;
|
||||
mVelocity.y = velocityY * flingFactor;
|
||||
mVelocity.x = clamp(mVelocity.x, minX, maxX);
|
||||
mVelocity.y = clamp(mVelocity.y, minY, maxY);
|
||||
mVelocity.x = clamp(mVelocity.x, xmin, xmax);
|
||||
mVelocity.y = clamp(mVelocity.y, ymin, ymax);
|
||||
if (Double.isNaN(mVelocity.x) || Double.isNaN(mVelocity.y)) {
|
||||
log.debug("fling NaN!");
|
||||
return;
|
||||
|
@ -196,10 +196,10 @@ public class Viewport {
|
||||
|
||||
/* scale map-pixel coordinates at current scale to
|
||||
* absolute coordinates and apply mercator projection. */
|
||||
double minLon = MercatorProjection.toLongitude(mMapBBox.minX);
|
||||
double maxLon = MercatorProjection.toLongitude(mMapBBox.maxX);
|
||||
double minLat = MercatorProjection.toLatitude(mMapBBox.maxY);
|
||||
double maxLat = MercatorProjection.toLatitude(mMapBBox.minY);
|
||||
double minLon = MercatorProjection.toLongitude(mMapBBox.xmin);
|
||||
double maxLon = MercatorProjection.toLongitude(mMapBBox.xmax);
|
||||
double minLat = MercatorProjection.toLatitude(mMapBBox.ymax);
|
||||
double maxLat = MercatorProjection.toLatitude(mMapBBox.ymin);
|
||||
|
||||
return new BoundingBox(minLat, minLon, maxLat, maxLon);
|
||||
}
|
||||
@ -211,22 +211,22 @@ public class Viewport {
|
||||
/**
|
||||
* Get the minimal axis-aligned BoundingBox that encloses
|
||||
* the visible part of the map. Sets box to map coordinates:
|
||||
* minX,minY,maxY,maxY
|
||||
* xmin,ymin,ymax,ymax
|
||||
*/
|
||||
public synchronized void getBBox(Box box, int expand) {
|
||||
float[] coords = mViewCoords;
|
||||
getMapExtents(coords, expand);
|
||||
|
||||
box.minX = coords[0];
|
||||
box.maxX = coords[0];
|
||||
box.minY = coords[1];
|
||||
box.maxY = coords[1];
|
||||
box.xmin = coords[0];
|
||||
box.xmax = coords[0];
|
||||
box.ymin = coords[1];
|
||||
box.ymax = coords[1];
|
||||
|
||||
for (int i = 2; i < 8; i += 2) {
|
||||
box.minX = Math.min(box.minX, coords[i]);
|
||||
box.maxX = Math.max(box.maxX, coords[i]);
|
||||
box.minY = Math.min(box.minY, coords[i + 1]);
|
||||
box.maxY = Math.max(box.maxY, coords[i + 1]);
|
||||
box.xmin = Math.min(box.xmin, coords[i]);
|
||||
box.xmax = Math.max(box.xmax, coords[i]);
|
||||
box.ymin = Math.min(box.ymin, coords[i + 1]);
|
||||
box.ymax = Math.max(box.ymax, coords[i + 1]);
|
||||
}
|
||||
|
||||
//updatePosition();
|
||||
@ -234,10 +234,10 @@ public class Viewport {
|
||||
double cx = mPos.x * cs;
|
||||
double cy = mPos.y * cs;
|
||||
|
||||
box.minX = (cx + box.minX) / cs;
|
||||
box.maxX = (cx + box.maxX) / cs;
|
||||
box.minY = (cy + box.minY) / cs;
|
||||
box.maxY = (cy + box.maxY) / cs;
|
||||
box.xmin = (cx + box.xmin) / cs;
|
||||
box.xmax = (cx + box.xmax) / cs;
|
||||
box.ymin = (cy + box.ymin) / cs;
|
||||
box.ymax = (cy + box.ymax) / cs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -730,27 +730,27 @@ public class MapDatabase implements ITileDataSource {
|
||||
|
||||
//log.debug(numCols + "/" + numRows + " " + mCurrentCol + " " + mCurrentRow);
|
||||
if (numRows > 0) {
|
||||
int minX = -2;
|
||||
int minY = -2;
|
||||
int maxX = Tile.SIZE + 2;
|
||||
int maxY = Tile.SIZE + 2;
|
||||
int xmin = -2;
|
||||
int ymin = -2;
|
||||
int xmax = Tile.SIZE + 2;
|
||||
int ymax = Tile.SIZE + 2;
|
||||
|
||||
int w = (int) (Tile.SIZE / (numCols + 1));
|
||||
int h = (int) (Tile.SIZE / (numRows + 1));
|
||||
|
||||
if (mCurrentCol > 0)
|
||||
minX = (int) (mCurrentCol * w);
|
||||
xmin = (int) (mCurrentCol * w);
|
||||
|
||||
if (mCurrentCol < numCols)
|
||||
maxX = (int) (mCurrentCol * w + w);
|
||||
xmax = (int) (mCurrentCol * w + w);
|
||||
|
||||
if (mCurrentRow > 0)
|
||||
minY = (int) (mCurrentRow * h);
|
||||
ymin = (int) (mCurrentRow * h);
|
||||
|
||||
if (mCurrentRow < numRows)
|
||||
maxY = (int) (mCurrentRow * h + h);
|
||||
//log.debug(minX + " " + minY + " " + maxX + " " + maxY);
|
||||
mTileClipper.setRect(minX, minY, maxX, maxY);
|
||||
ymax = (int) (mCurrentRow * h + h);
|
||||
//log.debug(xmin + " " + ymin + " " + xmax + " " + ymax);
|
||||
mTileClipper.setRect(xmin, ymin, xmax, ymax);
|
||||
} else {
|
||||
mTileClipper.setRect(-2, -2, Tile.SIZE + 2, Tile.SIZE + 2);
|
||||
}
|
||||
|
@ -26,10 +26,10 @@ public class QuadTree<T> extends BoxTree<BoxItem<T>, T> implements SpatialIndex<
|
||||
|
||||
private BoxItem<T> getBox(Box box) {
|
||||
BoxItem<T> it = boxPool.get();
|
||||
it.x1 = (int) box.minX;
|
||||
it.y1 = (int) box.minY;
|
||||
it.x2 = (int) box.maxX;
|
||||
it.y2 = (int) box.maxY;
|
||||
it.x1 = (int) box.xmin;
|
||||
it.y1 = (int) box.ymin;
|
||||
it.x2 = (int) box.xmax;
|
||||
it.y2 = (int) box.ymax;
|
||||
return it;
|
||||
}
|
||||
|
||||
|
@ -129,21 +129,21 @@ public class RTree<T> implements SpatialIndex<T>, Iterable<T> {
|
||||
static class Rect {
|
||||
|
||||
/** dimensions of bounding box */
|
||||
double minX, minY, maxX, maxY;
|
||||
double xmin, ymin, xmax, ymax;
|
||||
|
||||
public Rect() {
|
||||
}
|
||||
|
||||
public Rect(Box box) {
|
||||
if (DEBUG) {
|
||||
assert (minX <= maxX);
|
||||
assert (minY <= maxY);
|
||||
assert (xmin <= xmax);
|
||||
assert (ymin <= ymax);
|
||||
}
|
||||
|
||||
minX = box.minX;
|
||||
minY = box.minY;
|
||||
maxX = box.maxX;
|
||||
maxY = box.maxY;
|
||||
xmin = box.xmin;
|
||||
ymin = box.ymin;
|
||||
xmax = box.xmax;
|
||||
ymax = box.ymax;
|
||||
}
|
||||
|
||||
public Rect(double[] min, double[] max) {
|
||||
@ -153,48 +153,48 @@ public class RTree<T> implements SpatialIndex<T>, Iterable<T> {
|
||||
assert (min[index] <= max[index]);
|
||||
}
|
||||
|
||||
minX = min[0];
|
||||
minY = min[1];
|
||||
maxX = max[0];
|
||||
maxY = max[1];
|
||||
xmin = min[0];
|
||||
ymin = min[1];
|
||||
xmax = max[0];
|
||||
ymax = max[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the n-dimensional volume of a rectangle
|
||||
*/
|
||||
public double calcRectVolume() {
|
||||
return (maxX - minX) * (maxY - minY);
|
||||
return (xmax - xmin) * (ymax - ymin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide whether two rectangles overlap.
|
||||
*/
|
||||
public boolean overlap(Rect other) {
|
||||
return !(minX > other.maxX || maxX < other.minX || minY > other.maxY || maxY < other.minY);
|
||||
return !(xmin > other.xmax || xmax < other.xmin || ymin > other.ymax || ymax < other.ymin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine two rectangles into larger one containing both
|
||||
*/
|
||||
public void combine(Rect rectA, Rect rectB) {
|
||||
minX = Math.min(rectA.minX, rectB.minX);
|
||||
minY = Math.min(rectA.minY, rectB.minY);
|
||||
maxX = Math.max(rectA.maxX, rectB.maxX);
|
||||
maxY = Math.max(rectA.maxY, rectB.maxY);
|
||||
xmin = Math.min(rectA.xmin, rectB.xmin);
|
||||
ymin = Math.min(rectA.ymin, rectB.ymin);
|
||||
xmax = Math.max(rectA.xmax, rectB.xmax);
|
||||
ymax = Math.max(rectA.ymax, rectB.ymax);
|
||||
}
|
||||
|
||||
public void add(Rect rect) {
|
||||
minX = Math.min(minX, rect.minX);
|
||||
minY = Math.min(minY, rect.minY);
|
||||
maxX = Math.max(maxX, rect.maxX);
|
||||
maxY = Math.max(maxY, rect.maxY);
|
||||
xmin = Math.min(xmin, rect.xmin);
|
||||
ymin = Math.min(ymin, rect.ymin);
|
||||
xmax = Math.max(xmax, rect.xmax);
|
||||
ymax = Math.max(ymax, rect.ymax);
|
||||
}
|
||||
|
||||
public void set(Rect rect) {
|
||||
minX = rect.minX;
|
||||
minY = rect.minY;
|
||||
maxX = rect.maxX;
|
||||
maxY = rect.maxY;
|
||||
xmin = rect.xmin;
|
||||
ymin = rect.ymin;
|
||||
xmax = rect.xmax;
|
||||
ymax = rect.ymax;
|
||||
}
|
||||
|
||||
public void set(double[] min, double[] max) {
|
||||
@ -204,21 +204,21 @@ public class RTree<T> implements SpatialIndex<T>, Iterable<T> {
|
||||
}
|
||||
}
|
||||
|
||||
minX = min[0];
|
||||
minY = min[1];
|
||||
maxX = max[0];
|
||||
maxY = max[1];
|
||||
xmin = min[0];
|
||||
ymin = min[1];
|
||||
xmax = max[0];
|
||||
ymax = max[1];
|
||||
}
|
||||
|
||||
public void set(Box box) {
|
||||
if (DEBUG) {
|
||||
assert (box.minX <= box.maxX);
|
||||
assert (box.minY <= box.maxY);
|
||||
assert (box.xmin <= box.xmax);
|
||||
assert (box.ymin <= box.ymax);
|
||||
}
|
||||
minX = box.minX;
|
||||
minY = box.minY;
|
||||
maxX = box.maxX;
|
||||
maxY = box.maxY;
|
||||
xmin = box.xmin;
|
||||
ymin = box.ymin;
|
||||
xmax = box.xmax;
|
||||
ymax = box.ymax;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -486,8 +486,8 @@ public class RTree<T> implements SpatialIndex<T>, Iterable<T> {
|
||||
}
|
||||
|
||||
final static double mergedArea(Rect a, Rect b) {
|
||||
return ((a.maxX > b.maxX ? a.maxX : b.maxX) - (a.minX < b.minX ? a.minX : b.minX)
|
||||
* ((a.maxY > b.maxY ? a.maxY : b.maxY) - (a.minY < b.minY ? a.minY : b.minY)));
|
||||
return ((a.xmax > b.xmax ? a.xmax : b.xmax) - (a.xmin < b.xmin ? a.xmin : b.xmin)
|
||||
* ((a.ymax > b.ymax ? a.ymax : b.ymax) - (a.ymin < b.ymin ? a.ymin : b.ymin)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1290,7 +1290,7 @@ class Partition {
|
||||
// /** dimensions of bounding box */
|
||||
// double bounds[] = new double[NUMDIMS * 2];
|
||||
//
|
||||
// //double minX, minY, maxX, maxY;
|
||||
// //double xmin, ymin, xmax, ymax;
|
||||
//
|
||||
// public Rect() {
|
||||
// }
|
||||
|
@ -84,7 +84,7 @@ public abstract class ScanBox {
|
||||
private Edge bc = new Edge();
|
||||
private Edge ca = new Edge();
|
||||
|
||||
private int minX, maxX;
|
||||
private int xmin, xmax;
|
||||
|
||||
protected int mZoom;
|
||||
|
||||
@ -113,8 +113,8 @@ public abstract class ScanBox {
|
||||
if (min == max)
|
||||
max++;
|
||||
|
||||
minX = (int) min;
|
||||
maxX = (int) max;
|
||||
xmin = (int) min;
|
||||
xmax = (int) max;
|
||||
|
||||
// top-left -> top-right
|
||||
ab.set(box[0], box[1], box[2], box[3]);
|
||||
@ -210,11 +210,11 @@ public abstract class ScanBox {
|
||||
|
||||
int x1 = (int) Math.floor(e1.x0 + m1 * dy);
|
||||
|
||||
if (x1 < minX)
|
||||
x1 = minX;
|
||||
if (x1 < xmin)
|
||||
x1 = xmin;
|
||||
|
||||
if (x0 > maxX)
|
||||
x0 = maxX;
|
||||
if (x0 > xmax)
|
||||
x0 = xmax;
|
||||
|
||||
if (x1 < x0)
|
||||
setVisible(y, x1, x0);
|
||||
|
@ -26,25 +26,25 @@ import org.oscim.core.GeometryBuffer;
|
||||
* based on http://www.cs.rit.edu/~icss571/clipTrans/PolyClipBack.html
|
||||
*/
|
||||
public class TileClipper {
|
||||
private float minX;
|
||||
private float maxX;
|
||||
private float minY;
|
||||
private float maxY;
|
||||
private float xmin;
|
||||
private float xmax;
|
||||
private float ymin;
|
||||
private float ymax;
|
||||
|
||||
public TileClipper(float minX, float minY, float maxX, float maxY) {
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
mLineClipper = new LineClipper(minX, minY, maxX, maxY);
|
||||
public TileClipper(float xmin, float ymin, float xmax, float ymax) {
|
||||
this.xmin = xmin;
|
||||
this.ymin = ymin;
|
||||
this.xmax = xmax;
|
||||
this.ymax = ymax;
|
||||
mLineClipper = new LineClipper(xmin, ymin, xmax, ymax);
|
||||
}
|
||||
|
||||
public void setRect(float minX, float minY, float maxX, float maxY) {
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
mLineClipper.setRect(minX, minY, maxX, maxY);
|
||||
public void setRect(float xmin, float ymin, float xmax, float ymax) {
|
||||
this.xmin = xmin;
|
||||
this.ymin = ymin;
|
||||
this.xmax = xmax;
|
||||
this.ymax = ymax;
|
||||
mLineClipper.setRect(xmin, ymin, xmax, ymax);
|
||||
}
|
||||
|
||||
private final LineClipper mLineClipper;
|
||||
@ -157,20 +157,20 @@ public class TileClipper {
|
||||
for (int i = pointPos; i < end;) {
|
||||
float cx = in.points[i++];
|
||||
float cy = in.points[i++];
|
||||
if (cx > minX) {
|
||||
if (cx > xmin) {
|
||||
/* current is inside */
|
||||
if (px > minX) {
|
||||
if (px > xmin) {
|
||||
/* previous was inside */
|
||||
out.addPoint(cx, cy);
|
||||
} else {
|
||||
/* previous was outside, add edge point */
|
||||
out.addPoint(minX, py + (cy - py) * (minX - px) / (cx - px));
|
||||
out.addPoint(xmin, py + (cy - py) * (xmin - px) / (cx - px));
|
||||
out.addPoint(cx, cy);
|
||||
}
|
||||
} else {
|
||||
if (px > minX) {
|
||||
if (px > xmin) {
|
||||
/* previous was inside, add edge point */
|
||||
out.addPoint(minX, py + (cy - py) * (minX - px) / (cx - px));
|
||||
out.addPoint(xmin, py + (cy - py) * (xmin - px) / (cx - px));
|
||||
}
|
||||
/* else skip point */
|
||||
}
|
||||
@ -188,16 +188,16 @@ public class TileClipper {
|
||||
float cx = in.points[i++];
|
||||
float cy = in.points[i++];
|
||||
|
||||
if (cx < maxX) {
|
||||
if (px < maxX) {
|
||||
if (cx < xmax) {
|
||||
if (px < xmax) {
|
||||
out.addPoint(cx, cy);
|
||||
} else {
|
||||
out.addPoint(maxX, py + (cy - py) * (maxX - px) / (cx - px));
|
||||
out.addPoint(xmax, py + (cy - py) * (xmax - px) / (cx - px));
|
||||
out.addPoint(cx, cy);
|
||||
}
|
||||
} else {
|
||||
if (px < maxX) {
|
||||
out.addPoint(maxX, py + (cy - py) * (maxX - px) / (cx - px));
|
||||
if (px < xmax) {
|
||||
out.addPoint(xmax, py + (cy - py) * (xmax - px) / (cx - px));
|
||||
}
|
||||
}
|
||||
px = cx;
|
||||
@ -214,16 +214,16 @@ public class TileClipper {
|
||||
float cx = in.points[i++];
|
||||
float cy = in.points[i++];
|
||||
|
||||
if (cy < maxY) {
|
||||
if (py < maxY) {
|
||||
if (cy < ymax) {
|
||||
if (py < ymax) {
|
||||
out.addPoint(cx, cy);
|
||||
} else {
|
||||
out.addPoint(px + (cx - px) * (maxY - py) / (cy - py), maxY);
|
||||
out.addPoint(px + (cx - px) * (ymax - py) / (cy - py), ymax);
|
||||
out.addPoint(cx, cy);
|
||||
}
|
||||
} else {
|
||||
if (py < maxY) {
|
||||
out.addPoint(px + (cx - px) * (maxY - py) / (cy - py), maxY);
|
||||
if (py < ymax) {
|
||||
out.addPoint(px + (cx - px) * (ymax - py) / (cy - py), ymax);
|
||||
}
|
||||
}
|
||||
px = cx;
|
||||
@ -239,16 +239,16 @@ public class TileClipper {
|
||||
for (int i = pointPos; i < len;) {
|
||||
float cx = in.points[i++];
|
||||
float cy = in.points[i++];
|
||||
if (cy > minY) {
|
||||
if (py > minY) {
|
||||
if (cy > ymin) {
|
||||
if (py > ymin) {
|
||||
out.addPoint(cx, cy);
|
||||
} else {
|
||||
out.addPoint(px + (cx - px) * (minY - py) / (cy - py), minY);
|
||||
out.addPoint(px + (cx - px) * (ymin - py) / (cy - py), ymin);
|
||||
out.addPoint(cx, cy);
|
||||
}
|
||||
} else {
|
||||
if (py > minY) {
|
||||
out.addPoint(px + (cx - px) * (minY - py) / (cy - py), minY);
|
||||
if (py > ymin) {
|
||||
out.addPoint(px + (cx - px) * (ymin - py) / (cy - py), ymin);
|
||||
}
|
||||
}
|
||||
px = cx;
|
||||
|
@ -92,10 +92,10 @@ public class BoxTree<T extends BoxItem<E>, E> extends TileIndex<BoxNode<T>, T> {
|
||||
}
|
||||
|
||||
public BoxItem(org.oscim.core.Box box, T item) {
|
||||
this.x1 = (int) box.minX;
|
||||
this.y1 = (int) box.minY;
|
||||
this.x2 = (int) box.maxX;
|
||||
this.y2 = (int) box.maxY;
|
||||
this.x1 = (int) box.xmin;
|
||||
this.y1 = (int) box.ymin;
|
||||
this.x2 = (int) box.xmax;
|
||||
this.y2 = (int) box.ymax;
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user