Rename variables

This commit is contained in:
Alexander Sytnyk 2017-09-21 19:10:09 +03:00
parent 88c882d47d
commit 4e6af32c2d

View file

@ -141,46 +141,46 @@ public abstract class OsmandMapLayer {
public int calculatePath(RotatedTileBox tb, TIntArrayList xs, TIntArrayList ys, Path path) {
path.reset();
boolean start = false;
int px = xs.get(0);
int py = ys.get(0);
int h = tb.getPixHeight();
int w = tb.getPixWidth();
boolean segmentStarted = false;
int prevX = xs.get(0);
int prevY = ys.get(0);
int height = tb.getPixHeight();
int width = tb.getPixWidth();
int cnt = 0;
boolean pin = isIn(px, py, 0, 0, w, h);
boolean prevIn = isIn(prevX, prevY, 0, 0, width, height);
for (int i = 1; i < xs.size(); i++) {
int x = xs.get(i);
int y = ys.get(i);
boolean in = isIn(x, y, 0, 0, w, h);
int currX = xs.get(i);
int currY = ys.get(i);
boolean currIn = isIn(currX, currY, 0, 0, width, height);
boolean draw = false;
if (pin && in) {
if (prevIn && currIn) {
draw = true;
} else {
long intersection = MapAlgorithms.calculateIntersection(x, y, px, py, 0, w, h, 0);
long intersection = MapAlgorithms.calculateIntersection(currX, currY, prevX, prevY, 0, width, height, 0);
if (intersection != -1) {
if (pin && (i == 1)) {
if (prevIn && (i == 1)) {
cnt++;
path.moveTo(px, py);
start = true;
path.moveTo(prevX, prevY);
segmentStarted = true;
}
px = (int) (intersection >> 32);
py = (int) (intersection & 0xffffffff);
prevX = (int) (intersection >> 32);
prevY = (int) (intersection & 0xffffffff);
draw = true;
}
}
if (draw) {
if (!start) {
if (!segmentStarted) {
cnt++;
path.moveTo(px, py);
path.moveTo(prevX, prevY);
segmentStarted = true;
}
path.lineTo(x, y);
start = true;
path.lineTo(currX, currY);
} else {
start = false;
segmentStarted = false;
}
pin = in;
px = x;
py = y;
prevIn = currIn;
prevX = currX;
prevY = currY;
}
return cnt;
}