return;
}
if (position == Position.LEFT || position == Position.RIGHT) {
currentX = Math.floor(this.x) + 0.5;
commands.add(new MoveTo(currentX, y));
commands.add(new LineTo(0, -length, true));
trueLength = length - (gutterY * 2);
} else {
currentY = Math.floor(this.y) + 0.5;
commands.add(new MoveTo(x, currentY));
commands.add(new LineTo(length, 0, true));
trueLength = length - (gutterX * 2);
}
delta = trueLength / steps;
dashesX = Math.max(minorTickSteps + 1, 0);
dashesY = Math.max(minorTickSteps + 1, 0);
if (position == Position.LEFT || position == Position.RIGHT) {
currentY = y - gutterY;
if (position == Position.LEFT) {
currentX = x - dashSize * 2;
} else {
currentX = x;
}
while (currentY >= y - gutterY - trueLength) {
commands.add(new MoveTo(currentX, Math.floor(currentY) + 0.5));
commands.add(new LineTo(dashSize * 2 + 1, 0, true));
if (currentY != y - gutterY) {
for (int i = 1; i < dashesY; i++) {
commands.add(new MoveTo(currentX + dashSize, Math.floor(currentY + delta * i / dashesY) + 0.5));
commands.add(new LineTo(dashSize + 1, 0, true));
}
}
ticks.add(new PrecisePoint(Math.floor(x), Math.floor(currentY)));
currentY -= delta;
if (delta == 0) {
break;
}
}
if (Math.round(currentY + delta - (y - gutterY - trueLength)) != 0) {
commands.add(new MoveTo(currentX, Math.floor(y - length + gutterY) + 0.5));
commands.add(new LineTo(dashSize * 2 + 1, 0, true));
for (int i = 1; i < dashesY; i++) {
commands.add(new MoveTo(currentX + dashSize, Math.floor(currentY + delta * i / dashesY) + 0.5));
commands.add(new LineTo(dashSize + 1, 0, true));
}
ticks.add(new PrecisePoint(Math.floor(x), Math.floor(currentY)));
}
} else {
currentX = x + gutterX;
if (position == Position.BOTTOM) {
currentY = y - dashSize * 2;
} else {
currentY = y - dashSize * 4;
}
while (currentX <= x + gutterX + trueLength) {
commands.add(new MoveTo(Math.floor(currentX) + 0.5, currentY + 6));
commands.add(new LineTo(0, dashSize * 2 + 1, true));
if (currentX != x + gutterX) {
for (int i = 1; i < dashesX; i++) {
commands.add(new MoveTo(Math.floor(currentX - delta * i / dashesX) + 0.5, currentY + 6));
commands.add(new LineTo(0, dashSize + 1, true));
}
}
ticks.add(new PrecisePoint(Math.floor(currentX), Math.floor(y)));
currentX += delta;
if (delta == 0) {
break;
}
}
if (Math.round(currentX - delta - (x + gutterX + trueLength)) != 0) {
commands.add(new MoveTo(Math.floor(x + length - gutterX) + 0.5, currentY + 6));
commands.add(new LineTo(0, dashSize * 2 + 1, true));
for (int i = 1; i < dashesX; i++) {
commands.add(new MoveTo(Math.floor(x + length - gutterX - delta * i / dashesX) + 0.5, currentY + 6));
commands.add(new LineTo(0, dashSize + 1, true));
}
ticks.add(new PrecisePoint(Math.floor(currentX), Math.floor(y)));
}
}