gongqiuhong 1 anno fa
parent
commit
4a233dabe2

+ 15 - 0
XdCxRhDW.App/App.config

@@ -12,6 +12,9 @@
     <add key="Company" value="" />
     <!--本机IP,没有则由程序自动获取-->
     <add key="LocalIP" value="" />
+    <add key="ClientSettingsProvider.ServiceUri" value="" />
+	  <!--WMS地图IP-->
+	  <add key="WMSIP" value="192.168.1.5:8091" />
   </appSettings>
   <startup>
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
@@ -68,4 +71,16 @@
       </dependentAssembly>
     </assemblyBinding>
   </runtime>
+  <system.web>
+    <membership defaultProvider="ClientAuthenticationMembershipProvider">
+      <providers>
+        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
+      </providers>
+    </membership>
+    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
+      <providers>
+        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
+      </providers>
+    </roleManager>
+  </system.web>
 </configuration>

+ 108 - 18
XdCxRhDW.App/ExtensionsDev/MapControlEx.cs

@@ -15,6 +15,7 @@ using DxHelper;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
+using System.Configuration;
 using System.Data.Common;
 using System.Data.SQLite;
 using System.Drawing;
@@ -22,6 +23,7 @@ using System.Drawing.Imaging;
 using System.IO;
 using System.Linq;
 using System.Reflection;
+using System.Security.Policy;
 using System.Text;
 using System.Threading;
 using System.Windows.Forms;
@@ -771,35 +773,61 @@ public static class MapControlEx
     /// </summary>
     /// <param name="ctrl"></param>
     /// <param name="wmsURI">such as http://ows.mundialis.de/services/service</param>
+    /// <param name="wmsType"></param>
     /// <param name="layerName"></param>
     /// <returns></returns>
-    public static MapControl UseWMS(this MapControl ctrl, string wmsURI, string layerName)
+    public static MapControl UseWMS(this MapControl ctrl, EnumWmsType wmsType, string layerName)
     {
         if (ctrl is null)
         {
             throw new ArgumentNullException(nameof(ctrl));
         }
-
-        if (string.IsNullOrEmpty(wmsURI))
-        {
-            throw new ArgumentException($"“{nameof(wmsURI)}”不能为 null 或空。", nameof(wmsURI));
+        //if (string.IsNullOrEmpty(wmsURI))
+        //{
+        //    throw new ArgumentException($"“{nameof(wmsURI)}”不能为 null 或空。", nameof(wmsURI));
+        //}
+
+        //if (layerName is null)
+        //{
+        //    throw new ArgumentNullException(nameof(layerName));
+        //}
+        var wmsIp = ConfigurationManager.AppSettings["WMSIP"].Trim();
+        if (string.IsNullOrEmpty(wmsIp))
+        {
+            throw new ArgumentNullException("请在配置文件中配置WMSIP值");
         }
-
-        if (layerName is null)
+        if (wmsType == EnumWmsType.ZKXT)//中科星图
+        {
+            var provider = new WmsDataProvider();//地图瓦片提供者
+            provider.ServerUri =$"http://{wmsIp}/tilecache/service/wms";
+            if (!string.IsNullOrWhiteSpace(layerName))
+                provider.ActiveLayerName = layerName;
+            provider.CustomParameters.Add("format", "image/JPEG");
+            // provider.CustomParameters.Add("srs", "EPSG:4326");
+            var cs = (GeoMapCoordinateSystem)ctrl.CoordinateSystem;
+            cs.Projection = new EPSG4326Projection();
+            provider.ResponseCapabilities += (sender, e) =>
+            {
+                if (string.IsNullOrWhiteSpace(layerName))
+                    provider.ActiveLayerName = e.Layers[0].Name;
+            };
+            ctrl.GetImageLayer().DataProvider = provider;
+        }
+        if (wmsType == EnumWmsType.DataCenter)//数据中心
         {
-            throw new ArgumentNullException(nameof(layerName));
+            var provider = new HttpMapDataProvider();
+            var tileSource = provider.TileSource as HttpTileSource;
+            tileSource.HttpServerAddr = wmsIp;
+            ctrl.GetImageLayer().DataProvider = provider;
+            ctrl.MinZoomLevel=3; 
+            ctrl.MaxZoomLevel=20;
         }
-
-        var provider = new WmsDataProvider();//地图瓦片提供者
-        provider.ServerUri = wmsURI;
-        if (!string.IsNullOrWhiteSpace(layerName))
-            provider.ActiveLayerName = layerName;
-        provider.ResponseCapabilities += (sender, e) =>
+        if (wmsType == EnumWmsType.LW)//路网
         {
-            if (string.IsNullOrWhiteSpace(layerName))
-                provider.ActiveLayerName = e.Layers[0].Name;
-        };
-        ctrl.GetImageLayer().DataProvider = provider;
+            ctrl.MinZoomLevel = 3;
+            ctrl.MaxZoomLevel = 20;
+        }
+       
         return ctrl;
     }
 
@@ -2499,6 +2527,68 @@ public static class MapControlEx
             }
         }
     }
+
+    //class WMSMapDataProvider : WmsDataProvider
+    //{
+    //    public WMSMapDataProvider()
+    //    {
+    //       // TileSource = new wmsTileSource(this);
+    //    }
+
+    //    public override MapSize GetMapSizeInPixels(double zoomLevel)
+    //    {
+    //        double imageSize;
+    //        imageSize = wmsTileSource.CalculateTotalImageSize(zoomLevel);
+    //        return new MapSize(imageSize, imageSize);
+    //    }
+
+    //    protected override Size BaseSizeInPixels
+    //    {
+    //        get { return new Size(Convert.ToInt32(wmsTileSource.tileSize * 2), Convert.ToInt32(wmsTileSource.tileSize * 2)); }
+    //    }
+    //}
+    //class wmsTileSource : MapTileSourceBase
+    //{
+    //    public const int tileSize = 256;
+    //    public const int maxZoomLevel = 14;
+
+    //    public string HttpServerAddr { get; set; }
+
+    //    public GoogleMapType MapType { get; set; } = GoogleMapType.Normal;
+
+    //    internal static double CalculateTotalImageSize(double zoomLevel)
+    //    {
+    //        if (zoomLevel < 1.0)
+    //            return zoomLevel * tileSize * 2;
+    //        return Math.Pow(2.0, zoomLevel) * tileSize;
+    //    }
+
+    //    public wmsTileSource(ICacheOptionsProvider cacheOptionsProvider) :
+    //        base((int)CalculateTotalImageSize(maxZoomLevel), (int)CalculateTotalImageSize(maxZoomLevel), tileSize, tileSize, cacheOptionsProvider)
+    //    {
+    //    }
+
+    //    public override Uri GetTileByZoomLevel(int zoomLevel, int tilePositionX, int tilePositionY)
+    //    {
+    //        if (string.IsNullOrWhiteSpace(HttpServerAddr)) return null;
+    //        try
+    //        {
+    //            if (zoomLevel <= maxZoomLevel)
+    //            {
+    //                string imgUrl = $"{HttpServerAddr}/{(int)MapType}/{zoomLevel}/{tilePositionX}/{tilePositionY}";
+    //                //string imgUrl = string.Format("http://192.168.0.214:58089/{0}/{1}/{2}/{3}", (int)GoogleMapType.Normal, zoomLevel, tilePositionX, tilePositionY);
+    //                Uri u = new Uri(imgUrl);
+    //                return u;
+    //            }
+    //            return null;
+    //        }
+    //        catch
+    //        {
+    //            Console.WriteLine($"加载地图数据出错,无法连接到{HttpServerAddr}");
+    //            return null;
+    //        }
+    //    }
+    //}
     #endregion
 
     //定位点聚合器

+ 2 - 8
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -62,9 +62,7 @@ namespace XdCxRhDW.App.UserControl
             if (cfg.MapType == 0)
                 mapControl1.UseLocalDb();
             else if (cfg.MapType == 1)
-                mapControl1.UseWMTS(cfg.MapAddr);
-            else if (cfg.MapType == 2)
-                mapControl1.UseWMS(cfg.MapAddr, cfg.LayerName);
+                mapControl1.UseWMS(cfg.WMSType.Value, cfg.LayerName);
         }
 
         private async void CtrlHome_Load(object sender, EventArgs e)
@@ -158,13 +156,9 @@ namespace XdCxRhDW.App.UserControl
             {
                 mapControl1.UseLocalDb();
             }
-            else if (settings.MapType == 1)
-            {
-                mapControl1.UseWMTS(settings.MapAddr);
-            }
             else
             {
-                mapControl1.UseWMS(settings.MapAddr, settings.LayerName);
+                mapControl1.UseWMS(settings.WMSType.Value, settings.LayerName);
             }
             gridView1.FocusedRowObjectChanged += GridView1_FocusedRowObjectChanged;
             gridView2.FocusedRowObjectChanged += GridView2_FocusedRowObjectChanged;

+ 31 - 31
XdCxRhDW.App/UserControl/CtrlSysSettings.Designer.cs

@@ -37,11 +37,11 @@ namespace XdCxRhDW.App.UserControl
             this.tablePanel1 = new DevExpress.Utils.Layout.TablePanel();
             this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
             this.txtMapType = new DevExpress.XtraEditors.RadioGroup();
-            this.txtMapUrl = new DevExpress.XtraEditors.TextEdit();
             this.btnSave = new DevExpress.XtraEditors.SimpleButton();
             this.txtHttpPort = new DevExpress.XtraEditors.TextEdit();
             this.txtXLDirectory = new DevExpress.XtraEditors.TextEdit();
             this.txtYDPZThreshold = new DevExpress.XtraEditors.ButtonEdit();
+            this.txtLayer = new DevExpress.XtraEditors.TextEdit();
             this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
             this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
@@ -52,16 +52,16 @@ namespace XdCxRhDW.App.UserControl
             this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
             this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem();
             this.itemUrl = new DevExpress.XtraLayout.LayoutControlItem();
-            this.txtLayer = new DevExpress.XtraEditors.TextEdit();
+            this.txtWMSType = new DevExpress.XtraEditors.ImageComboBoxEdit();
             ((System.ComponentModel.ISupportInitialize)(this.tablePanel1)).BeginInit();
             this.tablePanel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
             this.layoutControl1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.txtMapType.Properties)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtMapUrl.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtHttpPort.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtXLDirectory.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtYDPZThreshold.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtLayer.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
@@ -72,7 +72,7 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.itemUrl)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtLayer.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtWMSType.Properties)).BeginInit();
             this.SuspendLayout();
             // 
             // tablePanel1
@@ -97,12 +97,12 @@ namespace XdCxRhDW.App.UserControl
             // 
             this.tablePanel1.SetColumn(this.layoutControl1, 1);
             this.layoutControl1.Controls.Add(this.txtMapType);
-            this.layoutControl1.Controls.Add(this.txtMapUrl);
             this.layoutControl1.Controls.Add(this.btnSave);
             this.layoutControl1.Controls.Add(this.txtHttpPort);
             this.layoutControl1.Controls.Add(this.txtXLDirectory);
             this.layoutControl1.Controls.Add(this.txtYDPZThreshold);
             this.layoutControl1.Controls.Add(this.txtLayer);
+            this.layoutControl1.Controls.Add(this.txtWMSType);
             this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.layoutControl1.Location = new System.Drawing.Point(147, 38);
             this.layoutControl1.Name = "layoutControl1";
@@ -120,23 +120,12 @@ namespace XdCxRhDW.App.UserControl
             this.txtMapType.Name = "txtMapType";
             this.txtMapType.Properties.Items.AddRange(new DevExpress.XtraEditors.Controls.RadioGroupItem[] {
             new DevExpress.XtraEditors.Controls.RadioGroupItem(0, "本地地图"),
-            new DevExpress.XtraEditors.Controls.RadioGroupItem(1, "WMTS"),
-            new DevExpress.XtraEditors.Controls.RadioGroupItem(2, "WMS")});
+            new DevExpress.XtraEditors.Controls.RadioGroupItem(1, "WMS")});
             this.txtMapType.Size = new System.Drawing.Size(372, 25);
             this.txtMapType.StyleController = this.layoutControl1;
             this.txtMapType.TabIndex = 9;
             this.txtMapType.SelectedIndexChanged += new System.EventHandler(this.txtMapType_SelectedIndexChanged);
             // 
-            // txtMapUrl
-            // 
-            this.txtMapUrl.Location = new System.Drawing.Point(12, 235);
-            this.txtMapUrl.Name = "txtMapUrl";
-            this.txtMapUrl.Properties.AutoHeight = false;
-            this.txtMapUrl.Size = new System.Drawing.Size(372, 22);
-            this.txtMapUrl.StyleController = this.layoutControl1;
-            this.txtMapUrl.TabIndex = 7;
-            this.txtMapUrl.ToolTip = "支持瓦片数据和wms";
-            // 
             // btnSave
             // 
             this.btnSave.Location = new System.Drawing.Point(137, 319);
@@ -184,6 +173,15 @@ namespace XdCxRhDW.App.UserControl
             this.txtYDPZThreshold.StyleController = this.layoutControl1;
             this.txtYDPZThreshold.TabIndex = 7;
             // 
+            // txtLayer
+            // 
+            this.txtLayer.Location = new System.Drawing.Point(12, 285);
+            this.txtLayer.Name = "txtLayer";
+            this.txtLayer.Properties.AutoHeight = false;
+            this.txtLayer.Size = new System.Drawing.Size(372, 22);
+            this.txtLayer.StyleController = this.layoutControl1;
+            this.txtLayer.TabIndex = 10;
+            // 
             // Root
             // 
             this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
@@ -306,27 +304,29 @@ namespace XdCxRhDW.App.UserControl
             // 
             // itemUrl
             // 
-            this.itemUrl.Control = this.txtMapUrl;
+            this.itemUrl.Control = this.txtWMSType;
             this.itemUrl.Location = new System.Drawing.Point(0, 199);
-            this.itemUrl.MaxSize = new System.Drawing.Size(0, 50);
-            this.itemUrl.MinSize = new System.Drawing.Size(100, 50);
+            this.itemUrl.MinSize = new System.Drawing.Size(50, 25);
             this.itemUrl.Name = "itemUrl";
             this.itemUrl.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 9, 2);
             this.itemUrl.Size = new System.Drawing.Size(376, 50);
             this.itemUrl.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
-            this.itemUrl.Text = "地图URL地址";
+            this.itemUrl.Text = "行政图类型";
             this.itemUrl.TextLocation = DevExpress.Utils.Locations.Top;
             this.itemUrl.TextSize = new System.Drawing.Size(96, 14);
             this.itemUrl.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
             // 
-            // txtLayer
+            // txtWMSType
             // 
-            this.txtLayer.Location = new System.Drawing.Point(12, 285);
-            this.txtLayer.Name = "txtLayer";
-            this.txtLayer.Properties.AutoHeight = false;
-            this.txtLayer.Size = new System.Drawing.Size(372, 22);
-            this.txtLayer.StyleController = this.layoutControl1;
-            this.txtLayer.TabIndex = 10;
+            this.txtWMSType.Location = new System.Drawing.Point(12, 235);
+            this.txtWMSType.Name = "txtWMSType";
+            this.txtWMSType.Properties.AutoHeight = false;
+            this.txtWMSType.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.txtWMSType.Size = new System.Drawing.Size(372, 22);
+            this.txtWMSType.StyleController = this.layoutControl1;
+            this.txtWMSType.TabIndex = 7;
+            this.txtWMSType.ToolTip = "支持瓦片数据和wms";
             // 
             // CtrlSysSettings
             // 
@@ -341,10 +341,10 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
             this.layoutControl1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.txtMapType.Properties)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtMapUrl.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtHttpPort.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtXLDirectory.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtYDPZThreshold.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtLayer.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
@@ -355,7 +355,7 @@ namespace XdCxRhDW.App.UserControl
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.itemUrl)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.txtLayer.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtWMSType.Properties)).EndInit();
             this.ResumeLayout(false);
 
         }
@@ -371,7 +371,6 @@ namespace XdCxRhDW.App.UserControl
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;
         private DevExpress.XtraEditors.TextEdit txtXLDirectory;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5;
-        private DevExpress.XtraEditors.TextEdit txtMapUrl;
         private DevExpress.XtraLayout.LayoutControlItem itemUrl;
         private DevExpress.XtraEditors.ButtonEdit txtYDPZThreshold;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1;
@@ -381,5 +380,6 @@ namespace XdCxRhDW.App.UserControl
         private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem1;
         private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem2;
         private DevExpress.XtraEditors.TextEdit txtLayer;
+        private DevExpress.XtraEditors.ImageComboBoxEdit txtWMSType;
     }
 }

+ 44 - 25
XdCxRhDW.App/UserControl/CtrlSysSettings.cs

@@ -21,6 +21,7 @@ using DevExpress.XtraMap;
 using XdCxRhDW.WebApi;
 using DevExpress.XtraPrinting;
 using XdCxRhDW.Entity;
+using DevExpress.XtraEditors.Controls;
 
 namespace XdCxRhDW.App.UserControl
 {
@@ -29,13 +30,15 @@ namespace XdCxRhDW.App.UserControl
         public CtrlSysSettings()
         {
             InitializeComponent();
-            this.layoutControl1.UseDefault();
+            //this.layoutControl1.UseDefault();
         }
 
         private async void CtrlSysSettings_Load(object sender, EventArgs e)
         {
             try
             {
+                txtWMSType.Properties.Items.Add(new ImageComboBoxItem("请选择", null, -1));
+                txtWMSType.Properties.Items.AddEnum<EnumWmsType>();
                 using (RHDWContext db = new RHDWContext())
                 {
                     var res = await db.SysSetings.FirstOrDefaultAsync();
@@ -44,8 +47,8 @@ namespace XdCxRhDW.App.UserControl
                         this.txtHttpPort.Text = res.HttpPort.ToString();
                         if (!string.IsNullOrEmpty(res.XLDirectory))
                             this.txtXLDirectory.Text = res.XLDirectory.ToString();
-                        if (!string.IsNullOrEmpty(res.MapAddr))
-                            this.txtMapUrl.Text = res.MapAddr.ToString();
+                        if (res.WMSType != null)
+                            this.txtWMSType.EditValue = res.WMSType;
                         if (res.YDPZThreshold > 0)
                             this.txtYDPZThreshold.Text = res.YDPZThreshold.ToString();
                         this.txtLayer.Text = res.LayerName;
@@ -55,9 +58,9 @@ namespace XdCxRhDW.App.UserControl
                         }
                         else
                             this.txtMapType.SelectedIndex = res.MapType;
-
                     }
                 }
+
             }
             catch (Exception ex)
             {
@@ -71,21 +74,38 @@ namespace XdCxRhDW.App.UserControl
             bool needStartHttpSvr = false;
             try
             {
+                if (txtMapType.SelectedIndex != 0 && txtWMSType.EditValue == null)
+                {
+                    DxHelper.MsgBoxHelper.ShowInfo("请选择行政图类型!");
+                    return;
+                }
+                if (txtMapType.SelectedIndex != 0 && string.IsNullOrEmpty(txtLayer.Text))
+                {
+                    DxHelper.MsgBoxHelper.ShowInfo("请填写地图图层名称!");
+                    return;
+                }
                 using (RHDWContext db = new RHDWContext())
                 {
                     var res = await db.SysSetings.FirstOrDefaultAsync();
                     if (res == null)
                     {
-                        res = new SysSetings()
+                        SysSetings resNull = new SysSetings();
+                        resNull.HttpPort = Convert.ToInt32(txtHttpPort.Text);
+                        resNull.XLDirectory = txtXLDirectory.Text;
+                        resNull.YDPZThreshold = string.IsNullOrWhiteSpace(txtYDPZThreshold.Text) ? 0 : Convert.ToInt32(txtYDPZThreshold.Text);
+                        resNull.MapType = txtMapType.SelectedIndex;
+                        if (txtMapType.SelectedIndex == 0)
                         {
-                            HttpPort = Convert.ToInt32(txtHttpPort.Text),
-                            XLDirectory = txtXLDirectory.Text,
-                            YDPZThreshold = string.IsNullOrWhiteSpace(txtYDPZThreshold.Text) ? 0 : Convert.ToInt32(txtYDPZThreshold.Text),
-                            MapAddr = txtMapUrl.Text,
-                            MapType = txtMapType.SelectedIndex,
-                            LayerName = txtLayer.Text,
-                        };
-                        db.SysSetings.Add(res);
+                            resNull.WMSType = null;
+                            resNull.LayerName = null;
+                        }
+                        else
+                        {
+                            resNull.WMSType = (EnumWmsType)txtWMSType.EditValue;
+                            resNull.LayerName = txtLayer.Text;
+                        }
+
+                        db.SysSetings.Add(resNull);
                         needStartHttpSvr = true;
                     }
                     else
@@ -93,16 +113,23 @@ namespace XdCxRhDW.App.UserControl
                         needStartHttpSvr = res.HttpPort != Convert.ToInt32(txtHttpPort.Text);
                         res.HttpPort = Convert.ToInt32(txtHttpPort.Text);
                         res.XLDirectory = txtXLDirectory.Text;
-                        res.MapAddr = txtMapUrl.Text;
                         res.YDPZThreshold = string.IsNullOrWhiteSpace(txtYDPZThreshold.Text) ? 0 : Convert.ToInt32(txtYDPZThreshold.Text);
-                        res.MapAddr = txtMapUrl.Text;
                         res.MapType = txtMapType.SelectedIndex;
-                        res.LayerName = txtLayer.Text;
+                        if (txtMapType.SelectedIndex == 0)
+                        {
+                            res.WMSType = null;
+                            res.LayerName = null;
+                        }
+                        else
+                        {
+                            res.WMSType = (EnumWmsType)txtWMSType.EditValue;
+                            res.LayerName = txtLayer.Text;
+                        }
                     }
 
                     await db.SaveChangesAsync();
                     DxHelper.MsgBoxHelper.ShowInfo("配置信息保存成功!");
-                    Messenger.Defalut.Pub("系统配置改变",await db.SysSetings.FirstOrDefaultAsync());
+                    Messenger.Defalut.Pub("系统配置改变", await db.SysSetings.FirstOrDefaultAsync());
                 }
             }
             catch (Exception ex)
@@ -146,14 +173,6 @@ namespace XdCxRhDW.App.UserControl
             {
                 itemUrl.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                 itemLayer.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
-            }
-            else if (txtMapType.SelectedIndex == 1)
-            {
-                itemUrl.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
-                itemUrl.Text = "WMTS地址";
-                itemLayer.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
-
-
             }
             else
             {

+ 28 - 1
XdCxRhDW.App/XdCxRhDW.App.csproj

@@ -16,6 +16,21 @@
     <FileAlignment>512</FileAlignment>
     <NuGetPackageImportStamp>
     </NuGetPackageImportStamp>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -103,6 +118,7 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\System.Net.Http.Formatting.dll</HintPath>
     </Reference>
+    <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Web.Http">
       <HintPath>..\System.Web.Http.dll</HintPath>
     </Reference>
@@ -530,7 +546,18 @@
     </Content>
     <Content Include="定位.ico" />
   </ItemGroup>
-  <ItemGroup />
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
   <Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />

+ 22 - 4
XdCxRhDW.Entity/ModelEnum.cs

@@ -21,10 +21,10 @@ namespace XdCxRhDW.Entity
     }
     public enum EnumTaskType
     {
-        [Display(Name ="实时任务")]
+        [Display(Name = "实时任务")]
         Real,
 
-        [Display(Name ="历史任务")]
+        [Display(Name = "历史任务")]
         History
     }
     /// <summary>
@@ -110,15 +110,33 @@ namespace XdCxRhDW.Entity
         /// <summary>
         /// 运动
         /// </summary>
-        [Display(Name ="运动")]
+        [Display(Name = "运动")]
         Movement,
 
         /// <summary>
         /// 静止
         /// </summary>
-        [Display(Name ="静止")]
+        [Display(Name = "静止")]
         Stationary,
     }
 
+    public enum EnumWmsType
+    {
+        /// <summary>
+        /// 中科星图
+        /// </summary>
+        [Display(Name = "中科星图")]
+        ZKXT,
+        /// <summary>
+        /// 数据中心
+        /// </summary>
+        [Display(Name = "数据中心")]
+        DataCenter,
+        /// <summary>
+        /// 路网
+        /// </summary>
+        [Display(Name = "路网")]
+        LW
+    }
 
 }

+ 2 - 2
XdCxRhDW.Entity/SysSetings.cs

@@ -17,14 +17,14 @@ namespace XdCxRhDW.Entity
         public int YDPZThreshold { get; set; }
 
         /// <summary>
-        /// 地图类型.本地地图=0,WMTS=1,WMS=2
+        /// 地图类型.本地地图=0,WMS=1
         /// </summary>
         public int MapType { get; set; }
 
         /// <summary>
         /// 图源地址
         /// </summary>
-        public string MapAddr { get; set; }
+        public EnumWmsType? WMSType { get; set; }
 
         /// <summary>
         /// 瓦片