Missing mouseovers on some Markers

Topics: Bugs
Jun 30, 2013 at 4:54 AM
Edited Jun 30, 2013 at 4:55 AM
Hi radioman,

I've had a problem with some of the mouseovers not working on some of my markers.
To cut a long story very short :
After deserializing the overlays, adding any NEW Markers to the deserialized overlay would fail to have their 'Overlay' parameter set. This was due to missing OnChangeEvents on the deserialized Overlays. A fix that has worked me is calling CreateEvents() when the overlay has been deserialized and all appears good.
Below is the code change (single liner) - I'm don't know if this is the appropriate fix as I have not done extensive testing.

"GMapOverlay.cs"
protected GMapOverlay(SerializationInfo info, StreamingContext context)
{
         this.Id = info.GetString("Id");
         this.IsVisibile = info.GetBoolean("IsVisible");

         this.deserializedMarkerArray = Extensions.GetValue<GMapMarker[]>(info, "Markers", new GMapMarker[0]);
         this.deserializedRouteArray = Extensions.GetValue<GMapRoute[]>(info, "Routes", new GMapRoute[0]);
         this.deserializedPolygonArray = Extensions.GetValue<GMapPolygon[]>(info, "Polygons", new GMapPolygon[

         CreateEvents();     // By re-adding the events all seems good.  OlMogy ...

 }
Oh - this product is one best freebies I've come across. For me (a post grad student at 45yo) this has been such a wonderful find. Thankyou very much! I hope my small contribution is useful.

cheers
OlMogy ...
Coordinator
Jul 1, 2013 at 6:52 AM
thanks, fixed!
Jul 2, 2013 at 1:43 AM
radioman wrote:
thanks, fixed!
np - thankyou for such an excellent product!

I've just upgraded to the latest source and found that there is another small fix required. This one was suggested on the discussions somewhere here and I have lost the link, sorry. I added this one a couple of weeks ago and forgot about it. Another one liner :).
And thanks to original poster for this fix.

This is the fix ->
if (this.ToolTip != null) this.ToolTip.Marker = this;




CMapMarker.cs
protected GMapMarker(SerializationInfo info, StreamingContext context)
  {
     this.Position = Extensions.GetStruct<PointLatLng>(info, "Position", PointLatLng.Empty);
     this.Tag = Extensions.GetValue<object>(info, "Tag", null);
     this.Offset = Extensions.GetStruct<Point>(info, "Offset", Point.Empty);
     this.area = Extensions.GetStruct<Rectangle>(info, "Area", Rectangle.Empty);
     this.ToolTip = Extensions.GetValue<GMapToolTip>(info, "ToolTip", null);
     this.ToolTipMode = Extensions.GetStruct<MarkerTooltipMode>(info, "ToolTipMode", MarkerTooltipMode.OnMouseOver);
     this.ToolTipText = info.GetString("ToolTipText");
     this.IsVisible = info.GetBoolean("Visible");
     this.DisableRegionCheck = info.GetBoolean("DisableregionCheck");
     this.IsHitTestVisible = info.GetBoolean("IsHitTestVisible");

    // Fix missing reference in the tooltip to the marker object after deserialization
     if (this.ToolTip != null) this.ToolTip.Marker = this;
  }
Coordinator
Jul 2, 2013 at 7:48 AM
ok
Jul 2, 2013 at 12:51 PM
Hi radioman,

I have reviewed the change I posted above and possibly a neater way would be get the tooltip to save the its Marker.
I'm no expert with Serialization so just a thought...

I've tried this code out quickly and it also works to fix the issue.
Being a novice with the package I don't know of any possible side effects this may have.
Anwyay, thanks once again. Old Mogy ...
      protected GMapToolTip(SerializationInfo info, StreamingContext context)
      {
         this.Offset = Extensions.GetStruct<Point>(info, "Offset", Point.Empty);
         this.TextPadding = Extensions.GetStruct<Size>(info, "TextPadding", new Size(10, 10));
      
         this.Marker = Extensions.GetValue<GMapMarker>(info, "Marker");   <----  Deserialize GMapMarker ?
      }


      public void GetObjectData(SerializationInfo info, StreamingContext context)
      {
         info.AddValue("Offset", this.Offset);
         info.AddValue("TextPadding", this.TextPadding);

         info.AddValue("Marker", this.Marker);   // <-- serialize the GmarpMarker ?
      }
Coordinator
Jul 2, 2013 at 12:55 PM
it's probably ok too