private void drawPath(ShapePaintContainer shapePaintContainer, Point[][] coordinates, float dy) { this.path.clear(); for (Point[] innerList : coordinates) { Point[] points; if (dy != 0f) { points = RendererUtils.parallelPath(innerList, dy); } else { points = innerList; } if (points.length >= 2) { Point point = points[0]; this.path.moveTo((float) point.x, (float) point.y); for (int i = 1; i < points.length; ++i) { point = points[i]; this.path.lineTo((int) point.x, (int) point.y); } } } this.canvas.drawPath(this.path, shapePaintContainer.paint); }
float x = (float) (MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize) - topLeftPoint.x); float y = (float) (MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize) - topLeftPoint.y); path.moveTo(x, y); x = (float) (MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize) - topLeftPoint.x); y = (float) (MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize) - topLeftPoint.y); path.lineTo(x, y);
private void drawPath(ShapePaintContainer shapePaintContainer, Point[][] coordinates, float dy) { this.path.clear(); for (Point[] innerList : coordinates) { Point[] points; if (dy != 0f) { points = RendererUtils.parallelPath(innerList, dy); } else { points = innerList; } if (points.length >= 2) { Point point = points[0]; this.path.moveTo((float) point.x, (float) point.y); for (int i = 1; i < points.length; ++i) { point = points[i]; this.path.lineTo((int) point.x, (int) point.y); } } } this.canvas.drawPath(this.path, shapePaintContainer.paint); }
@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); }
float x = (float) (MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize) - topLeftPoint.x); float y = (float) (MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize) - topLeftPoint.y); path.moveTo(x, y); x = (float) (MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize) - topLeftPoint.x); y = (float) (MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize) - topLeftPoint.y); path.lineTo(x, y);