android - MyLocationOverlay - Custom image, but no shadow -


i have application, uses custom implementation of mylocationoverlay.

in implementation set bitmap property used when has been specified, overload of draw.

it works nicely, using custom image, but doesn't display shadow - done automatically in itemizedoverlay.

can help?

here (the relevant code from) class:

public class locationoverlay: mylocationoverlay {     /// <summary>bitmap use indicating current fixed location.</summary>     public bitmap locationmarker { get; set; }      /// <summary>uses custom marker bitmap if 1 has been specified. otherwise, default used.</summary>     /// <param name="canvas"></param>     /// <param name="mapview"></param>     /// <param name="shadow"></param>     /// <param name="when"></param>     /// <returns></returns>     public override bool draw(canvas canvas, mapview mapview, bool shadow, long when)     {         var drawshadow = shadow;          if (locationmarker != null && lastfix != null)         {             var screenpoint = new point();             var geopoint = new geopoint((int)(lastfix.latitude * 1e6), (int)(lastfix.longitude * 1e6));             mapview.projection.topixels(geopoint, screenpoint);             canvas.drawbitmap(locationmarker, screenpoint.x, screenpoint.y - 32, null);             drawshadow = true;         }          base.draw(canvas, mapview, drawshadow);         return true;     } } 

i think you're missing point of shadow argument. map calls draw() method twice , tells whether shadow pass or not. doesn't draw shadow you. code this:

public override bool draw(canvas canvas, mapview mapview, bool shadow, long when) {     if (locationmarker != null && lastfix != null)     {         var screenpoint = new point();         var geopoint = new geopoint((int)(lastfix.latitude * 1e6), (int)(lastfix.longitude * 1e6));         mapview.projection.topixels(geopoint, screenpoint);          if(shadow)         {             // draw shadow bitmap here         }         else         {             canvas.drawbitmap(locationmarker, screenpoint.x, screenpoint.y - 32, null);         }     }      return true; } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -