// // Copyright (c) PlaceholderCompany. All rights reserved. // using GeoSigma.SigmaDrawerStyle; using GeoSigma.SigmaDrawerUtil; using GeoSigma.UCDraw.Drawtool; using GeoSigmaDrawLib; using SigmaDrawerElement; using StyleLibManager; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Reflection; using System.Windows.Forms; namespace UCDraw { public delegate void SymbolSigma(GeoSigmaDrawLib.GeoSigmaXY geoSigma); /// /// 属性面板 /// public partial class PanelEleProperty : UserControl { public WellBaseDrawView Viewer { get; set; } public string LayerName { get; set; } private int propertyType = 0; // 0-层位属性;1-元素属性 private int propertyIndex = -1; private int elementPropertyIndex = -1; public SymbolSigma GetSigmaEvent { get; set; } = null; /// /// 图元属性发生了变化 /// public event EventHandler ElementChanged; /// /// 图层属性发生了变化 /// public event EventHandler LayerChanged; public PanelEleProperty() { this.InitializeComponent(); } /// /// 属性控件绘制事件. /// /// The sender. /// The e. private void propertyGrid_Paint(object sender, PaintEventArgs e) { PropertyGrid propertyGrid = sender as PropertyGrid; Type objectType = propertyGrid.SelectedObject?.GetType(); FieldInfo categorysinfo = objectType?.GetField("categorys", BindingFlags.NonPublic | BindingFlags.Instance); if (categorysinfo != null) { List categorys = categorysinfo.GetValue(propertyGrid.SelectedObject) as List; propertyGrid.CollapseAllGridItems(); GridItemCollection currentPropEntries = typeof(PropertyGrid).GetField("currentPropEntries", BindingFlags.NonPublic | BindingFlags.Instance) .GetValue(propertyGrid) as GridItemCollection; GridItem[] newarray = currentPropEntries.Cast().OrderBy((t) => categorys.IndexOf(t.Label)).ToArray(); currentPropEntries.GetType().GetField("entries", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(currentPropEntries, newarray); propertyGrid.ExpandAllGridItems(); // 获取顶层分类节点 GridItem rootItem = propertyGrid.SelectedGridItem; while (rootItem?.Parent != null) { rootItem = rootItem.Parent; } // 展开第一级分类 foreach (GridItem item in rootItem?.GridItems) { item.Expanded = true; } } propertyGrid.Paint -= this.propertyGrid_Paint; } private DrawerStyle currentStyle; /// /// 图层属性 /// public DrawerStyle CurrentStyle { get => this.currentStyle; set { this.currentStyle = value; this.ppgLayer.SelectedObject = null; this.lsvLayer.Items.Clear(); // lsvElement.Items.Clear(); if (this.currentStyle == null) { this.SetElementUI(); return; } if (this.currentStyle.CurveStyle != null) { List lstCurve = this.currentStyle.CurveStyle.Properties; if (lstCurve != null && lstCurve.Count > 0) { int nIndex = 0; foreach (CurveView curve in lstCurve) { if (curve is CurveStyleBase) { continue; } nIndex++; ListViewItem lvi = new ListViewItem(string.Empty + nIndex); lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, curve.TypeName)); lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, GeoSigma.UCDraw.Properties.Resources.PanelProperty_Curve_TypeName)); lvi.Tag = curve; this.lsvLayer.Items.Add(lvi); } } } if (this.currentStyle.PontStyle != null) { AddPointStyleItem(this.currentStyle.PontStyle, this.lsvLayer); } if (this.lsvLayer.Items.Count > 0) { // CurveProperty property = lsvCurve.Items[0].Tag as CurveProperty; this.lsvLayer.Items[0].Selected = true; // propertyGrid.SelectedObject = lsvLayer.Items[0].Tag; } this.lsvLayer.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); this.SetElementUI(); } } private DrawerElementProperty elementProperty; /// /// 图元属性 /// public DrawerElementProperty ElementProperty { get { return this.elementProperty; } set { this.elementProperty = value; this.ppgElement.SelectedObject = null; this.ppgData.SelectedObject = null; this.lsvElement.Items.Clear(); if (this.elementProperty == null || this.elementProperty.Element == null) { this.SetElementUI(); return; } if (this.Viewer.SelectGetLayerName(out string layer)) { this.elementProperty.Element.Layer = layer; } this.ppgData.SelectedObject = this.elementProperty.Element; if (this.IsPointType(this.elementProperty.Element.ElementType)) { if (this.elementProperty.PointStyle != null) { AddPointStyleItem(this.elementProperty.PointStyle, this.lsvElement); } } else if (this.elementProperty.Element.ElementType == DrawElementType.ELEMENT_CURVE) { this.lsvElement.Visible = true; this.ppgElement.Visible = true; if (this.elementProperty.CurveStyle != null) { List lstCurve = this.elementProperty.CurveStyle.Properties; if (lstCurve != null && lstCurve.Count > 0) { int nIndex = 1; foreach (CurveView curve in lstCurve) { if (curve is CurveStyleBase) { continue; } ListViewItem lvi = new ListViewItem(string.Empty + nIndex); lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, curve.TypeName)); lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, GeoSigma.UCDraw.Properties.Resources.PanelProperty_Curve_TypeName)); lvi.Tag = curve; this.lsvElement.Items.Add(lvi); nIndex++; } } } } else if (this.elementProperty.Element.ElementType == DrawElementType.ELEMENT_MESH) { DrawerSurface surface = this.elementProperty.Element as DrawerSurface; // surface.Items.DrawerUpdateEvent +=new DrawerUpdateEventHandler( Items_DrawerUpdateEvent); if (surface.Items.DrawerUpdateEvent == null) { surface.Items.DrawerUpdateEvent += (GradientColors colors) => { surface.SetColors(colors); string strData = DrawerElementHelp.Serialize(this.elementProperty); if (this.Viewer.SetElementProperty(strData) == true) //ggff { this.Viewer.Redraw(); } // MessageBox.Show("Need Redraw"); // Viewer.Redraw(); }; } } if (this.lsvElement.Items.Count > 0) { this.lsvElement.Items[0].Selected = true; } this.lsvElement.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); this.SetElementUI(); this.SetDataPropertyStatus(this.ppgData); } } public long ElementPosition { get; set; } = 0; /// protected override void OnHandleCreated(EventArgs e) { float fDpixRatio = AutoResizeForm.GetWindowsZoomRatio(this.CreateGraphics()); if (fDpixRatio != 1.0f) { this.tsElementToolBar.ImageScalingSize = new Size( (int)(this.tsElementToolBar.ImageScalingSize.Width * fDpixRatio) , (int)(this.tsElementToolBar.ImageScalingSize.Height * fDpixRatio)); foreach (ToolStripItem item in this.tsElementToolBar.Items) { if (item.Image != null) { Image imgDest = AutoResizeForm.ImageBicubicResize( item.Image, fDpixRatio); item.Image.Dispose(); item.Image = imgDest; } } this.tsLayerToolBar.ImageScalingSize = new Size( (int)(this.tsLayerToolBar.ImageScalingSize.Width * fDpixRatio) , (int)(this.tsLayerToolBar.ImageScalingSize.Height * fDpixRatio)); foreach (ToolStripItem item in this.tsLayerToolBar.Items) { if (item.Image != null) { Image imgDest = AutoResizeForm.ImageBicubicResize( item.Image, fDpixRatio); item.Image.Dispose(); item.Image = imgDest; } } } } /// /// 设置属性的状态 /// /// 图元属性 private void SetPropertyStatus(PropertyGrid ppg) { object varElement = ppg.SelectedObject; if (varElement is CurveProperty curveProperty) { bool bReadOnly = !IsWaveCurve(curveProperty); { PropertyHelp.SetPropertyReadOnly(ppg.SelectedObject, "WaveT", bReadOnly); PropertyHelp.SetPropertyReadOnly(varElement, "WaveA", bReadOnly); PropertyHelp.SetPropertyReadOnly(curveProperty, "WaveNum", bReadOnly); } PropertyHelp.SetPropertyReadOnly(curveProperty, nameof(CurveProperty.Alpha), (curveProperty.Base.Style & (int)LineType.PLINE_HS) != 0); } } /// /// Sets 数据属性的只读或可视状态. /// /// The PPG. private void SetDataPropertyStatus(PropertyGrid ppg) { object varElement = ppg.SelectedObject; if (varElement is SigmaDrawerElement.DrawerSurface surface) { PropertyHelp.SetPropertyReadOnly(varElement, "Point", surface.AutoUpdate); PropertyHelp.SetPropertyReadOnly(varElement, "RulerSize", surface.AutoUpdate); PropertyHelp.SetPropertyReadOnly(varElement, "RulerTextHeight", surface.AutoUpdate); PropertyHelp.SetPropertyReadOnly(varElement, "RulerNumber", surface.AutoUpdate); PropertyHelp.SetPropertyReadOnly(varElement, "RulerDF", surface.AutoUpdate); PropertyHelp.SetPropertyReadOnly(varElement, "RulerStyleReverse", surface.AutoUpdate); PropertyHelp.SetPropertyReadOnly(varElement, "RulerRangeZ", surface.AutoUpdate); } ppg.Refresh(); } // 图元变更后, UI处理逻辑 /// /// Sets the element u i. /// private void SetElementUI() { this.tsbLayerPropAddPoint.Enabled = !this.lsvLayer.Items.OfType() .Any(r => this.IsPointStyle(r.Tag)); if (this.elementProperty != null && this.elementProperty.Element != null) { bool isCurve = this.elementProperty.Element.ElementType == DrawElementType.ELEMENT_CURVE; bool isPoint = this.IsPointType(this.elementProperty.Element.ElementType); this.tsbElementPropAddLine.Enabled = isCurve; this.tsbElementPropAddPoint.Enabled = isPoint && (!this.ElementHasPointItems() || this.elementProperty.PointStyle == null); this.tsbtnElementStyleLibrary.Enabled = this.tsbElementPropAddPoint.Enabled | this.tsbElementPropAddLine.Enabled; this.tsbElementPropMoveUp.Enabled = isCurve; this.tsbElementPropMoveDown.Enabled = isCurve; this.tsbElementPropDel.Enabled = isCurve; if (isPoint) { this.splitElement.Panel1Collapsed = false; this.splitElementGrid.Panel1Collapsed = false; // this.splitElement.Panel1Collapsed = true; // this.splitElementGrid.Panel1Collapsed = this.elementProperty.PointStyle == null; // this.tsbElementPropDel.Enabled = this.elementProperty.PointStyle != null; } else if (isCurve) { this.splitElement.Panel1Collapsed = false; this.splitElementGrid.Panel1Collapsed = false; } else { this.splitElement.Panel1Collapsed = true; this.splitElementGrid.Panel1Collapsed = true; } } else { this.splitElement.Panel1Collapsed = true; this.splitElementGrid.Panel1Collapsed = true; this.tsbElementPropAddLine.Enabled = false; this.tsbElementPropAddPoint.Enabled = false; this.tsbtnElementStyleLibrary.Enabled = false; this.tsbElementPropMoveUp.Enabled = false; this.tsbElementPropMoveDown.Enabled = false; this.tsbElementPropDel.Enabled = false; } this.OnClipboardChanged(); } private bool ElementHasPointItems() { return this.lsvElement.Items.OfType().Any(r => this.IsPointStyle(r.Tag)); } /// /// 是否是点类数据 /// /// 数据类型 /// 是否点类数据 private bool IsPointType(DrawElementType elementType) { return (elementType == DrawElementType.ELEMENT_POINT || elementType == DrawElementType.ELEMENT_XYZ || elementType == DrawElementType.ELEMENT_TWOPOINT || elementType == DrawElementType.ELEMENT_CROSSPOINT); } /// /// 显示图层属性 /// /// 图层属性 public void ShowLayerProperty(DrawerStyle layerStyle) { this.CurrentStyle = layerStyle; this.tabControl1.SelectTab(0); this.LayerChanged?.Invoke(this, new EventArgs()); } /// /// Shows the element property. /// /// The element property. /// The position. public void ShowElementProperty(DrawerElementProperty elementProperty, long position) { this.ElementPosition = position; this.ElementProperty = elementProperty; this.tabControl1.SelectTab(1); this.ElementChanged?.Invoke(this, new EventArgs()); } /// /// 选择图层属性 /// /// sender /// e private void lsvCurve_SelectedIndexChanged(object sender, EventArgs e) { if (this.lsvLayer.SelectedItems.Count > 0) { this.ppgLayer.SelectedObject = this.lsvLayer.SelectedItems[0].Tag; this.propertyType = 0; this.propertyIndex = this.lsvLayer.SelectedItems[0].Index; } } /// /// 选择图元属性 /// /// sender /// e private void lsvElement_SelectedIndexChanged(object sender, EventArgs e) { if (this.lsvElement.SelectedItems.Count > 0) { this.ppgElement.SelectedObject = this.lsvElement.SelectedItems[0].Tag; // propertyType=0; this.elementPropertyIndex = this.lsvElement.SelectedItems[0].Index; } } /// /// 属性修改事件 /// /// sender /// e private void ppgLayer_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { object varStyle = this.ppgLayer.SelectedObject; if (varStyle is DrawerPointStyle) { if (!this.needResetDraw(e.ChangedItem)) { return; } string strPointStyle = ((DrawerPointStyle)varStyle).SerialXml(); if (this.Viewer.SetLayerHowtoViewPoint(this.LayerName, strPointStyle, true) == true) { this.Viewer.Redraw(); } } else { if (e.ChangedItem.Label.IndexOf("步长|数目") >= 0) { this.ppgLayer.SelectedObject = varStyle; } string strCurveStyle = ((CurveView)varStyle).SerialXml(); // Console.WriteLine(strCurveStyle); strCurveStyle = strCurveStyle.Replace("true", "1"); strCurveStyle = strCurveStyle.Replace("false", "0"); if (this.Viewer.SetLayerHowtoViewCurve(this.LayerName, strCurveStyle, this.propertyIndex) == true) { this.Viewer.Redraw(); } this.SetPropertyStatus(s as PropertyGrid); } } /// /// needs the reset draw. /// /// The item. /// A bool. private bool needResetDraw(GridItem item) { if (item.Label.IndexOf("固定比例") >= 0) { return false; } return true; } /// /// ppgs the element_ property value changed. /// /// The s. /// The e. private void ppgElement_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { if (this.elementProperty == null || this.elementProperty.Element == null) { return; } object varElement = this.ppgData.SelectedObject; if (varElement is DrawerWellGroup) { DrawerWellGroup wellGroup = varElement as DrawerWellGroup; WellGroupParameter groupPara = wellGroup.Parameter; WellGroupCreateParameter drawerPara = new WellGroupCreateParameter(groupPara); drawerPara.WellX = wellGroup.X; drawerPara.WellY = wellGroup.Y; drawerPara.WellName = wellGroup.Name; WellGroupCaculator caculator = new WellGroupCaculator(); DrawerWellGroup wellGroupNew = caculator.CreateWellGroup(drawerPara); this.elementProperty.Element = wellGroupNew; // ppgElement.SelectedObject = elementProperty.Element; } bool state = true; if (varElement is DrawerSurface) { DrawerSurface surfaces = varElement as DrawerSurface; state = surfaces.AutoUpdate; } string strData = DrawerElementHelp.Serialize(this.elementProperty); if (this.Viewer.SetElementProperty(strData/*, state*/) == true) //ggff { this.Viewer.Redraw(); } else { return; } if (varElement is DrawerFrame) { this.ppgData.SelectedObject = this.elementProperty.Element; } if (e.ChangedItem.Label.IndexOf("步长|数目") >= 0) { this.ppgElement.SelectedObject = this.ppgElement.SelectedObject; } this.SetDataPropertyStatus(this.ppgData); this.SetPropertyStatus(s as PropertyGrid); // (s as PropertyGrid).Refresh(); } public class ReadOnlyPropertyDescriptor : PropertyDescriptor { private PropertyDescriptor innerDescriptor; private bool isReadOnly = true; public ReadOnlyPropertyDescriptor(PropertyDescriptor innerDescriptor, bool isReadOnly) : base(innerDescriptor) { this.innerDescriptor = innerDescriptor; this.isReadOnly = isReadOnly; } public override bool IsReadOnly { get { return true; } } public override Type ComponentType => this.innerDescriptor.ComponentType; public override Type PropertyType => this.innerDescriptor.PropertyType; /// /// Cans the reset value. /// /// The component. /// A bool. public override bool CanResetValue(object component) { return this.innerDescriptor.CanResetValue(component); } /// /// Gets the value. /// /// The component. /// An object. public override object GetValue(object component) { return this.innerDescriptor.GetValue(component); } /// /// Resets the value. /// /// The component. public override void ResetValue(object component) { this.innerDescriptor.ResetValue(component); } /// /// Sets the value. /// /// The component. /// The value. public override void SetValue(object component, object value) { if (!this.isReadOnly) { this.innerDescriptor.SetValue(component, value); } } /// /// Shoulds the serialize value. /// /// The component. /// A bool. public override bool ShouldSerializeValue(object component) { return this.innerDescriptor.ShouldSerializeValue(component); } } /// /// 向上移动曲线样式 /// /// ppg /// lsv /// pred private void MoveUpCurveStyle(PropertyGrid ppg, ListView lsv, Func pred) { object varStyle = ppg.SelectedObject; if (!(varStyle is DrawerPointStyle)) { List list = lsv.Items.OfType().Where(r => r.Tag is CurveView).ToList(); int index = list.FindIndex(r => r.Tag is CurveView && r.Tag == varStyle); if (index > 0) { if (pred(index)) { int i = lsv.Items.IndexOf(list[index]); ListViewItem item = lsv.Items[i]; lsv.Items.RemoveAt(i); lsv.Items.Insert(i - 1, item); this.Viewer.Redraw(); } } } } /// /// 向下移动曲线样式 /// /// ppg /// lsv /// pred private void MoveDownCurveStyle(PropertyGrid ppg, ListView lsv, Func pred) { object varStyle = ppg.SelectedObject; if (!(varStyle is DrawerPointStyle)) { List list = lsv.Items.OfType().Where(r => r.Tag is CurveView).ToList(); int index = list.FindIndex(r => r.Tag is CurveView && r.Tag == varStyle); if (index < list.Count - 1) { if (pred(index)) { int i = lsv.Items.IndexOf(list[index]); ListViewItem item = lsv.Items[i]; lsv.Items.RemoveAt(i); lsv.Items.Insert(i + 1, item); this.Viewer.Redraw(); } } } } /// /// 删除选择的样式 /// /// 属性面板 /// 修饰列表 /// 是否是元素属性 /// 删除曲线样式委托 /// 删除点样式委托 private void DeleteStyle(PropertyGrid ppg, ListView lsv, bool element, Func predCurve, Func predPoint) { if (lsv.SelectedItems.Count == 0) { return; } // 从数据对象中移除修饰 DeleteCurveStyles(lsv, element, predCurve); DeletePointStyles(lsv, element, predPoint); if (lsv.Items.Count == 0) { ppg.SelectedObject = null; } if (lsv.Items.Count > 0) { lsv.Items[0].Selected = true; } // Reset listview Index; int n = 1; for (int i = 0; i < lsv.Items.Count; i++) { ListViewItem item = lsv.Items[i]; if (item.Tag is CurveView) { item.Text = string.Empty + n++; } } this.SetElementUI(); } private void DeletePointStyles(ListView lsv, bool element, Func predPoint) { bool needRemovePointStyle = GetSelectedTags(lsv).Any(tag => IsPointStyle(tag)); if (!needRemovePointStyle) { return; } if (!predPoint()) { return; } for (int idx = lsv.Items.Count - 1; idx >= 0; idx--) { if (IsPointStyle(lsv.Items[idx].Tag)) { lsv.Items[idx].Remove(); } } if (element && this.elementProperty != null) { this.elementProperty.PointStyle = null; } else if (!element && this.currentStyle != null) { this.currentStyle.PontStyle = null; } } private void DeleteCurveStyles(ListView lsv, bool element, Func predCurve) { List tagList = GetSelectedTags(lsv); foreach (object item in tagList) { if (item is CurveView cv) { for (int idx = 0; idx < lsv.Items.Count; idx++) { if (ReferenceEquals(item, lsv.Items[idx].Tag)) { if (predCurve(idx)) { this.Viewer.Redraw(); lsv.Items[idx].Remove(); if (element) { this.elementProperty?.CurveStyle.Properties.Remove(cv); } else { this.currentStyle?.CurveStyle.Properties.Remove(cv); } } break; } } } } } private List GetSelectedTags(ListView listView) { return listView.SelectedItems.Cast() .Select(item => item.Tag) .ToList(); } private bool IsPointStyle(object style) { return style is DrawerPointStyle || style is DrawerPointStyleText || style is DrawerPointStyleSymbol || style is DrawerPointStyleZValue; } /// /// 清除修饰 /// /// 属性面板控件 /// 列表控件 /// 清除线样式 /// 清除点样式 /// 元素样式 /// 删除曲线样式函数 /// 删除点样式函数 private void ClearStyle(PropertyGrid ppg, ListView lsv, bool curveStyle, bool pointStyle, bool element, Func predCurve, Func predPoint) { if (lsv.Items.Count == 0) { return; } List tagList = new List(); for (int idx = 0; idx < lsv.Items.Count; idx++) { tagList.Add(lsv.Items[idx].Tag); } // 从数据对象中移除修饰 foreach (object item in tagList) { if (item is CurveView cv && curveStyle) { for (int idx = 0; idx < lsv.Items.Count; idx++) { if (ReferenceEquals(item, lsv.Items[idx].Tag)) { if (predCurve(idx)) { this.Viewer.Redraw(); lsv.Items[idx].Remove(); if (element) { this.elementProperty?.CurveStyle.Properties.Remove(cv); } else { this.currentStyle?.CurveStyle.Properties.Remove(cv); } } break; } } } else if (item is DrawerPointStyle && pointStyle) { if (predPoint()) { this.Viewer.Redraw(); for (int idx = 0; idx < lsv.Items.Count; idx++) { if (ReferenceEquals(item, lsv.Items[idx].Tag)) { lsv.Items[idx].Remove(); } } if (element && this.elementProperty != null) { this.elementProperty.PointStyle = null; } else if (!element && this.currentStyle != null) { this.currentStyle.PontStyle = null; } } } } if (lsv.Items.Count == 0) { ppg.SelectedObject = null; } if (lsv.Items.Count > 0) { lsv.Items[0].Selected = true; } // Reset listview Index; int n = 1; for (int i = 0; i < lsv.Items.Count; i++) { ListViewItem item = lsv.Items[i]; if (item.Tag is CurveView) { item.Text = string.Empty + n++; } } this.SetElementUI(); } /// /// 添加曲线样式 /// /// lsv /// curve private void AddCurveStyle(ListView lsv, CurveView curve) { { this.Viewer.Redraw(); int curveCount = lsv.Items.OfType().Count(r => r.Tag is CurveView); ListViewItem lvi = new ListViewItem(string.Empty + (curveCount + 1)); lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, curve.TypeName)); lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, GeoSigma.UCDraw.Properties.Resources.PanelProperty_Curve_TypeName)); curve.Geo = this.Viewer.Geo; lvi.Tag = curve; if (lsv.Items.Count > 0 && lsv.Items[lsv.Items.Count - 1] is ListViewItem lastItem && lastItem.Tag is DrawerPointStyle) { lastItem.Remove(); lsv.Items.Add(lvi); lsv.Items.Add(lastItem); lsv.SelectedItems.Clear(); lvi.Selected = true; } else { lsv.Items.Add(lvi); lsv.SelectedItems.Clear(); lvi.Selected = true; } lsv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); this.SetElementUI(); } this.OnClipboardChanged(); } /// /// Configs the curve fill symbol. /// /// The curve. private void ConfigCurveFillSymbol(T curve) where T : CurveView { CurveFillSymbol curveFill = new CurveFillSymbol(); curveFill.Geo = this.Viewer.Geo; PropertyInfo[] props = curveFill.GetType().GetProperties(); foreach (PropertyInfo pi in props) { if (pi.Name == "SymbolEditor") { // curveFill = new CurveFillSymbol(); curveFill.Geo = this.Viewer.Geo; pi.SetValue(curve, curveFill.SymbolEditor, null); } if (pi.PropertyType.Equals(typeof(PropertyPoint))) { PropertyPoint symbol = new PropertyPoint(); if (pi.Name == "Delt") { symbol = curveFill.Delt; } else if (pi.Name == "Grid") { symbol = curveFill.Grid; } else if (pi.Name == "Scale") { symbol = curveFill.Scale; } pi.SetValue(curve, symbol, null); } } } /// /// 添加曲线样式(图元) /// /// T private void AddElementCurveStyle() where T : CurveView { if (this.elementProperty == null) { return; } if (this.elementProperty.ElementType != DrawElementType.ELEMENT_CURVE) { return; } Type t = typeof(T); T curve = Activator.CreateInstance(t) as T; // CurveStyleType cst = (CurveStyleType)Enum.Parse(typeof(CurveStyleType), t.Name); CurveStyleType styleType = curve.StyleType; // AddCurveStyle(lsvElement, curve, true, () => Viewer.SelectCreateCurveStyle(cst, curve.SerialXml())); this.Viewer.SelectCreateCurveStyle(styleType, curve.SerialXml()); if (this.elementProperty != null) { if (this.elementProperty.CurveStyle == null) { this.elementProperty.CurveStyle = new DrawerCurveStyle(); } this.elementProperty.CurveStyle.Properties.Add(curve); } if (typeof(T) == typeof(CurveFillSymbol)) { this.ConfigCurveFillSymbol(curve); } this.AddCurveStyle(this.lsvElement, curve); } /// /// 添加曲线样式(图层) /// /// CurveView private void AddLayerCurveStyle() where T : CurveView { // CurveLocation curveLocation = new CurveLocation(); Type t = typeof(T); T curve = Activator.CreateInstance(t) as T; if (typeof(T) == typeof(CurveFillSymbol)) { this.ConfigCurveFillSymbol(curve); } else if (typeof(T) == typeof(CurveTwoMark)) { CurveTwoMark curveTwoMark = new CurveTwoMark(); curveTwoMark.Geo = this.Viewer.Geo; PropertyInfo[] props = t.GetProperties(); foreach (PropertyInfo pi in props) { if (pi.Name == "SymbolEditor") { curveTwoMark.Geo = this.Viewer.Geo; pi.SetValue(curve, curveTwoMark.SymbolEditor, null); break; } } } else if (typeof(T) == typeof(CurveScaleSymbol)) { CurveScaleSymbol curveStyle = new CurveScaleSymbol(); curveStyle.Geo = this.Viewer.Geo; PropertyInfo[] props = t.GetProperties(); foreach (PropertyInfo pi in props) { if (pi.Name == "SymbolEditor") { curveStyle.Geo = this.Viewer.Geo; pi.SetValue(curve, curveStyle.SymbolEditor, null); break; } } } // CurveStyleType cst = (CurveStyleType)Enum.Parse(typeof(CurveStyleType), t.Name); // CurveStyleType curveStyle = curve.StyleType; if (this.lsvLayer.Items.Count == 0) { this.Viewer.CreateLayerCurveStyle(this.LayerName, curve.StyleType, curve.SerialXml()); } else { this.Viewer.AddLayerCurveStyle(this.LayerName, curve.StyleType, curve.SerialXml()); } if (this.currentStyle != null) { if (this.currentStyle.CurveStyle == null) { this.currentStyle.CurveStyle = new DrawerCurveStyle(); } this.currentStyle.CurveStyle.Properties.Add(curve); } this.AddCurveStyle(this.lsvLayer, curve); } /// /// Adds the point style. /// /// The dps. /// The lsv. /// If true, element. /// The pred. private void AddPointStyle(DrawerPointStyle dps, ListView lsv, bool element, Func pred) { if (pred(dps)) { this.Viewer.Redraw(); if (element && this.elementProperty != null) { this.elementProperty.PointStyle = dps; this.ppgElement.SelectedObject = dps; } else if (!element && this.currentStyle != null) { this.currentStyle.PontStyle = dps; this.currentStyle.PontStyle.Geo = this.Viewer.Geo; } ListViewItem lvi2 = AddPointStyleItem(dps, lsv); lsv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); if (lsv.Visible != true) { lsv.Visible = true; } this.SetElementUI(); lvi2.Selected = true; } this.OnClipboardChanged(); } /// /// 添加点样式,点样式一次要添加三个 Item /// /// 点样式 /// 被添加的列表 /// 返回第一个 Item private static ListViewItem AddPointStyleItem(DrawerPointStyle dps, ListView lsv) { ListViewItem lvi2 = new ListViewItem("1"); lvi2.SubItems.Add(new ListViewItem.ListViewSubItem(lvi2, "文本")); lvi2.SubItems.Add(new ListViewItem.ListViewSubItem(lvi2, "点")); lvi2.Tag = new DrawerPointStyleText(dps); lsv.Items.Add(lvi2); ListViewItem lvi3 = new ListViewItem("2"); lvi3.SubItems.Add(new ListViewItem.ListViewSubItem(lvi3, "符号")); lvi3.SubItems.Add(new ListViewItem.ListViewSubItem(lvi3, "点")); lvi3.Tag = new DrawerPointStyleSymbol(dps); lsv.Items.Add(lvi3); ListViewItem lvi4 = new ListViewItem("3"); lvi4.SubItems.Add(new ListViewItem.ListViewSubItem(lvi4, "Z值")); lvi4.SubItems.Add(new ListViewItem.ListViewSubItem(lvi4, "点")); lvi4.Tag = new DrawerPointStyleZValue(dps); lsv.Items.Add(lvi4); return lvi2; } /// /// Adds the point style. /// /// The lsv. /// If true, element. /// The pred. private void AddPointStyle(ListView lsv, bool element, Func pred) { DrawerPointStyle styleNew = new DrawerPointStyle(); styleNew.Text.Height = 30; styleNew.Text.Width = 12; styleNew.Symbol.Height = 30; styleNew.Symbol.Width = 30; styleNew.Geo = this.Viewer.Geo; this.AddPointStyle(styleNew, lsv, element, pred); } /// /// tsbs the element prop move up_ click. /// /// The sender. /// The e. private void tsbElementPropMoveUp_Click(object sender, EventArgs e) { this.MoveUpCurveStyle(this.ppgElement, this.lsvElement, idx => this.Viewer.SelectMoveUpCurveStyle(idx)); } /// /// tsbs the element prop move down_ click. /// /// The sender. /// The e. private void tsbElementPropMoveDown_Click(object sender, EventArgs e) { this.MoveDownCurveStyle(this.ppgElement, this.lsvElement, idx => this.Viewer.SelectMoveDownCurveStyle(idx)); } /// /// tsbs the layer prop move up_ click. /// /// The sender. /// The e. private void tsbLayerPropMoveUp_Click(object sender, EventArgs e) { this.MoveUpCurveStyle(this.ppgLayer, this.lsvLayer, idx => this.Viewer.SetLayerMoveUpCurveStyle(this.LayerName, idx)); } /// /// tsbs the layer prop move down_ click. /// /// The sender. /// The e. private void tsbLayerPropMoveDown_Click(object sender, EventArgs e) { this.MoveDownCurveStyle(this.ppgLayer, this.lsvLayer, idx => this.Viewer.SetLayerMoveDownCurveStyle(this.LayerName, idx)); } /// /// tsbs the layer prop del_ click. /// /// The sender. /// The e. private void tsbLayerPropDel_Click(object sender, EventArgs e) { this.DeleteStyle(this.ppgLayer, this.lsvLayer, false, idx => this.Viewer.RemoveCurveStyle(this.LayerName, idx), () => this.Viewer.RemovePointStyle(this.LayerName)); } /// /// tsbs the element prop del_ click. /// /// The sender. /// The e. private void tsbElementPropDel_Click(object sender, EventArgs e) { if (this.elementProperty.ElementType == DrawElementType.ELEMENT_POINT) { if (this.lsvElement.Items.Count > 0) { this.lsvElement.Items[0].Selected = true; } } this.DeleteStyle(this.ppgElement, this.lsvElement, true, idx => this.Viewer.SelectRemoveCurveStyle(idx), () => this.Viewer.SelectRemovePointStyle()); } /// /// tsbs the element prop add point_ click. /// /// The sender. /// The e. private void tsbElementPropAddPoint_Click(object sender, EventArgs e) { this.AddPointStyle(this.lsvElement, true, s => this.Viewer.SelectCreatePointStyle(s.SerialXml())); } /// /// tsbs the layer prop add point_ click. /// /// The sender. /// The e. private void tsbLayerPropAddPoint_Click(object sender, EventArgs e) { this.AddPointStyle(this.lsvLayer, false, s => this.Viewer.CreateLayerPointStyle(this.LayerName, s.SerialXml())); } /// /// tsmis the layer prop add curve property_ click. /// /// The sender. /// The e. private void tsmiLayerPropAddCurveProperty_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the layer arrow head_ click. /// /// The sender. /// The e. private void tsmiLayerArrowHead_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the layer arrow tail_ click. /// /// The sender. /// The e. private void tsmiLayerArrowTail_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the layer prop add curve location_ click. /// /// The sender. /// The e. private void tsmiLayerPropAddCurveLocation_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the layer prop add curve scale symbol_ click. /// /// The sender. /// The e. private void tsmiLayerPropAddCurveScaleSymbol_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the layer prop add curve name_ click. /// /// The sender. /// The e. private void tsmiLayerPropAddCurveName_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the layer prop add curve two mark_ click. /// /// The sender. /// The e. private void tsmiLayerPropAddCurveTwoMark_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the layer prop add curve fill symbol_ click. /// /// The sender. /// The e. private void tsmiLayerPropAddCurveFillSymbol_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the layer prop add curve in name_ click. /// /// The sender. /// The e. private void tsmiLayerPropAddCurveInName_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the layer prop add curve in name any_ click. /// /// The sender. /// The e. private void tsmiLayerPropAddCurveInNameAny_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the layer prop add curve effect_ click. /// /// The sender. /// The e. private void tsmiLayerPropAddCurveEffect_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the layer prop add curve center name_ click. /// /// The sender. /// The e. private void tsmiLayerPropAddCurveCenterName_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } /// /// tsmis the element prop add curve property_ click. /// /// The sender. /// The e. private void tsmiElementPropAddCurveProperty_Click(object sender, EventArgs e) { this.AddElementCurveStyle(); } /// /// tsmis the element prop add curve location_ click. /// /// The sender. /// The e. private void tsmiElementPropAddCurveLocation_Click(object sender, EventArgs e) { this.AddElementCurveStyle(); } /// /// tsmis the element prop add curve scale symbol_ click. /// /// The sender. /// The e. private void tsmiElementPropAddCurveScaleSymbol_Click(object sender, EventArgs e) { this.AddElementCurveStyle(); } /// /// tsmis the element prop add curve name_ click. /// /// The sender. /// The e. private void tsmiElementPropAddCurveName_Click(object sender, EventArgs e) { this.AddElementCurveStyle(); } /// /// tsmis the element prop add curve two mark_ click. /// /// The sender. /// The e. private void tsmiElementPropAddCurveTwoMark_Click(object sender, EventArgs e) { this.AddElementCurveStyle(); } /// /// tsmis the element prop add curve fill symbol_ click. /// /// The sender. /// The e. private void tsmiElementPropAddCurveFillSymbol_Click(object sender, EventArgs e) { this.AddElementCurveStyle(); } /// /// tsmis the element prop add curve in name_ click. /// /// The sender. /// The e. private void tsmiElementPropAddCurveInName_Click(object sender, EventArgs e) { this.AddElementCurveStyle(); } /// /// tsmis the element prop add curve in name any_ click. /// /// The sender. /// The e. private void tsmiElementPropAddCurveInNameAny_Click(object sender, EventArgs e) { this.AddElementCurveStyle(); } /// /// tsmis the element prop add curve effect_ click. /// /// The sender. /// The e. private void tsmiElementPropAddCurveEffect_Click(object sender, EventArgs e) { this.AddElementCurveStyle(); } /// /// tsmis the element prop add curve center name_ click. /// /// The sender. /// The e. private void tsmiElementPropAddCurveCenterName_Click(object sender, EventArgs e) { this.AddElementCurveStyle(); } // 当前复制对象变更后, 更新界面 /// /// Ons the clipboard changed. /// /// If true, clear. private void OnClipboardChanged(bool clear = false) { if (clear) { Clipboard.Clear(); } if (this.lsvLayer.SelectedItems.Count == 0) { this.tsbLayerPropCopy.Enabled = false; } else { this.tsbLayerPropCopy.Enabled = true; } if (this.lsvElement.SelectedItems.Count == 0) { this.tsbElementPropCopy.Enabled = false; } else { this.tsbElementPropCopy.Enabled = true; } this.tsbLayerPropPaste.Enabled = this.canPaste(); if (this.elementProperty != null && this.canPaste()) { this.tsbElementPropPaste.Enabled = true; } } /// /// cans the paste. /// /// A bool. private bool canPaste() { return ClipboardHelper.Check(ClipboardHelper.CfDrawStyleXml); } /// /// tsbs the layer prop copy_ click. /// /// The sender. /// The e. private void tsbLayerPropCopy_Click(object sender, EventArgs e) { Clipboard.Clear(); if (this.lsvLayer.SelectedItems.Count == 0) { return; } object obj = null; DrawerStyle drawStyle = null; DrawerCurveStyle curveStyle = null; DrawerPointStyle pointStyle = null; for (int i = 0; i < this.lsvLayer.SelectedItems.Count; i++) { obj = this.lsvLayer.SelectedItems[i].Tag; if (obj is CurveView cv) { if (curveStyle == null) { curveStyle = new DrawerCurveStyle(); } curveStyle.Properties.Add(cv.Clone()); } else if (obj is DrawerPointStyle dps) { if (pointStyle == null) { pointStyle = new DrawerPointStyle(); } pointStyle = dps.Clone(); } } if (curveStyle != null || pointStyle != null) { drawStyle = new DrawerStyle(); drawStyle.CurveStyle = curveStyle; drawStyle.PontStyle = pointStyle; ClipboardHelper.SaveObjectToClipboard(ClipboardHelper.CfDrawStyleXml, drawStyle.SerialXml()); } this.OnClipboardChanged(); } /// /// tsbs the element copy_ click. /// /// The sender. /// The e. private void tsbElementCopy_Click(object sender, EventArgs e) { Clipboard.Clear(); if (!this.lsvElement.Visible && this.lsvElement.SelectedItems.Count == 0) { return; } if (this.elementProperty?.Element == null) { return; } if (this.elementProperty.ElementType != DrawElementType.ELEMENT_POINT && this.elementProperty.ElementType != DrawElementType.ELEMENT_CURVE) { return; } DrawerCurveStyle curveStyle = null; DrawerPointStyle pointStyle = null; for (int i = 0; i < this.lsvElement.SelectedItems.Count; i++) { object obj = this.lsvElement.SelectedItems[i].Tag; if (obj is CurveView cv) { if (curveStyle == null) { curveStyle = new DrawerCurveStyle(); } curveStyle.Properties.Add(cv.Clone()); } else if (obj is DrawerPointStyle dps) { if (pointStyle == null) { pointStyle = new DrawerPointStyle(); } pointStyle = dps.Clone(); } } if (curveStyle != null || pointStyle != null) { DrawerStyle drawStyle = new DrawerStyle { CurveStyle = curveStyle, PontStyle = pointStyle, }; ClipboardHelper.SaveObjectToClipboard(ClipboardHelper.CfDrawStyleXml, drawStyle.SerialXml()); } this.OnClipboardChanged(); } /// /// tsbs the layer prop paste_ click. /// /// The sender. /// The e. private void tsbLayerPropPaste_Click(object sender, EventArgs e) { DrawerStyle drawStyle = null; DrawerCurveStyle curveStyle = null; DrawerPointStyle pointStyle = null; string drawStyleXml = ClipboardHelper.LoadObjectFromClipboard(ClipboardHelper.CfDrawStyleXml); if (!string.IsNullOrEmpty(drawStyleXml)) { drawStyle = new DrawerStyle(); drawStyle = drawStyle.DeserialXml(drawStyleXml); curveStyle = drawStyle.CurveStyle; pointStyle = drawStyle.PontStyle; } if (curveStyle != null) { // 清除曲线样式 this.ClearStyle(this.ppgLayer, this.lsvLayer, true, false, false, idx => this.Viewer.RemoveCurveStyle(this.LayerName, idx), () => this.Viewer.RemovePointStyle(this.LayerName)); for (int i = 0; i < curveStyle.Properties.Count; i++) { CurveView cv = curveStyle.Properties[i]; if (this.lsvLayer.Items.Count == 0) { this.Viewer.CreateLayerCurveStyle(this.LayerName, cv.StyleType, curveStyle.SerialXml()); } else { this.Viewer.AddLayerCurveStyle(this.LayerName, cv.StyleType, curveStyle.SerialXml()); } if (this.CurrentStyle != null) { if (this.currentStyle.CurveStyle == null) { this.currentStyle.CurveStyle = new DrawerCurveStyle(); } this.CurrentStyle.CurveStyle.Properties.Add(cv); } this.AddCurveStyle(this.lsvLayer, cv); } } if (pointStyle != null) { // 清除点样式 this.ClearStyle(this.ppgLayer, this.lsvLayer, false, true, false, idx => this.Viewer.RemoveCurveStyle(this.LayerName, idx), () => this.Viewer.RemovePointStyle(this.LayerName)); ListViewItem lviPoint = this.lsvLayer.Items.OfType().FirstOrDefault(it => it.Tag is DrawerPointStyle); if (lviPoint != null) { if (MessageBox.Show("是否替换现有点修饰?", "粘贴", MessageBoxButtons.YesNo) == DialogResult.Yes) { this.lsvLayer.Items.Remove(lviPoint); pointStyle.Clone(); pointStyle.Geo = this.Viewer.Geo; this.AddPointStyle(pointStyle, this.lsvLayer, false, s => this.Viewer.CreateLayerPointStyle(this.LayerName, s.SerialXml())); } else { return; } } else { pointStyle.Clone(); pointStyle.Geo = this.Viewer.Geo; this.AddPointStyle(pointStyle, this.lsvLayer, false, s => this.Viewer.CreateLayerPointStyle(this.LayerName, s.SerialXml())); } } this.OnClipboardChanged(); } /// /// tsbs the element prop paste_ click. /// /// The sender. /// The e. private void tsbElementPropPaste_Click(object sender, EventArgs e) { if (this.elementProperty == null) { return; } if (this.elementProperty.ElementType != DrawElementType.ELEMENT_POINT && this.elementProperty.ElementType != DrawElementType.ELEMENT_CURVE) { return; } DrawerStyle drawStyle = null; DrawerCurveStyle curveStyle = null; DrawerPointStyle pointStyle = null; string drawStyleXml = ClipboardHelper.LoadObjectFromClipboard(ClipboardHelper.CfDrawStyleXml); if (!string.IsNullOrEmpty(drawStyleXml)) { drawStyle = new DrawerStyle(); drawStyle = drawStyle.DeserialXml(drawStyleXml); curveStyle = drawStyle.CurveStyle; pointStyle = drawStyle.PontStyle; } if (curveStyle != null && this.elementProperty.ElementType == DrawElementType.ELEMENT_CURVE) { // 清除曲线样式 this.ClearStyle(this.ppgElement, this.lsvElement, true, false, false, idx => this.Viewer.RemoveCurveStyle(this.LayerName, idx), () => this.Viewer.RemovePointStyle(this.LayerName)); for (int i = 0; i < curveStyle.Properties.Count; i++) { CurveView cv = curveStyle.Properties[i]; this.Viewer.SelectCreateCurveStyle(cv.StyleType, cv.SerialXml()); if (this.elementProperty != null) { if (this.elementProperty.CurveStyle == null) { this.elementProperty.CurveStyle = new DrawerCurveStyle(); } this.elementProperty.CurveStyle.Properties.Add(cv); } this.AddCurveStyle(this.lsvElement, cv); } } if (pointStyle != null && this.elementProperty.ElementType == DrawElementType.ELEMENT_POINT) { pointStyle.Clone(); pointStyle.Geo = this.Viewer.Geo; this.AddPointStyle(pointStyle, this.lsvElement, true, s => this.Viewer.SelectCreatePointStyle(s.SerialXml())); } this.OnClipboardChanged(); } /// protected override void WndProc(ref Message m) { const int WM_CLIPBOARDUPDATE = 0x031D; if (m.Msg == WM_CLIPBOARDUPDATE) { this.OnClipboardChanged(); } base.WndProc(ref m); } /// /// Panels the property_ load. /// /// The sender. /// The e. private void PanelProperty_Load(object sender, EventArgs e) { GeoSigmaLib.AddClipboardFormatListener(this.Handle); } /// /// ppgs the element_ selected objects changed. /// /// The sender. /// The e. private void ppgElement_SelectedObjectsChanged(object sender, EventArgs e) { this.SetPropertyStatus(this.ppgElement); } /// /// ppgs the data_ selected objects changed. /// /// The sender. /// The e. private void ppgData_SelectedObjectsChanged(object sender, EventArgs e) { if (this.ppgData.SelectedObject == null) { return; } } /// /// ppgs the layer_ selected objects changed. /// /// The sender. /// The e. private void ppgLayer_SelectedObjectsChanged(object sender, EventArgs e) { this.SetPropertyStatus(this.ppgLayer); } /// /// 使用样式库为图层设置样式 /// /// 按钮 /// 事件参数 private void tsbtnLayerStyleLibrary_Click(object sender, EventArgs e) { this.loadStylesLibrary((string group, string style) => { this.Viewer.Geo.StyleLibraryApplyStyleTo(group, style, this.LayerName); this.Viewer.Redraw(); string strCurveData = string.Empty; string strPointData = string.Empty; this.Viewer.GetLayerStyleData(this.LayerName, ref strCurveData, ref strPointData); // 当前层位设置事件 DrawerStyle drawerStyle = new DrawerStyle(); if (strCurveData != string.Empty) { drawerStyle.DeserializeCurve(strCurveData); for (int i = 0; i < drawerStyle.CurveStyle.Properties.Count; i++) { drawerStyle.CurveStyle.Properties[i].Geo = this.Viewer.Geo; } } if (strPointData != string.Empty) { drawerStyle.DeserializePoint(strPointData); drawerStyle.PontStyle.Geo = this.Viewer.Geo; } if (drawerStyle.CurveStyle != null || drawerStyle.PontStyle != null) { this.ShowLayerProperty(drawerStyle); } else { this.ShowLayerProperty(null); } }); } /// /// tsbtns the element style library_ click. /// /// The sender. /// The e. private void tsbtnElementStyleLibrary_Click(object sender, EventArgs e) { this.loadStylesLibrary((string group, string style) => { bool bSuccess = this.Viewer.Geo.StyleLibraryApplyStyleToElement(group, style, this.ElementPosition); if (bSuccess == false) { return; } this.Viewer.Redraw(); string strElementData = string.Empty; long lPosition = 0; bool isElementFind = this.Viewer.Geo.SelectGetElement(ref strElementData, ref lPosition); if (isElementFind && lPosition == this.ElementPosition) { DrawerElementProperty property = DrawerElementHelp.Deserialize(strElementData); if (property != null && property.ElementType == DrawElementType.ELEMENT_MESH) { double zMin = 0; double zMax = 0; this.Viewer.Geo.SurfaceGetZRange(lPosition, ref zMin, ref zMax); DrawerSurface surface = property.Element as DrawerSurface; surface.RangeZ.Zmin = zMin; surface.RangeZ.Zmax = zMax; } this.ShowElementProperty(property, lPosition); } }); } /// /// loads the styles library. /// /// The apply style handler. private void loadStylesLibrary(ApplyStyleHandler applyStyleHandler) { string styleLibPath = Path.Combine(Directory.GetParent(Application.StartupPath).FullName, "Style"); if (!Directory.Exists(styleLibPath)) { Directory.CreateDirectory(styleLibPath); } FrmStyleMain dialog = new FrmStyleMain(styleLibPath); dialog.ApplyStyle += applyStyleHandler; dialog.ShowDialog(this.Viewer); } private void NormalToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private void HeadTailNameToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private void CenterLineToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private void CenterAreaToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private void AnyPositionToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private void ChainageToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private void HeadSymbolToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private void TailSymbolToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private void DoubleSymbolToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private void ManySymbolToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private void SymbolFillToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private void GradientColorToolStripMenuItem_Click(object sender, EventArgs e) { this.AddLayerCurveStyle(); } private bool IsWaveCurve(CurveProperty curveProperty) { return (curveProperty.Base.Style & (int)LineType.PLINE_WAVE) != 0; } private void ElementNormalToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } private void ElementHeadTailToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } private void ElementCenterLineToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } private void ElementCenterAreaToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } private void ElementAnyPositionToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } private void ElementChainageToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } private void ElementHeadSymbolToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } private void ElementTailSymbolToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } private void ElementDoubleSymbolToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } private void ElementManySymbolToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } private void ElementSymbolFillToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } private void ElementGradientColorToolStripMenuItem_Click(object sender, EventArgs e) { AddElementCurveStyle(); } } }