Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public PNGOverlay(Bitmap original, GeoPoint topLeftGeoPoint, GeoPoint bottomRightGeoPoint) {
- this.original = Bitmap.createScaledBitmap(original, original.getWidth(), original.getHeight(), true);
- ...
- topGeoPoint = topLeftGeoPoint;
- bottomGeoPoint = bottomRightGeoPoint;
- }
- @Override
- public void draw(Canvas canvas, MapView mapView, boolean shadow) {
- super.draw(canvas, mapView, false);
- Projection projection = mapView.getProjection();
- Point leftTop = new Point();
- Point rightTop = new Point();
- Point rightBottom = new Point();
- Point leftBottom = new Point();
- projection.toPixels(topGeoPoint, leftTop);
- projection.toPixels(new GeoPoint(topGeoPoint.getLatitudeE6(), bottomGeoPoint.getLongitudeE6()), rightTop);
- projection.toPixels(bottomGeoPoint, rightBottom);
- projection.toPixels(new GeoPoint(bottomGeoPoint.getLatitudeE6(), topGeoPoint.getLongitudeE6()), leftBottom);
- ....
- Paint paint = new Paint();
- paint.setFilterBitmap(true);
- paint.setAntiAlias(true);
- canvas.drawBitmap(original, null, new Rect(leftTop.x, leftTop.y, rightBottom.x, rightBottom.y), paint);
- ....
- }
- mapview.getoverlays().add(overlay1);
- mapview.getoverlays().add(overlay2);
- mapview.getoverlays().add(overlay2);
- mapview.getoverlays().add(overlay1);
Add Comment
Please, Sign In to add comment