Rename variables
This commit is contained in:
parent
88c882d47d
commit
4e6af32c2d
1 changed files with 24 additions and 24 deletions
|
@ -141,46 +141,46 @@ public abstract class OsmandMapLayer {
|
||||||
|
|
||||||
public int calculatePath(RotatedTileBox tb, TIntArrayList xs, TIntArrayList ys, Path path) {
|
public int calculatePath(RotatedTileBox tb, TIntArrayList xs, TIntArrayList ys, Path path) {
|
||||||
path.reset();
|
path.reset();
|
||||||
boolean start = false;
|
boolean segmentStarted = false;
|
||||||
int px = xs.get(0);
|
int prevX = xs.get(0);
|
||||||
int py = ys.get(0);
|
int prevY = ys.get(0);
|
||||||
int h = tb.getPixHeight();
|
int height = tb.getPixHeight();
|
||||||
int w = tb.getPixWidth();
|
int width = tb.getPixWidth();
|
||||||
int cnt = 0;
|
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++) {
|
for (int i = 1; i < xs.size(); i++) {
|
||||||
int x = xs.get(i);
|
int currX = xs.get(i);
|
||||||
int y = ys.get(i);
|
int currY = ys.get(i);
|
||||||
boolean in = isIn(x, y, 0, 0, w, h);
|
boolean currIn = isIn(currX, currY, 0, 0, width, height);
|
||||||
boolean draw = false;
|
boolean draw = false;
|
||||||
if (pin && in) {
|
if (prevIn && currIn) {
|
||||||
draw = true;
|
draw = true;
|
||||||
} else {
|
} 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 (intersection != -1) {
|
||||||
if (pin && (i == 1)) {
|
if (prevIn && (i == 1)) {
|
||||||
cnt++;
|
cnt++;
|
||||||
path.moveTo(px, py);
|
path.moveTo(prevX, prevY);
|
||||||
start = true;
|
segmentStarted = true;
|
||||||
}
|
}
|
||||||
px = (int) (intersection >> 32);
|
prevX = (int) (intersection >> 32);
|
||||||
py = (int) (intersection & 0xffffffff);
|
prevY = (int) (intersection & 0xffffffff);
|
||||||
draw = true;
|
draw = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (draw) {
|
if (draw) {
|
||||||
if (!start) {
|
if (!segmentStarted) {
|
||||||
cnt++;
|
cnt++;
|
||||||
path.moveTo(px, py);
|
path.moveTo(prevX, prevY);
|
||||||
|
segmentStarted = true;
|
||||||
}
|
}
|
||||||
path.lineTo(x, y);
|
path.lineTo(currX, currY);
|
||||||
start = true;
|
|
||||||
} else {
|
} else {
|
||||||
start = false;
|
segmentStarted = false;
|
||||||
}
|
}
|
||||||
pin = in;
|
prevIn = currIn;
|
||||||
px = x;
|
prevX = currX;
|
||||||
py = y;
|
prevY = currY;
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue