|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using DevExpress.XtraEditors;
|
|
|
|
|
using KGIS.Plugin.LayerProperty.Interface;
|
|
|
|
|
using ESRI.ArcGIS.Display;
|
|
|
|
|
using ESRI.ArcGIS.Carto;
|
|
|
|
|
using ESRI.ArcGIS.ADF;
|
|
|
|
|
using KGIS.Plugin.LayerProperty.Utils;
|
|
|
|
|
using DevExpress.XtraEditors.Controls;
|
|
|
|
|
|
|
|
|
|
namespace KGIS.Plugin.LayerProperty.View.UC_Controls
|
|
|
|
|
{
|
|
|
|
|
public partial class UCLineSymbolAtrribute : XtraUserControl, IUCSymbolAtrribute
|
|
|
|
|
{
|
|
|
|
|
private PictureEdit m_PictureEdit;
|
|
|
|
|
private ISymbol m_Symbol;
|
|
|
|
|
private IStyleGalleryClass m_StyleGalleryClass;
|
|
|
|
|
private ILineSymbol m_LineSymbol;
|
|
|
|
|
public event System.EventHandler SymbolEdited;
|
|
|
|
|
public UCLineSymbolAtrribute()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
public bool Init(ref ISymbol symbol)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
this.m_Symbol = symbol;
|
|
|
|
|
this.m_StyleGalleryClass = new LineSymbolStyleGalleryClassClass();
|
|
|
|
|
this.m_LineSymbol = (symbol as ILineSymbol);
|
|
|
|
|
bool result;
|
|
|
|
|
if (this.m_LineSymbol == null)
|
|
|
|
|
{
|
|
|
|
|
result = false;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (this.m_LineSymbol.Color != null)
|
|
|
|
|
{
|
|
|
|
|
if (!this.m_LineSymbol.Color.NullColor)
|
|
|
|
|
{
|
|
|
|
|
this.clrFillColor.Color = ColorTranslator.FromOle(this.m_LineSymbol.Color.RGB);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.clrFillColor.Color = Color.Transparent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.clrFillColor.Color = Color.Empty;
|
|
|
|
|
}
|
|
|
|
|
this.spOutLineWidth.EditValue = this.m_LineSymbol.Width;
|
|
|
|
|
this.PreviewGalleryItem();
|
|
|
|
|
result = true;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
//RdbUtil.AddException(ex);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
public void SetPicture(PictureEdit pic)
|
|
|
|
|
{
|
|
|
|
|
this.m_PictureEdit = pic;
|
|
|
|
|
}
|
|
|
|
|
private void clrFillColor_EditValueChanged(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (this.m_LineSymbol != null)
|
|
|
|
|
{
|
|
|
|
|
IColor color = this.m_LineSymbol.Color;
|
|
|
|
|
color = Converter.ToRGBColor(this.clrFillColor.Color);
|
|
|
|
|
color.Transparency = this.clrFillColor.Color.A;
|
|
|
|
|
this.m_LineSymbol.Color = color;
|
|
|
|
|
}
|
|
|
|
|
this.PreviewGalleryItem();
|
|
|
|
|
if (this.SymbolEdited != null)
|
|
|
|
|
{
|
|
|
|
|
this.SymbolEdited(null, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
//RdbUtil.AddException(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void PreviewGalleryItem()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (this.m_Symbol != null)
|
|
|
|
|
{
|
|
|
|
|
this.m_PictureEdit.Image = StyleGalleryItemView.GetSymbolBitMap(this.m_PictureEdit.Height, this.m_StyleGalleryClass, this.m_Symbol);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
//RdbUtil.AddException(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void spOutLineWidth_EditValueChanging(object sender, ChangingEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (Convert.ToDouble(e.NewValue) < 0.0)
|
|
|
|
|
{
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (this.m_LineSymbol != null)
|
|
|
|
|
{
|
|
|
|
|
this.m_LineSymbol.Width = Math.Abs(Convert.ToDouble(e.NewValue));
|
|
|
|
|
}
|
|
|
|
|
this.PreviewGalleryItem();
|
|
|
|
|
if (this.SymbolEdited != null)
|
|
|
|
|
{
|
|
|
|
|
this.SymbolEdited(null, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
//RdbUtil.AddException(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|