You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
141 lines
4.4 KiB
141 lines
4.4 KiB
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Text; |
|
using System.Threading.Tasks; |
|
using System.Windows; |
|
using System.Windows.Controls; |
|
using System.Windows.Data; |
|
using System.Windows.Documents; |
|
using System.Windows.Input; |
|
using System.Windows.Media; |
|
using System.Windows.Media.Imaging; |
|
using System.Windows.Navigation; |
|
using System.Windows.Shapes; |
|
using KGIS.Framework.OpenData.Control; |
|
using KGIS.Framework.OpenData.InterFace; |
|
using KGIS.Framework.AE; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.Helper; |
|
using KGIS.Framework.OpenData.Filter; |
|
using System.Windows.Forms; |
|
using Kingo.Plugin.MakeTaskPackage.Model; |
|
using KGIS.Framework.Maps; |
|
using ESRI.ArcGIS.Carto; |
|
using ESRI.ArcGIS.Geodatabase; |
|
using ESRI.ArcGIS.Geometry; |
|
using ESRI.ArcGIS.DataSourcesGDB; |
|
using ESRI.ArcGIS.esriSystem; |
|
using ESRI.ArcGIS.Display; |
|
using KGIS.Framework.Platform; |
|
using static Kingo.Plugin.MakeTaskPackage.Model.MakeTaskPackageModel; |
|
|
|
namespace Kingo.Plugin.MakeTaskPackage.View |
|
{ |
|
/// <summary> |
|
/// FrmAddListLayer.xaml 的交互逻辑 |
|
/// </summary> |
|
public partial class FrmAddListLayerGroup : BaseWindow |
|
{ |
|
|
|
public List<MakeTaskPackageModel> exportDataList = null; |
|
|
|
public Action Refresh; |
|
public FrmAddListLayerGroup() |
|
{ |
|
InitializeComponent(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
/// 确定 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
private void btnOK_Click(object sender, RoutedEventArgs e) |
|
{ |
|
try |
|
{ |
|
if (string.IsNullOrWhiteSpace(this.txtGroupName.Text)) |
|
{ |
|
MessageHelper.Show("图层组名为空,请输入图层组名"); |
|
return; |
|
} |
|
List<MakeTaskPackageModel> groupList = this.exportDataList.FindAll(x => x.FileAliasName == this.txtGroupName.Text); |
|
if (groupList != null && groupList.Count != 0) |
|
{ |
|
MessageHelper.Show("图层组名已存在,请输入其他图层组名"); |
|
return; |
|
} |
|
|
|
|
|
//IMap map = MapsManager.Instance.MapService.getAxMapControl().Map; |
|
//if (map == null) |
|
// return; |
|
|
|
IGroupLayer group = new GroupLayerClass(); |
|
group.Name = txtGroupName.Text; |
|
//map.AddLayer(group); |
|
|
|
var maxIdModel = 0; |
|
if(this.exportDataList!=null&& this.exportDataList.Count>0) |
|
maxIdModel= this.exportDataList.Max(x => x.ID); |
|
maxIdModel++; |
|
|
|
List<MakeTaskPackageModel> groupNameList = this.exportDataList.FindAll(x => x.PID == 0); |
|
MakeTaskPackageModel mobiledata = new MakeTaskPackageModel(); |
|
mobiledata.IsCheck = true; |
|
mobiledata.IsSlice = false; |
|
mobiledata.FileName = group.Name; |
|
mobiledata.FileAliasName = group.Name; |
|
mobiledata.Type = "图层组"; |
|
mobiledata.Layer = group; |
|
if (groupNameList != null && groupNameList.Count != 0) |
|
{ |
|
mobiledata.LayerIndex = groupNameList.Count; |
|
} |
|
else |
|
{ |
|
mobiledata.LayerIndex = 0; |
|
} |
|
mobiledata.ExcState = ExcStateEnum.NoImport; |
|
mobiledata.ID = maxIdModel; |
|
mobiledata.PID = 0; |
|
mobiledata.IsLayerGroup = true; |
|
|
|
|
|
this.exportDataList.Add(mobiledata); |
|
Refresh?.Invoke(); |
|
this.Close(); |
|
|
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("添加图层组失败:" + ex); |
|
MessageHelper.Show("添加图层组失败:" + ex); |
|
} |
|
} |
|
/// <summary> |
|
/// 取消 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
private void btnCancel_Click(object sender, RoutedEventArgs e) |
|
{ |
|
try |
|
{ |
|
this.Close(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("关闭添加图层组界面失败:" + ex); |
|
MessageHelper.Show("关闭添加图层组界面失败:" + ex); |
|
} |
|
} |
|
|
|
|
|
|
|
} |
|
}
|
|
|