Custom markers

Jan 22, 2009 at 9:38 AM
Thanks radioman for the FromLocalToLatLong method.!

I see that all your markers are compiled in the control. It would be nice to be able to add custom markers.

Maybe you could just add an CustomImage property in the Marker class of type System.Drawing.Bitmap that would be handled in the GMapControl.Drawmarker, something like:

 

foreach(Marker m in markers)

 

{

 

Point p = Manager.FromLatLngToPixel(m.Position, Zoom);

 

p.Offset(renderOffset);

 

if(m.Visible && this.Region.IsVisible(p))

 

{

    if (marker.CustomImage != null)
        g.DrawImageUnscaled(m.CustomImage,.....)
    else
    {
        switch (m.Type)
        {
                ...
Coordinator
Jan 22, 2009 at 9:42 AM
welcome, good idea!
Coordinator
Jan 22, 2009 at 9:50 AM
..where to set custom image center? ..with google markers i set it to middle bottom
Jan 22, 2009 at 9:51 AM
How about  enum  TOPLEFT, TOPMIDDLE, TOPRIGHT, MIDDLELEFT, etc
Coordinator
Jan 22, 2009 at 9:54 AM
okey ;}
Coordinator
Jan 22, 2009 at 10:08 AM
done, can you test it, if all aligment modes is good?
Jan 22, 2009 at 10:31 AM
Thanks, works for me! I'll do a some more testing later and let you know if there are any problems.
Coordinator
Jan 22, 2009 at 10:42 AM
great!
Jan 22, 2009 at 12:13 PM
Well, almost ok. You missed the tooltip in the DrawMarkers for the CustomMarker.

I think you could place the switch(m.Mode) outside of the switch(m.Type) not to repeat the code.

Also it'd be nice to have the method drawSimpleToolTip marked as virtua in order to customize.
Coordinator
Jan 22, 2009 at 6:36 PM
i'm not missed, it's just not complete, because custom markers have custom size with custom center aligment, so there is need for some calculations before drawing...

good point about virtual DrawSimpleToolTip!
Coordinator
Jan 24, 2009 at 11:50 AM
done!