@Override
public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) {
if (this.latLongs.isEmpty() || this.paintStroke == null) {
return;
}
if (this.boundingBox != null && !this.boundingBox.intersects(boundingBox)) {
return;
}
Iterator<LatLong> iterator = this.latLongs.iterator();
if (!iterator.hasNext()) {
return;
}
LatLong latLong = iterator.next();
long mapSize = MercatorProjection.getMapSize(zoomLevel, displayModel.getTileSize());
float x = (float) (MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize) - topLeftPoint.x);
float y = (float) (MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize) - topLeftPoint.y);
Path path = this.graphicFactory.createPath();
path.moveTo(x, y);
while (iterator.hasNext()) {
latLong = iterator.next();
x = (float) (MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize) - topLeftPoint.x);
y = (float) (MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize) - topLeftPoint.y);
path.lineTo(x, y);
}
if (this.keepAligned) {
this.paintStroke.setBitmapShaderShift(topLeftPoint);
}
canvas.drawPath(path, this.paintStroke);
}