Lee Armstrong
Lee Armstrong

Reputation: 11450

Rotate drawable in OverlayItem

I have a mapview that has a custom item per OverlayItem and the class is here.

 class MapObject extends OverlayItem{

 String name;
 String heading;

 Drawable marker = null;

PlaneObject(GeoPoint pt, String name, String snippet, Drawable marker){
    super(pt,name,snippet);
    this.marker = marker;
}

@Override
public Drawable getMarker(int stateBitset){
    Drawable result = marker;
    setState(result,stateBitset);
    result.setBounds(-result.getIntrinsicWidth()/2, -result.getIntrinsicHeight(), result.getIntrinsicWidth() /2, 0);
    //Want to rotate the drawable to the angle stored in the heading variable
    return(result); 
}   

}

I would like to be able to rotate the Drawable by the heading within the class so when the mapView calls it then it will return the rotated drawable.

Upvotes: 0

Views: 2199

Answers (1)

Idistic
Idistic

Reputation: 6311

Take a look at this (change the signature to actually return the drawable!)

Rotate Bitmap to Match Bearing

Upvotes: 1

Related Questions