Marker Updates

Mar 9, 2009 at 8:54 AM
I have my markers displayed in real-time from vehcile tracker units. I'm updating the positions of the markers with long/lat , but what is the best
method of forcing the markers to be refreshed on the map, without calling a map.reloadmap (which i presume has the overhead of calculating and
fetching the tiles again) .  It is possible for me to update the positions of all my markers then call a method to simply redraw them, ?
Thanks
Mar 9, 2009 at 10:22 AM
Edited Mar 9, 2009 at 10:25 AM

..if you change marker position, just use, public void UpdateMarkerLocalPosition(MapObject marker), to update it's local position and Invalidate

foreach(MapObject obj in map.Markers)
{map.UpdateMarkerLocalPosition(obj);}
map.Invalidate(); // or map.ZoomAndCenterMarkers(), it sets maximum zoom for all markers and sets center

p.s. local positions is autoupdating too when you manualy draging the map or add/remove/insert item in Markers collection
Mar 10, 2009 at 8:46 AM
thats working perpect, thanks.  Is the tooltip coding working in WinForms yet ?
Mar 10, 2009 at 12:23 PM
it will soon ;}
Apr 7, 2009 at 7:37 PM
Hi Radioman. Still waiting eagerly for the tooltip functionality for WinForms markers... any idea as to when you'll make this available?
Cheers, and congratulations on an excellent project.
Apr 7, 2009 at 8:19 PM
thx for remainder this ;} tomorrow it shall be done!
Apr 8, 2009 at 7:11 PM
Now it IS! You can even override DrawToolTip if you want custom tooltip ;}
Apr 9, 2009 at 12:08 PM
10000 thanks radioman, its working perfect.

But i have only the last question:

When i placed two markers on exactly the same adress, the second tooltip of the markers are not really visible.
Can you give me some example code, which i can include in the windows.forms.dll ?

For example i have to guys which are living in one house , i only will see one marker. Thats ok. But i need two toolstrips NOT among each other popup when mouseOver. I need them next to each other to read both toolstrips.

I hope you can give me a little solution :-)

Thanks in advance

and much respect for your project.

Ronny
Apr 9, 2009 at 12:42 PM
i'll think about that
Apr 20, 2009 at 8:18 PM
Hi Radioman. In the latest fix of the WinForms marker tooltips, I notice you have a GmapMarkerRect object in the startup project, without which the marker tooltips do not work. Is it possible to put this item into the DLL project?

thanks
Ncami
Apr 21, 2009 at 5:31 AM
GmapMarkerRect is just one of the marker, you can use others or creat your own, it's just for demo, actualy in it i create two markers in the same position, and to rect marker with tooltip
Apr 29, 2009 at 2:09 PM
Edited Apr 29, 2009 at 2:34 PM
Hi Radioman,

I also have this problem. More than one marker on exact the same longlat. Only the last marker will give a tooltip.This is a workaround solution. Maybe you can save the last tooltip rectangle to put it beneath it, but now it is more a card look.

protected override void OnPaint(PaintEventArgs e)
        {
          .....
            if (MarkersEnabled && !(Form.ModifierKeys == Keys.Control))
            {
                foreach (GMapMarker m in Markers)
                {
                    if (m.Visible && region.Contains(m.LocalPosition.X, m.LocalPosition.Y))
                    {
                        m.OnRender(e.Graphics);
                    }
                }
                System.Collections.Generic.List<GMapNET.Point> pointsAlreadyHinted = new System.Collections.Generic.List<GMapNET.Point>();
                foreach (GMapMarker m in Markers)
                {
                    if (m.Visible && region.Contains(m.LocalPosition.X, m.LocalPosition.Y))
                    {

                        if (m.IsMouseOver && !string.IsNullOrEmpty(m.ToolTipText))
                        {
                            int howManyThisPoint = 0;
                            foreach (GMapNET.Point pnt in pointsAlreadyHinted)
                                if ((pnt.X == m.LocalPosition.X) && (pnt.Y == m.LocalPosition.Y))
                                    howManyThisPoint++;
                            DrawToolTip(e.Graphics, m, m.LocalPosition.X + howManyThisPoint * 15, m.LocalPosition.Y + howManyThisPoint * 20);
                            pointsAlreadyHinted.Add(m.LocalPosition);
                        }
                    }
                }
            }

Apr 29, 2009 at 4:48 PM
yes this is isue, but i have idea about spliting tooltips around, so they don't overlap each other, so just the question of time