Rendering of regular shapes

Topics: Bugs
Feb 25, 2012 at 11:57 PM
Edited Feb 25, 2012 at 11:59 PM

Hi!

First, thank you for that great control!

I think, there is a bug in rendering of regular shapes (in Windows Forms). In old version (cf74894b9a5c (19.4.2011)) it is ok, but in new versions it's wrong. Can you please fix it?

Thanks

Here is image of this bug:

Coordinator
Feb 26, 2012 at 12:07 AM

i don't have telepathic abilities yet, so provide more info ;}

Feb 26, 2012 at 12:41 AM
Edited Mar 7, 2012 at 9:45 PM

:-)

Here is my code:

Drawing:

List<PointLatLng> PointS = new List<PointLatLng>();

PointS.Add(new PointLatLng(49.8761111111111, 18.2186111111111));
PointS.Add(new PointLatLng(49.8761111111111, 18.2188888888889));
PointS.Add(new PointLatLng(49.8761111111111, 18.2191666666667));
PointS.Add(new PointLatLng(49.8761111111111, 18.2194444444444));
PointS.Add(new PointLatLng(49.8761111111111, 18.2197222222222));
PointS.Add(new PointLatLng(49.8763888888889, 18.2186111111111));
PointS.Add(new PointLatLng(49.8763888888889, 18.2188888888889));
PointS.Add(new PointLatLng(49.8763888888889, 18.2191666666667));
PointS.Add(new PointLatLng(49.8763888888889, 18.2194444444444));
PointS.Add(new PointLatLng(49.8763888888889, 18.2197222222222));

foreach (PointLatLng pointS in PointS)
{
 GMapMarker markerA = new GMapMarkerBlank(new PointLatLng(pointS.Lat + 0.00027777777777777777777777777777778 / 2, pointS.Lng - 0.00027777777777777777777777777777778 / 2));
 GMapMarker markerB = new GMapMarkerBlank(new PointLatLng(pointS.Lat - 0.00027777777777777777777777777777778 / 2, pointS.Lng + 0.00027777777777777777777777777777778 / 2));

 objects.Markers.Add(markerA);
 objects.Markers.Add(markerB);

 GMapMarkerPolygon mBorders;
 mBorders = new GMapMarkerPolygon(markerA.Position, markerB) { Color = Color.Orange };

 objects.Markers.Add(mBorders);
}

And class:

public class GMapMarkerBlank : GMapMarker
{
 public GMapMarkerBlank(PointLatLng p)
  : base(p)
 {
 }
}

public class GMapMarkerPolygon : GMapMarker
{
 public Color Color { get; set; }
 public GMapMarker MarkerB { get; set; }

 public GMapMarkerPolygon(PointLatLng pointA, GMapMarker markerB)
  : base(pointA)
 {
  this.MarkerB = markerB;
 }

 public override void OnRender(Graphics g)
 {
  PointF p1, p2, p3, p4;
  p1 = new PointF(LocalPosition.X, MarkerB.LocalPosition.Y);
  p2 = new PointF(MarkerB.LocalPosition.X, MarkerB.LocalPosition.Y);
  p3 = new PointF(MarkerB.LocalPosition.X, LocalPosition.Y);
  p4 = new PointF(LocalPosition.X, LocalPosition.Y);

  PointF[] points = { p1, p2, p3, p4 };

  g.FillPolygon(new SolidBrush(System.Drawing.Color.FromArgb(255, Color.R, Color.G, Color.B)), points);
 }
}

Mar 7, 2012 at 9:34 PM

I found, that the problem only occurs in Czech* maps providers, so there is maybe problem in MapyCZProjection. And there is also problem with zoom in Czech* maps.

Can you please fix these problems? Thanks

Coordinator
Mar 7, 2012 at 9:44 PM

whats the problem?

Mar 7, 2012 at 9:51 PM
Edited Mar 7, 2012 at 9:51 PM

The problem is, that rectangles are wrongly rendered. When I use Czech maps they are displayed as in the right top image, and this is wrong. When I use Google map they are displayed correctly as in the left top image. You can use my code to see this.

Coordinator
Mar 7, 2012 at 10:09 PM
Edited Mar 7, 2012 at 10:09 PM

your code doesn't render anything

Mar 7, 2012 at 10:11 PM

Try go to 49.8761111111111, 18.2186111111111

There are small shapes (30mx30m)

Coordinator
Mar 7, 2012 at 10:21 PM
Edited Mar 7, 2012 at 10:28 PM

..man can't you make it bigger ;/

Coordinator
Mar 7, 2012 at 10:28 PM
Edited Mar 7, 2012 at 10:28 PM

..well you made a mistake: new PointLatLng(pointS.Lat - 0.00027777777777777777777777777777778 / 2, pointS.Lng + 0.00027777777777777777777777777777778 / 2)

if you want precision, render using pixels, not lat/lng

Mar 7, 2012 at 10:30 PM

OK, but why this occur only in Czech maps?

Coordinator
Mar 7, 2012 at 10:40 PM

because they use very complicated and nonstandard map projection, so the point to point conversions are not very accurate

Mar 7, 2012 at 10:41 PM

OK, thanks for your support