/// <summary> /// construct /// </summary> public GMapControl() { if (!DesignModeInConstruct && !IsDesignerHosted) { WindowsFormsImageProxy wimg = new WindowsFormsImageProxy(); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.Opaque, true); ResizeRedraw = true; TileFlipXYAttributes.SetWrapMode(WrapMode.TileFlipXY); GMaps.Instance.ImageProxy = wimg; // to know when to invalidate Core.OnNeedInvalidation += new NeedInvalidation(Core_OnNeedInvalidation); Core.currentRegion = new Rectangle(-50, -50, Size.Width + 100, Size.Height + 100); CenterFormat.Alignment = StringAlignment.Center; CenterFormat.LineAlignment = StringAlignment.Center; BottomFormat.Alignment = StringAlignment.Center; BottomFormat.LineAlignment = StringAlignment.Far; if (GMaps.Instance.IsRunningOnMono) { // no imports to move pointer MouseWheelZoomType = GMap.NET.MouseWheelZoomType.MousePositionWithoutCenter; } } }
private double zoomElevateUpscale = 1024 * 8; //1024; #endregion Fields #region Constructors public LayerTiles() { Datum datumWGS84Sphere = CoordSysFactory.CreateDatum(Ellipsoid.Sphere, 0, 0, 0, 0, 0, 0, 0, 0); double r = datumWGS84Sphere.SemiMajorAxis; // scale =256/360, offset=128, this is calculated for zoom=0 (one tile) // converts merc deg (-180;180 , -90;90) into pixels (0;256 , 0;256) AffineTransform affineTransform = new AffineTransform(); //zoomElevate = 1024; // zwieksz gestosc wspolrzednych o 10 pozomow zoom // affineTransform.MultiplyInPlace(256.0 / 360.0 * zoomElevateUpscale, -256.0 / 360.0 * zoomElevateUpscale); // affineTransform.OffsetInPlace(-128, 128); affineTransform.MultiplyInPlace(256.0 / (2.0 * Math.PI * r) * zoomElevateUpscale, -256.0 / (2.0 * Math.PI * r) * zoomElevateUpscale); affineTransform.OffsetInPlace(128 * zoomElevateUpscale, 128 * zoomElevateUpscale); layerCoordSys = new CoordSys(CoordSysType.Mercator, datumWGS84Sphere, affineTransform); // depending o tile zoom lever (1,2,3,...,17) there is different AT // tiles loader WindowsFormsImageProxy wimg = new WindowsFormsImageProxy(); GMaps.Instance.ImageProxy = wimg; }