/// <summary> /// Adds map element to the new layout. /// </summary> /// <param name="mapScale">The map scale.</param> /// <param name="extents">The extents.</param> private void AddMapElement(int mapScale, IEnvelope extents) { var map = _context.Map; var mapElement = new LayoutMap(); mapElement.Initialize(map, View.LayoutControl); mapElement.IsMain = true; mapElement.TileProvider = _context.Map.TileProvider; mapElement.LocationF = new PointF(PrintingConstants.DefaultMapOffset, PrintingConstants.DefaultMapOffset); mapElement.DrawTiles = map.Tiles.Visible; // calc the necessary size in paper coordinates GeoSize size; if (map.GetGeodesicSize(extents, out size)) { mapElement.SizeF = LayoutScaleHelper.CalcMapSize(mapScale, size, extents.Width / extents.Height); mapElement.Envelope = extents.Clone(); mapElement.Initialized = true; View.LayoutControl.AddToLayout(mapElement); View.LayoutControl.UpdateLayout(); View.LayoutControl.ZoomFitToScreen(); } }
private void AddMap() { var map = new LayoutMap(); map.Initialize(_map, _layoutControl); map.Envelope = _view.Model.Extents; map.TileProvider = _context.Map.TileProvider; _layoutControl.AddElementWithMouse(map); }