} else {
int directDist = (int)(c1.getDistanceTo(c2));
// Assure c1.x <= c2.x
if (c1.x > c2.x) {
Coordinate tmp = c1;
c1 = c2;
c2 = tmp;
}
Properties properties = quadMap.getProperties();
int width = properties.getScrollSize().x;
int ym = c2.y + (int)((double)(c1.y - c2.y)
* ((double)(width - c2.x) / (double)(width - c2.x + c1.x)));
int l1 = (int)(Math.sqrt(c1.x * c1.x + ((c1.y - ym) * (c1.y - ym))));
int l2 = (int)(Math.sqrt((width - c2.x) * (width - c2.x) + (ym - c2.y) * (ym - c2.y)));
if (directDist <= l1 + l2) {
if (dashed) {
drawDashedLine(c1, c2, g, dashLength);
} else {
drawLine(c1, c2, g);
}
} else {
if (dashed) {
drawDashedLine(new Coordinate(0, ym), c1, g, dashLength);
drawDashedLine(c2, new Coordinate(width - 1, ym), g, dashLength);
} else {
drawLine(new Coordinate(0, ym), c1, g);
drawLine(c2, new Coordinate(width - 1, ym), g);
}
}
}
}