年度变更建库软件5.0版本
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.

84 lines
2.8 KiB

4 months ago
using ESRI.ArcGIS.Carto;
using KGIS.Framework.Maps;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
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;
namespace Kingo.Plugin.EngineEditor.Views
{
/// <summary>
/// FrmSetTargetLayer.xaml 的交互逻辑
/// </summary>
public partial class FrmSetTargetLayer : BaseWindow
{
public List<ILayer> MapLayerList { get; set; } = new List<ILayer>();
public event EventHandler<object> OKComplate;
public FrmSetTargetLayer()
{
InitializeComponent();
wndLayerListImageComboBox.Items.Clear();
GetLayers();
}
private void wndLayerListImageComboBox_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
//GetLayers();
MapLayerList = MapsManager.Instance.MapService.GetAllLayerInMap<ILayer>();
MapLayerList = MapLayerList.FindAll(a => (a as IFeatureLayer) != null);
wndLayerListImageComboBox.ItemsSource = MapLayerList.Select(n => n.Name);
}
private void GetLayers()
{
try
{
MapLayerList = MapsManager.Instance.MapService.GetAllLayerInMap<ILayer>();
MapLayerList = MapLayerList.FindAll(a => (a as IFeatureLayer) != null);
wndLayerListImageComboBox.ItemsSource = MapLayerList.Select(n => n.Name);
if (MapLayerList.Count > 0)
wndLayerListImageComboBox.SelectedIndex = 0;
}
catch (Exception ex)
{
LogAPI.Debug("卷帘工具图层列表获取失败!" + ex);
return;
}
}
private void rollerShutterBtn_Click(object sender, RoutedEventArgs e)
{
try
{
if (MapLayerList == null || MapLayerList.Count == 0)
{
MessageHelper.ShowWarning("请先添加图层数据!");
return;
}
int index = wndLayerListImageComboBox.SelectedIndex;
if (index < 0)
{
MessageHelper.ShowWarning("请选择目标图层!");
return;
}
ILayer layer = MapLayerList[index];
OKComplate?.Invoke(layer, null);
}
catch (Exception ex)
{
LogAPI.Debug("卷帘工具设置失败!" + ex);
return;
}
}
}
}