Quantcast
Channel: GMap.NET - Great Maps for Windows Forms & Presentation
Viewing all articles
Browse latest Browse all 3384

Commented Issue: Bearing [16044]

$
0
0
Bearing was not working at least since 1.6. I'm not sure if I'm doing it correctly but now ti's working for me.

since it's only in 1 file, I'll paste the diff here.

--- C:/Users/JFDionne/Downloads/greatmaps-6ccafda5ce5d/greatmaps_6ccafda5ce5d/GMap.NET.WindowsForms/GMap.NET.WindowsForms/GMapControl.cs Mon Jul 16 16:13:00 2012
+++ GMapControl.cs Mon Jul 16 17:58:47 2012
@@ -1112,10 +1112,17 @@
{
if(IsHandleCreated)
{
- // need to fix in rotated mode usinf rotationMatrix
- // ...
- Core.DragOffset(new GPoint(x, y));
+ if (IsRotated)
+ {
+ System.Drawing.Point[] p = new System.Drawing.Point[] { new System.Drawing.Point(x, y) };
+ rotationMatrixInvert.TransformVectors(p);
+ x = (int)p[0].X ;
+ y = (int)p[0].Y ;
+
+ }

+ Core.DragOffset(new GPoint(x, y));
+
ForceUpdateOverlays();
}
}
@@ -1385,6 +1392,8 @@
e.Graphics.TranslateTransform(Core.renderOffset.X, Core.renderOffset.Y);

DrawMap(e.Graphics);
+ e.Graphics.ResetTransform();
+ e.Graphics.TranslateTransform(Core.renderOffset.X, Core.renderOffset.Y);
OnPaintOverlays(e.Graphics);

#endregion
@@ -1451,45 +1460,45 @@
}
set
{
- //if(Core.bearing != value)
- //{
- // bool resize = Core.bearing == 0;
- // Core.bearing = value;
+ if (Core.bearing != value)
+ {
+ bool resize = Core.bearing == 0;
+ Core.bearing = value;

- // //if(VirtualSizeEnabled)
- // //{
- // // c.X += (Width - Core.vWidth) / 2;
- // // c.Y += (Height - Core.vHeight) / 2;
- // //}
+ //if(VirtualSizeEnabled)
+ //{
+ // c.X += (Width - Core.vWidth) / 2;
+ // c.Y += (Height - Core.vHeight) / 2;
+ //}

- // UpdateRotationMatrix();
+ UpdateRotationMatrix();

- // if(value != 0 && value % 360 != 0)
- // {
- // Core.IsRotated = true;
+ if (value != 0 && value % 360 != 0)
+ {
+ Core.IsRotated = true;

- // if(Core.tileRectBearing.Size == Core.tileRect.Size)
- // {
- // Core.tileRectBearing = Core.tileRect;
- // Core.tileRectBearing.Inflate(1, 1);
- // }
- // }
- // else
- // {
- // Core.IsRotated = false;
- // Core.tileRectBearing = Core.tileRect;
- // }
+ if (Core.tileRectBearing.Size == Core.tileRect.Size)
+ {
+ Core.tileRectBearing = Core.tileRect;
+ Core.tileRectBearing.Inflate(1, 1);
+ }
+ }
+ else
+ {
+ Core.IsRotated = false;
+ Core.tileRectBearing = Core.tileRect;
+ }

- // if(resize)
- // {
- // Core.OnMapSizeChanged(Width, Height);
- // }
+ if (resize)
+ {
+ Core.OnMapSizeChanged(Width, Height);
+ }

- // if(!HoldInvalidation && Core.IsStarted)
- // {
- // ForceUpdateOverlays();
- // }
- //}
+ if (!HoldInvalidation && Core.IsStarted)
+ {
+ ForceUpdateOverlays();
+ }
+ }
}
}
#endif
@@ -1954,17 +1963,17 @@
else
{
#if !PocketPC
- Core.mouseCurrent = ApplyRotationInversion(e.X, e.Y);
+ Core.mouseCurrent = ApplyRotationInversion(e.X, e.Y);
#else
Core.mouseCurrent = new GPoint(e.X, e.Y);
#endif
Core.Drag(Core.mouseCurrent);

#if !PocketPC
- if(MobileMode)
- {
+ //if(MobileMode)
+ //{
ForceUpdateOverlays();
- }
+ //}
#else
ForceUpdateOverlays();
#endif


Comments: tpittma2 hi, Great work, the code is working for me too.

Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>