I'm trying to implement a custom gmap.net marker, containing rotated ellipse. The marker receives short and long axes as well as an azimuth. The problem is that ellipses are displayed at wrong locations. When the map is moving, the overlay of ellipses stays on its place. I guess that the reason it happens is using of TranslateTransform and RotateTransform functions. When I'm commenting them out - all the markers are displayed at correct locations and behave correctly.
The following is an example of a code I'm using at OnRender override:
public override void OnRender(Graphics g)
{
int centerX = this.LocalPosition.X - ShortAxis / 2;
int centerY = this.LocalPosition.Y - LongAxis) / 2;
g.TranslateTransform(this.LocalPosition.X, his.LocalPosition.Y);
g.DrawEllipse(Pen, centerX, centerY. ShortAxis, LongAxis);
g.RotateTransform((float)(this.Azimuth % 360);
g.ResetTransform();
}
I'm expecting ellipses will be drawn at correct locations and the overlay will behave like other map overlays.
After researching this topic, I came up with the following code that does its job: