| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using DevExpress.XtraMap;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Ips.Library.DxpLib
- {
- public static class MapControlExtensions
- {
- public static void InitIpsOptions(this MapControl mapControl, IpsMapOption options = null)
- {
- if (options == null) options = new IpsMapOption();
- mapControl.CenterPoint = new GeoPoint(24.5408, 118.9236);
- mapControl.ZoomLevel = options.ZoomLevel;
- mapControl.EnableAnimation = false;
- mapControl.EnableRotation = false;
- mapControl.NavigationPanelOptions.Height = 20;
- mapControl.NavigationPanelOptions.BackgroundStyle.Fill = Color.Transparent;
- mapControl.NavigationPanelOptions.CoordinatesStyle.Font = new Font("Consolas", 9F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));
- mapControl.NavigationPanelOptions.Height = 20;
- mapControl.NavigationPanelOptions.ShowKilometersScale = false;
- mapControl.NavigationPanelOptions.ShowMilesScale = false;
- mapControl.NavigationPanelOptions.ShowScrollButtons = false;
- mapControl.NavigationPanelOptions.ShowZoomTrackbar = false;
- mapControl.NavigationPanelOptions.XCoordinatePattern = "{D:3}°{CP}";
- mapControl.NavigationPanelOptions.YCoordinatePattern = "{D:3}°{CP}";
- mapControl.NavigationPanelOptions.CoordinatesStyle.TextColor = System.Drawing.Color.Black;
- (mapControl.CoordinateSystem as GeoMapCoordinateSystem).CircularScrollingMode = options.CircularScrollingMode;
-
- mapControl.Layers.Insert(0, CreateImageLayer(MapConsts.NormalMapNum));
- }
- public static ImageLayer CreateImageLayer(int maptype)
- {
- var imageLayer = new ImageLayer();
- ImageTileDataProvider tileDataProvider = new ImageTileDataProvider();
- var tileSource = new SqliteTileGenerator();
- tileSource.MapType = maptype;
- tileDataProvider.TileSource = tileSource;
- imageLayer.DataProvider = tileDataProvider;
- return imageLayer;
- }
- }
- public class IpsMapOption
- {
- public double ZoomLevel { get; set; } = 3d;
- public CircularScrollingMode CircularScrollingMode { get; set; } = CircularScrollingMode.TilesAndVectorItems;
- }
- }
|