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.
845 lines
33 KiB
845 lines
33 KiB
using System; |
|
using System.Collections.Generic; |
|
using System.Drawing; |
|
using System.IO; |
|
using System.Windows.Forms; |
|
using DevExpress.XtraBars; |
|
using DevExpress.XtraTreeList; |
|
using DevExpress.XtraTreeList.Nodes; |
|
using ESRI.ArcGIS.Display; |
|
using ESRI.ArcGIS.esriSystem; |
|
using KGIS.Plugin.LayerProperty.Enum; |
|
using KGIS.Plugin.LayerProperty.EventHandler; |
|
using KGIS.Plugin.LayerProperty.Interface; |
|
using KGIS.Plugin.LayerProperty.Utils; |
|
using KGIS.Plugin.LayerProperty.View.UC_Controls; |
|
|
|
namespace KGIS.Plugin.LayerProperty.View |
|
{ |
|
public partial class FormSymbolSelector : DevExpress.XtraEditors.XtraForm, IUIPlugIn, IPlugIn, ISymbolSelector |
|
{ |
|
private const string ConstStr = "<所有分组>"; |
|
private IDoStyleGalleryStorage m_DistStyleGalleryStorage; |
|
private IDoStyleGallery m_DistStyleGallery; |
|
private Dictionary<string, List<ListViewItem>> m_ViewItemDictionary; |
|
private int m_ClassIndex; |
|
private TreeListNode m_LocalRootNode; |
|
private TreeListNode m_DBRootNode; |
|
private KGIS.Framework.Utils.Dialog.OpenFileDialog m_OpenFileDialog; |
|
private IDoStyleGalleryItem m_DistStyleGalleryItem; |
|
private IDoStyleGalleryItem m_SelectSymbol; |
|
private IUCSymbolAtrribute ucFillSymbolAtrribute; |
|
private IUCSymbolAtrribute ucMarkSymbolAtrribute; |
|
private IUCSymbolAtrribute ucLineSymbolAtrribute; |
|
private IUCSymbolAtrribute ucTextSymbolAtrribute; |
|
private IUCSymbolAtrribute m_CurrentUc; |
|
private List<TreeListNode> m_CheckedNodes; |
|
private IClone m_SrcSymbolClone; |
|
private ISymbol m_TarCloneSymbol; |
|
private ISymbol m_DeafultSymbol; |
|
private object resultSymbol; |
|
public IDoStyleGalleryItem DoStyleGalleryItem |
|
{ |
|
get |
|
{ |
|
return this.m_SelectSymbol; |
|
} |
|
set |
|
{ |
|
this.m_SelectSymbol = value; |
|
} |
|
} |
|
public object ResultSymbol |
|
{ |
|
get |
|
{ |
|
return this.resultSymbol; |
|
} |
|
set |
|
{ |
|
this.resultSymbol = value; |
|
} |
|
} |
|
public ICoreRDBHelper RDBHelper |
|
{ |
|
get; |
|
//{ |
|
// return RdbUtil.RDBHelper; |
|
//} |
|
set; |
|
//{ |
|
// RdbUtil.RDBHelper = value; |
|
//} |
|
} |
|
public ITraceHandler TraceHandler |
|
{ |
|
get; |
|
//{ |
|
// return RdbUtil.TraceHandler; |
|
//} |
|
set; |
|
//{ |
|
// RdbUtil.TraceHandler = value; |
|
//} |
|
} |
|
public ILogEvent Log |
|
{ |
|
set |
|
{ |
|
//RdbUtil.Log = value; |
|
} |
|
} |
|
public FormSymbolSelector() |
|
{ |
|
this.InitializeComponent(); |
|
this.m_DistStyleGallery = StyleGalleryFactory.CreateDistStyleGallery(); |
|
this.m_DistStyleGalleryStorage = (this.m_DistStyleGallery as IDoStyleGalleryStorage); |
|
this.m_CheckedNodes = new List<TreeListNode>(); |
|
this.picPreview.Width = this.gpOptions.Width;//白明雅 2018-12-20 调大宽度 |
|
//Bug-13254 霍岩 2018-11-23 添加窗体已关闭事件 |
|
FormClosed += (sender, e) => |
|
{ |
|
if (base.DialogResult != DialogResult.OK) |
|
{ |
|
this.ResultSymbol = null; |
|
} |
|
}; |
|
} |
|
public void Init() |
|
{ |
|
try |
|
{ |
|
this.tlstGalleryTree.Nodes.Clear(); |
|
this.tlstGalleryTree.OptionsBehavior.Editable = false; |
|
this.tlstGalleryTree.OptionsView.AutoWidth = true; |
|
this.tlstGalleryTree.OptionsBehavior.AutoPopulateColumns = true; |
|
//TreeListNode treeListNode = this.tlstGalleryTree.AppendNode(new object[] |
|
//{ |
|
// "数据库图库", |
|
// CheckState.Unchecked |
|
//}, null); |
|
//treeListNode.Tag = null; |
|
//treeListNode.StateImageIndex = 0; |
|
//this.RefreshRootNode(treeListNode); |
|
//this.m_DBRootNode = treeListNode; |
|
TreeListNode treeListNode2 = this.tlstGalleryTree.AppendNode(new object[] |
|
{ |
|
"本地图库", |
|
CheckState.Unchecked |
|
}, null); |
|
treeListNode2.Tag = "local"; |
|
treeListNode2.StateImageIndex = 0; |
|
this.m_LocalRootNode = treeListNode2; |
|
//Bug-13011 霍岩 2018-11-06 加载首个TreeListNode |
|
NodeChange(treeListNode2); |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
|
|
private void AddLocalFile() |
|
{ |
|
try |
|
{ |
|
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"工作空间\符号库"); |
|
if (Directory.Exists(path)) |
|
{ |
|
string[] fileInfo = Directory.GetFiles(path, "*.ServerStyle?"); |
|
if (fileInfo != null && fileInfo.Length > 0) |
|
{ |
|
foreach (string text in fileInfo) |
|
{ |
|
this.AddFile(text); |
|
} |
|
} |
|
|
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
throw ex; |
|
} |
|
} |
|
|
|
private void NodeChange(TreeListNode node) |
|
{ |
|
this.m_DistStyleGalleryStorage.ClearFiles(); |
|
//BUG12486 郑英杰 2018-09-27 |
|
//string text = node.Tag.ToString(); |
|
//if (text != "") |
|
//{ |
|
// this.m_DistStyleGalleryStorage.AddFile(text); |
|
// this.RefreshView(text); |
|
//} |
|
|
|
if (node != null && node.Tag != null) |
|
{ |
|
string text = node.Tag.ToString(); |
|
if (text != "") |
|
{ |
|
this.m_DistStyleGalleryStorage.AddFile(text); |
|
this.RefreshView(text); |
|
} |
|
} |
|
} |
|
|
|
public void Init(esriStyleClass styleClass) |
|
{ |
|
try |
|
{ |
|
this.gpOptions.Controls.Clear(); |
|
this.m_ClassIndex = (int)styleClass; |
|
for (int i = 0; i < this.m_DistStyleGallery.ClassCount; i++) |
|
{ |
|
IStyleGalleryClass styleclass = m_DistStyleGallery.get_Class(i); |
|
if (styleclass != null && |
|
styleclass.Name.Replace(" ", "").ToLower() == styleClass.ToString().ToLower()) |
|
{ |
|
this.m_ClassIndex = i; |
|
break; |
|
} |
|
} |
|
this.m_TarCloneSymbol = null; |
|
this.gpOptions.Visible = false; |
|
switch (styleClass) |
|
{ |
|
case esriStyleClass.FillSymbols: |
|
this.gpOptions.Visible = true; |
|
if (this.ucFillSymbolAtrribute == null) |
|
{ |
|
this.ucFillSymbolAtrribute = new UCFillSymbolAtrribute(); |
|
this.ucFillSymbolAtrribute.Dock = DockStyle.Fill; |
|
this.ucFillSymbolAtrribute.SetPicture(this.picPreview); |
|
} |
|
this.gpOptions.Controls.Add(this.ucFillSymbolAtrribute as System.Windows.Forms.Control); |
|
this.m_CurrentUc = this.ucFillSymbolAtrribute; |
|
break; |
|
case esriStyleClass.LineSymbols: |
|
this.gpOptions.Visible = true; |
|
if (this.ucLineSymbolAtrribute == null) |
|
{ |
|
this.ucLineSymbolAtrribute = new UCLineSymbolAtrribute(); |
|
this.ucLineSymbolAtrribute.Dock = DockStyle.Fill; |
|
this.ucLineSymbolAtrribute.SetPicture(this.picPreview); |
|
} |
|
this.gpOptions.Controls.Add(this.ucLineSymbolAtrribute as System.Windows.Forms.Control); |
|
this.m_CurrentUc = this.ucLineSymbolAtrribute; |
|
break; |
|
case esriStyleClass.MarkerSymbols: |
|
this.gpOptions.Visible = true; |
|
if (this.ucMarkSymbolAtrribute == null) |
|
{ |
|
this.ucMarkSymbolAtrribute = new UCMarkSymbolAtrribute(); |
|
this.ucMarkSymbolAtrribute.Dock = DockStyle.Fill; |
|
this.ucMarkSymbolAtrribute.SetPicture(this.picPreview); |
|
} |
|
this.gpOptions.Controls.Add(this.ucMarkSymbolAtrribute as System.Windows.Forms.Control); |
|
this.m_CurrentUc = this.ucMarkSymbolAtrribute; |
|
break; |
|
case esriStyleClass.TextSymbols: |
|
this.gpOptions.Visible = true; |
|
if (this.ucTextSymbolAtrribute == null) |
|
{ |
|
this.ucTextSymbolAtrribute = new UCTextSymbolAtrribute(); |
|
this.ucTextSymbolAtrribute.Dock = DockStyle.Fill; |
|
this.ucTextSymbolAtrribute.SetPicture(this.picPreview); |
|
} |
|
this.gpOptions.Controls.Add(this.ucTextSymbolAtrribute as System.Windows.Forms.Control); |
|
this.m_CurrentUc = this.ucTextSymbolAtrribute; |
|
break; |
|
} |
|
|
|
//初始化路径,不然在后面会报错,获取不到数据 |
|
string path = this.m_DistStyleGalleryStorage.DefaultStylePath; |
|
AddLocalFile(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
public void Init(esriStyleClass styleClass, ref ISymbol symbol) |
|
{ |
|
try |
|
{ |
|
this.Init(styleClass); |
|
if (this.m_CurrentUc != null) |
|
{ |
|
this.resultSymbol = symbol; |
|
this.m_CurrentUc.Init(ref symbol); |
|
this.m_CurrentUc.SymbolEdited -= new System.EventHandler(this.m_CurrentUc_SymbolEdited); |
|
this.m_CurrentUc.SymbolEdited += new System.EventHandler(this.m_CurrentUc_SymbolEdited); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
private void m_CurrentUc_SymbolEdited(object sender, System.EventArgs e) |
|
{ |
|
if (this.resultSymbol != null) |
|
{ |
|
this.btnOK.Enabled = true; |
|
} |
|
} |
|
private void InitCategories(List<string> list) |
|
{ |
|
this.repositoryItemComboBox1.Items.Clear(); |
|
list.Insert(0, "<所有分组>"); |
|
this.repositoryItemComboBox1.Items.AddRange(list); |
|
this.barCategories.EditValue = "<所有分组>"; |
|
} |
|
private void RefreshRootNode(TreeListNode node) |
|
{ |
|
try |
|
{ |
|
if (node != null) |
|
{ |
|
node.Nodes.Clear(); |
|
StyleGalleryFactory.Clear(); |
|
StyleGalleryFactory.LoadAllDistStyleGalleryPath(); |
|
List<IDoStyleGalleryPath> distStyleGalleryPathList = StyleGalleryFactory.DistStyleGalleryPathList; |
|
foreach (IDoStyleGalleryPath current in distStyleGalleryPathList) |
|
{ |
|
TreeListNode treeListNode = this.tlstGalleryTree.AppendNode(new object[] |
|
{ |
|
current.Name, |
|
CheckState.Unchecked |
|
}, node); |
|
treeListNode.Tag = current; |
|
treeListNode.StateImageIndex = 5; |
|
} |
|
if (node.Nodes.Count > 0) |
|
{ |
|
this.tlstGalleryTree.FocusedNode = node.Nodes[0]; |
|
node.Nodes[0].Selected = true; |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
private void tlstGalleryTree_GetStateImage(object sender, GetStateImageEventArgs e) |
|
{ |
|
try |
|
{ |
|
CheckState checkState = (CheckState)e.Node.GetValue("Check"); |
|
if (checkState == CheckState.Unchecked) |
|
{ |
|
e.NodeImageIndex = 0; |
|
} |
|
else |
|
{ |
|
if (checkState == CheckState.Checked) |
|
{ |
|
e.NodeImageIndex = 1; |
|
} |
|
else |
|
{ |
|
e.NodeImageIndex = 2; |
|
} |
|
} |
|
} |
|
catch |
|
{ |
|
} |
|
} |
|
private void SetCheckedNode(TreeListNode node) |
|
{ |
|
CheckState checkState = (CheckState)node.GetValue("Check"); |
|
if (checkState == CheckState.Indeterminate || checkState == CheckState.Unchecked) |
|
{ |
|
checkState = CheckState.Checked; |
|
} |
|
else |
|
{ |
|
checkState = CheckState.Unchecked; |
|
} |
|
this.tlstGalleryTree.FocusedNode = node; |
|
this.tlstGalleryTree.BeginUpdate(); |
|
node["Check"] = checkState; |
|
this.SetCheckedChildNodes(node, checkState); |
|
this.SetCheckedParentNodes(node, checkState); |
|
this.tlstGalleryTree.EndUpdate(); |
|
this.GetAllCheckedNode(); |
|
this.RefreshView(node.Tag as string); |
|
} |
|
private void SetCheckedChildNodes(TreeListNode node, CheckState check) |
|
{ |
|
for (int i = 0; i < node.Nodes.Count; i++) |
|
{ |
|
node.Nodes[i]["Check"] = check; |
|
this.SetCheckedChildNodes(node.Nodes[i], check); |
|
} |
|
} |
|
private void SetCheckedParentNodes(TreeListNode node, CheckState check) |
|
{ |
|
if (node.ParentNode != null) |
|
{ |
|
bool flag = false; |
|
for (int i = 0; i < node.ParentNode.Nodes.Count; i++) |
|
{ |
|
if (!check.Equals(node.ParentNode.Nodes[i]["Check"])) |
|
{ |
|
flag = !flag; |
|
break; |
|
} |
|
} |
|
node.ParentNode["Check"] = (flag ? CheckState.Indeterminate : check); |
|
this.SetCheckedParentNodes(node.ParentNode, check); |
|
} |
|
} |
|
private void InitView(IDoStyleGalleryClass galleryClass, List<IDoStyleGalleryItem> list) |
|
{ |
|
try |
|
{ |
|
long arg_0E_0 = DateTime.Now.Ticks; |
|
this.m_ViewItemDictionary = new Dictionary<string, List<ListViewItem>>(); |
|
this.lvSymbolView.Items.Clear(); |
|
this.lvSymbolView.Columns.Clear(); |
|
this.lvSymbolView.Groups.Clear(); |
|
ImageList imageList = new ImageList(); |
|
ImageList imageList2 = new ImageList(); |
|
int num = Convert.ToInt32(32.0 * galleryClass.PreviewRatio); |
|
int num2 = 32; |
|
if (num > 256) |
|
{ |
|
num = 256; |
|
} |
|
imageList.ImageSize = new Size(num, num2); |
|
imageList2.ImageSize = new Size(num / 2, num2 / 2); |
|
this.lvSymbolView.Items.Clear(); |
|
this.lvSymbolView.Columns.Clear(); |
|
this.lvSymbolView.LargeImageList = imageList; |
|
this.lvSymbolView.SmallImageList = imageList2; |
|
this.lvSymbolView.Columns.Add("名称", 180, HorizontalAlignment.Left); |
|
this.lvSymbolView.Columns.Add("索引", 50, HorizontalAlignment.Left); |
|
this.lvSymbolView.Columns.Add("分组", 120, HorizontalAlignment.Left); |
|
int num3 = 0; |
|
foreach (IDoStyleGalleryItem current in list) |
|
{ |
|
Bitmap value = galleryClass.StyleGalleryItemToBmp(current, num2); |
|
Bitmap value2 = galleryClass.StyleGalleryItemToBmp(current, num2 / 2); |
|
imageList.Images.Add(value); |
|
imageList2.Images.Add(value2); |
|
ListViewItem listViewItem = new ListViewItem(new string[] |
|
{ |
|
current.Name, |
|
current.Number.ToString(), |
|
current.Category |
|
}, num3); |
|
listViewItem.Tag = current; |
|
this.lvSymbolView.Items.Add(listViewItem); |
|
if (this.m_ViewItemDictionary.ContainsKey(current.Category)) |
|
{ |
|
this.m_ViewItemDictionary[current.Category].Add(listViewItem); |
|
} |
|
else |
|
{ |
|
this.m_ViewItemDictionary.Add(current.Category, new List<ListViewItem>()); |
|
this.m_ViewItemDictionary[current.Category].Add(listViewItem); |
|
} |
|
num3++; |
|
if (num3 % 10 == 0) |
|
{ |
|
Application.DoEvents(); |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
private void InitView(IStyleGalleryClass galleryClass, List<IDoStyleGalleryItem> list) |
|
{ |
|
try |
|
{ |
|
long ticks = DateTime.Now.Ticks; |
|
this.m_ViewItemDictionary = new Dictionary<string, List<ListViewItem>>(); |
|
this.lvSymbolView.Items.Clear(); |
|
this.lvSymbolView.Columns.Clear(); |
|
this.lvSymbolView.Groups.Clear(); |
|
ImageList imageList = new ImageList(); |
|
ImageList imageList2 = new ImageList(); |
|
int num = Convert.ToInt32(32.0 * galleryClass.PreviewRatio); |
|
int num2 = 32; |
|
if (num > 256) |
|
{ |
|
num = 256; |
|
} |
|
imageList.ImageSize = new Size(num, num2); |
|
imageList2.ImageSize = new Size(num / 2, num2 / 2); |
|
this.lvSymbolView.Items.Clear(); |
|
this.lvSymbolView.Columns.Clear(); |
|
this.lvSymbolView.LargeImageList = imageList; |
|
this.lvSymbolView.SmallImageList = imageList2; |
|
this.lvSymbolView.Columns.Add("名称", 180, HorizontalAlignment.Left); |
|
this.lvSymbolView.Columns.Add("索引", 50, HorizontalAlignment.Left); |
|
this.lvSymbolView.Columns.Add("分组", 120, HorizontalAlignment.Left); |
|
int num3 = 0; |
|
foreach (IDoStyleGalleryItem current in list) |
|
{ |
|
Bitmap value = StyleGalleryItemView.StyleGalleryItemToBmp(num2, galleryClass, current.Item); |
|
Bitmap value2 = StyleGalleryItemView.StyleGalleryItemToBmp(num2 / 2, galleryClass, current.Item); |
|
imageList.Images.Add(value); |
|
imageList2.Images.Add(value2); |
|
ListViewItem listViewItem = new ListViewItem(new string[] |
|
{ |
|
current.Name, |
|
current.Number.ToString(), |
|
current.Category |
|
}, num3); |
|
listViewItem.Tag = current; |
|
this.lvSymbolView.Items.Add(listViewItem); |
|
if (this.m_ViewItemDictionary.ContainsKey(current.Category)) |
|
{ |
|
this.m_ViewItemDictionary[current.Category].Add(listViewItem); |
|
} |
|
else |
|
{ |
|
this.m_ViewItemDictionary.Add(current.Category, new List<ListViewItem>()); |
|
this.m_ViewItemDictionary[current.Category].Add(listViewItem); |
|
} |
|
num3++; |
|
if (num3 % 10 == 0) |
|
{ |
|
Application.DoEvents(); |
|
} |
|
} |
|
long ticks2 = DateTime.Now.Ticks; |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
private void tlstGalleryTree_MouseDown(object sender, MouseEventArgs e) |
|
{ |
|
if (e.Button == MouseButtons.Left) |
|
{ |
|
TreeListHitInfo treeListHitInfo = this.tlstGalleryTree.CalcHitInfo(new Point(e.X, e.Y)); |
|
this.NodeChange(treeListHitInfo.Node); |
|
//if (treeListHitInfo.HitInfoType == HitInfoType.StateImage) |
|
//{ |
|
// this.SetCheckedNode(treeListHitInfo.Node); |
|
//} |
|
} |
|
} |
|
private void GetAllCheckedNode() |
|
{ |
|
//this.m_DistStyleGalleryStorage.ClearGalleryPaths(); |
|
//foreach (TreeListNode treeListNode in this.m_DBRootNode.Nodes) |
|
//{ |
|
// CheckState checkState = (CheckState)treeListNode.GetValue("Check"); |
|
// if (checkState == CheckState.Checked) |
|
// { |
|
// IDoStyleGalleryPath doStyleGalleryPath = treeListNode.Tag as IDoStyleGalleryPath; |
|
// if (doStyleGalleryPath != null) |
|
// { |
|
// this.m_DistStyleGalleryStorage.AddDoStyleGalleryPath(doStyleGalleryPath); |
|
// } |
|
// } |
|
//} |
|
this.m_DistStyleGalleryStorage.ClearFiles(); |
|
foreach (TreeListNode treeListNode2 in this.m_LocalRootNode.Nodes) |
|
{ |
|
CheckState checkState2 = (CheckState)treeListNode2.GetValue("Check"); |
|
if (checkState2 == CheckState.Checked) |
|
{ |
|
string text = treeListNode2.Tag.ToString(); |
|
if (text != "") |
|
{ |
|
this.m_DistStyleGalleryStorage.AddFile(text); |
|
} |
|
} |
|
} |
|
} |
|
private void RefreshView(string fileName) |
|
{ |
|
if (!fileName.Equals("local")) |
|
{ |
|
this.Cursor = Cursors.WaitCursor; |
|
|
|
IStyleGalleryClass styleGalleryClass = this.m_DistStyleGallery.get_Class(this.m_ClassIndex); |
|
List<IDoStyleGalleryItem> list3 = this.m_DistStyleGallery.get_Items(styleGalleryClass.Name, fileName, ""); |
|
List<string> list4 = this.m_DistStyleGallery.get_Categories(styleGalleryClass.Name); |
|
list4.AddRange(this.m_DistStyleGallery.get_DoCategories(styleGalleryClass.Name)); |
|
this.InitCategories(list4); |
|
this.InitView(styleGalleryClass, list3); |
|
|
|
//IDoStyleGalleryClass doStyleGalleryClass = this.m_DistStyleGallery.get_DoClass(this.m_ClassIndex); |
|
//if (doStyleGalleryClass != null) |
|
//{ |
|
// IDoStyleGalleryPath path = null; |
|
// List<IDoStyleGalleryItem> list = this.m_DistStyleGallery.get_Items(doStyleGalleryClass.Name, path, ""); |
|
// list.AddRange(this.m_DistStyleGallery.get_Items(doStyleGalleryClass.Name, "", "")); |
|
// List<string> list2 = this.m_DistStyleGallery.get_Categories(doStyleGalleryClass.Name); |
|
// list2.AddRange(this.m_DistStyleGallery.get_DoCategories(doStyleGalleryClass.Name)); |
|
// this.InitCategories(list2); |
|
// this.InitView(doStyleGalleryClass, list); |
|
//} |
|
//else |
|
//{ |
|
// if (this.m_OpenFileDialog != null) |
|
// { |
|
// IStyleGalleryClass styleGalleryClass = this.m_DistStyleGallery.get_Class(this.m_ClassIndex); |
|
// List<IDoStyleGalleryItem> list3 = this.m_DistStyleGallery.get_Items(styleGalleryClass.Name, this.m_OpenFileDialog.FileName, ""); |
|
// List<string> list4 = this.m_DistStyleGallery.get_Categories(styleGalleryClass.Name); |
|
// list4.AddRange(this.m_DistStyleGallery.get_DoCategories(styleGalleryClass.Name)); |
|
// this.InitCategories(list4); |
|
// this.InitView(styleGalleryClass, list3); |
|
// } |
|
//} |
|
this.Cursor = Cursors.Default; |
|
} |
|
} |
|
private void btnMoreStyle_ItemClick(object sender, ItemClickEventArgs e) |
|
{ |
|
string text = this.OpenServerStyleFile(); |
|
if (text != "") |
|
{ |
|
this.AddFile(text); |
|
} |
|
} |
|
private string OpenServerStyleFile() |
|
{ |
|
if (this.m_OpenFileDialog == null) |
|
{ |
|
this.m_OpenFileDialog = new KGIS.Framework.Utils.Dialog.OpenFileDialog(); |
|
} |
|
this.m_OpenFileDialog.Filter = "ESRI ServerStyle(*.ServerStyle)|*.ServerStyle"; |
|
this.m_OpenFileDialog.InitialDirectory = this.m_DistStyleGalleryStorage.DefaultStylePath; |
|
if (this.m_OpenFileDialog.ShowDialog()) |
|
{ |
|
return this.m_OpenFileDialog.FileName; |
|
} |
|
return ""; |
|
} |
|
private void AddFile(string filename) |
|
{ |
|
if (!File.Exists(filename)) |
|
{ |
|
return; |
|
} |
|
bool flag = false; |
|
TreeListNode selectNode = null; |
|
foreach (TreeListNode treeListNode in this.m_LocalRootNode.Nodes) |
|
{ |
|
if (treeListNode.Tag.ToString() == filename) |
|
{ |
|
selectNode = treeListNode; |
|
flag = true; |
|
} |
|
} |
|
if (!flag) |
|
{ |
|
FileInfo fileInfo = new FileInfo(filename); |
|
TreeListNode treeListNode2 = this.tlstGalleryTree.AppendNode(new object[] |
|
{ |
|
fileInfo.Name, |
|
CheckState.Unchecked |
|
}, this.m_LocalRootNode); |
|
treeListNode2.Tag = fileInfo.FullName; |
|
this.NodeChange(treeListNode2); |
|
} |
|
else |
|
{ |
|
this.NodeChange(selectNode); |
|
} |
|
} |
|
private void lvSymbolView_SelectedIndexChanged(object sender, System.EventArgs e) |
|
{ |
|
this.m_DistStyleGalleryItem = null; |
|
if (this.lvSymbolView.SelectedItems.Count > 0) |
|
{ |
|
if (this.lvSymbolView.SelectedItems[0].Tag is IDoStyleGalleryItem) |
|
{ |
|
this.m_DistStyleGalleryItem = (this.lvSymbolView.SelectedItems[0].Tag as IDoStyleGalleryItem); |
|
if (this.m_DistStyleGalleryItem != null) |
|
{ |
|
this.btnOK.Enabled = true; |
|
this.m_SelectSymbol = this.m_DistStyleGalleryItem; |
|
this.resultSymbol = this.m_SelectSymbol.Item.Item; |
|
this.PreviewGalleryItem(); |
|
return; |
|
} |
|
} |
|
} |
|
else |
|
{ |
|
this.btnOK.Enabled = false; |
|
} |
|
} |
|
private void chkLargeIcon_CheckedChanged(object sender, ItemClickEventArgs e) |
|
{ |
|
if (this.chkLargeIcon.Checked) |
|
{ |
|
this.lvSymbolView.View = System.Windows.Forms.View.LargeIcon; |
|
} |
|
} |
|
private void chkSmallIcon_CheckedChanged(object sender, ItemClickEventArgs e) |
|
{ |
|
if (this.chkSmallIcon.Checked) |
|
{ |
|
this.lvSymbolView.View = System.Windows.Forms.View.SmallIcon; |
|
} |
|
} |
|
private void chkTile_CheckedChanged(object sender, ItemClickEventArgs e) |
|
{ |
|
if (this.chkTile.Checked) |
|
{ |
|
this.lvSymbolView.View = System.Windows.Forms.View.Tile; |
|
} |
|
} |
|
private void chkDetail_CheckedChanged(object sender, ItemClickEventArgs e) |
|
{ |
|
if (this.chkDetail.Checked) |
|
{ |
|
this.lvSymbolView.View = System.Windows.Forms.View.Details; |
|
} |
|
} |
|
private void chkList_CheckedChanged(object sender, ItemClickEventArgs e) |
|
{ |
|
if (this.chkList.Checked) |
|
{ |
|
this.lvSymbolView.View = System.Windows.Forms.View.List; |
|
} |
|
} |
|
private void lvSymbolView_MouseUp(object sender, MouseEventArgs e) |
|
{ |
|
if (e.Button == MouseButtons.Right) |
|
{ |
|
this.pmView.ShowPopup(System.Windows.Forms.Control.MousePosition); |
|
} |
|
} |
|
private void PreviewGalleryItem() |
|
{ |
|
try |
|
{ |
|
//霍岩 2018-11-13 刷新右侧预览PictureEdit |
|
this.picPreview.Image = StyleGalleryItemView.StyleGalleryItemToBmp(64, m_DistStyleGallery.get_Class(this.m_ClassIndex), m_DistStyleGalleryItem.Item); |
|
if (this.m_CurrentUc != null) |
|
{ |
|
this.m_SrcSymbolClone = (this.m_DistStyleGalleryItem.Item.Item as IClone); |
|
if (this.m_SrcSymbolClone != null) |
|
{ |
|
this.m_TarCloneSymbol = (this.m_SrcSymbolClone.Clone() as ISymbol); |
|
this.m_CurrentUc.Init(ref this.m_TarCloneSymbol); |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
private void btnOK_Click(object sender, System.EventArgs e) |
|
{ |
|
if (this.m_TarCloneSymbol != null) |
|
{ |
|
this.m_DistStyleGalleryItem.Item.Item = this.m_TarCloneSymbol; |
|
this.resultSymbol = this.m_TarCloneSymbol; |
|
} |
|
base.DialogResult = DialogResult.OK; |
|
base.Close(); |
|
} |
|
public bool Save() |
|
{ |
|
return true; |
|
} |
|
public void DiscardModify() |
|
{ |
|
} |
|
public bool CanLeave() |
|
{ |
|
return true; |
|
} |
|
public void RefreshData() |
|
{ |
|
} |
|
public void SimpleCallBack(CallBack<string> param) |
|
{ |
|
} |
|
public void Initialize() |
|
{ |
|
} |
|
private void barCategories_EditValueChanged(object sender, System.EventArgs e) |
|
{ |
|
try |
|
{ |
|
this.Cursor = Cursors.WaitCursor; |
|
string text = this.barCategories.EditValue.ToString(); |
|
this.lvSymbolView.Items.Clear(); |
|
if (text == "<所有分组>") |
|
{ |
|
if (this.m_ViewItemDictionary == null) |
|
return; |
|
using (Dictionary<string, List<ListViewItem>>.Enumerator enumerator = this.m_ViewItemDictionary.GetEnumerator()) |
|
{ |
|
while (enumerator.MoveNext()) |
|
{ |
|
KeyValuePair<string, List<ListViewItem>> current = enumerator.Current; |
|
this.lvSymbolView.Items.AddRange(current.Value.ToArray()); |
|
} |
|
goto IL_DF; |
|
} |
|
} |
|
foreach (KeyValuePair<string, List<ListViewItem>> current2 in this.m_ViewItemDictionary) |
|
{ |
|
if (current2.Key == text) |
|
{ |
|
this.lvSymbolView.Items.AddRange(current2.Value.ToArray()); |
|
} |
|
} |
|
IL_DF: |
|
this.Cursor = Cursors.Default; |
|
} |
|
catch |
|
{ |
|
this.Cursor = Cursors.Default; |
|
} |
|
} |
|
bool IUIPlugIn.Visible |
|
{ |
|
get; |
|
set; |
|
} |
|
DialogResult ISymbolSelector.ShowDialog() |
|
{ |
|
return base.ShowDialog(); |
|
} |
|
DialogResult ISymbolSelector.ShowDialog(IWin32Window owner) |
|
{ |
|
return base.ShowDialog(owner); |
|
} |
|
FormStartPosition ISymbolSelector.StartPosition |
|
{ |
|
get; |
|
set; |
|
} |
|
|
|
/// <summary> |
|
/// 取消按钮点击事件 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
/// 霍岩 2018-11-13 增加 |
|
private void btnCancel_Click(object sender, System.EventArgs e) |
|
{ |
|
this.resultSymbol = null; |
|
base.DialogResult = DialogResult.Cancel; |
|
base.Close(); |
|
} |
|
|
|
private void btnView_ItemClick(object sender, ItemClickEventArgs e) |
|
{ |
|
|
|
} |
|
} |
|
}
|
|
|