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.
224 lines
7.7 KiB
224 lines
7.7 KiB
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 ESRI.ArcGIS.Display; |
|
using KGIS.Plugin.LayerProperty.Interface; |
|
using DevExpress.XtraEditors.Controls; |
|
using ESRI.ArcGIS.ADF; |
|
using KGIS.Plugin.LayerProperty.Utils; |
|
using ESRI.ArcGIS.Carto; |
|
|
|
namespace KGIS.Plugin.LayerProperty.View.UC_Controls |
|
{ |
|
public partial class UCFillSymbolAtrribute : XtraUserControl, IUCSymbolAtrribute |
|
{ |
|
private PictureEdit m_PictureEdit; |
|
private ISymbol m_Symbol; |
|
private IDoStyleGalleryItem m_DoStyleGalleryItem; |
|
private IStyleGalleryClass m_StyleGalleryClass; |
|
private IFillSymbol m_FillSymbol; |
|
public event System.EventHandler SymbolEdited; |
|
public UCFillSymbolAtrribute() |
|
{ |
|
InitializeComponent(); |
|
} |
|
public bool Init(ref ISymbol symbol) |
|
{ |
|
try |
|
{ |
|
this.m_Symbol = symbol; |
|
this.m_StyleGalleryClass = new FillSymbolStyleGalleryClassClass(); |
|
this.m_FillSymbol = (symbol as IFillSymbol); |
|
bool result; |
|
if (this.m_FillSymbol == null) |
|
{ |
|
result = false; |
|
return result; |
|
} |
|
if (this.m_FillSymbol.Color != null) |
|
{ |
|
if (!this.m_FillSymbol.Color.NullColor) |
|
{ |
|
if (this.m_FillSymbol.Color.Transparency == 0) |
|
{ |
|
this.clrFillColor.Color = Color.Transparent; |
|
} |
|
else |
|
{ |
|
this.clrFillColor.Color = ColorTranslator.FromOle(this.m_FillSymbol.Color.RGB); |
|
} |
|
} |
|
else |
|
{ |
|
this.clrFillColor.Color = Color.Transparent; |
|
} |
|
} |
|
else |
|
{ |
|
this.clrFillColor.Color = Color.Empty; |
|
} |
|
if (this.m_FillSymbol.Outline.Color != null) |
|
{ |
|
if (!this.m_FillSymbol.Outline.Color.NullColor) |
|
{ |
|
if (this.m_FillSymbol.Outline.Color.Transparency == 0) |
|
{ |
|
this.clrOutLineColor.Color = Color.Transparent; |
|
} |
|
else |
|
{ |
|
this.clrOutLineColor.Color = Converter.FromRGBColor(this.m_FillSymbol.Outline.Color as IRgbColor); |
|
} |
|
} |
|
else |
|
{ |
|
this.clrOutLineColor.Color = Color.Transparent; |
|
} |
|
} |
|
else |
|
{ |
|
this.clrOutLineColor.Color = Color.Empty; |
|
} |
|
this.spOutLineWidth.EditValue = this.m_FillSymbol.Outline.Width; |
|
this.PreviewGalleryItem(); |
|
result = true; |
|
return result; |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
return false; |
|
} |
|
public bool Init(ref IDoStyleGalleryItem symbol) |
|
{ |
|
try |
|
{ |
|
this.m_DoStyleGalleryItem = symbol; |
|
this.m_FillSymbol = (symbol.Item.Item as IFillSymbol); |
|
bool result; |
|
if (this.m_FillSymbol == null) |
|
{ |
|
result = false; |
|
return result; |
|
} |
|
this.clrFillColor.Color = Converter.FromRGBColor(this.m_FillSymbol.Color as IRgbColor); |
|
this.clrOutLineColor.Color = Converter.FromRGBColor(this.m_FillSymbol.Outline.Color as IRgbColor); |
|
this.spOutLineWidth.EditValue = this.m_FillSymbol.Outline.Width; |
|
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_FillSymbol != null) |
|
{ |
|
IColor color = this.m_FillSymbol.Color; |
|
color = Converter.ToRGBColor(this.clrFillColor.Color); |
|
color.Transparency = this.clrFillColor.Color.A; |
|
this.m_FillSymbol.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.Width - 1, this.m_PictureEdit.Height - 1, this.m_StyleGalleryClass, this.m_Symbol); |
|
} |
|
else |
|
{ |
|
if (this.m_DoStyleGalleryItem != null) |
|
{ |
|
this.m_PictureEdit.Image = this.m_DoStyleGalleryItem.StyleGalleryClass.StyleGalleryItemToBmp(this.m_DoStyleGalleryItem, this.m_PictureEdit.Height); |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
private void clrOutLineColor_EditValueChanged(object sender, System.EventArgs e) |
|
{ |
|
try |
|
{ |
|
if (this.m_FillSymbol != null) |
|
{ |
|
ILineSymbol outline = this.m_FillSymbol.Outline; |
|
IColor color = outline.Color; |
|
color = Converter.ToRGBColor(this.clrOutLineColor.Color); |
|
color.Transparency = this.clrOutLineColor.Color.A; |
|
outline.Color = color; |
|
this.m_FillSymbol.Outline = outline; |
|
} |
|
this.PreviewGalleryItem(); |
|
if (this.SymbolEdited != null) |
|
{ |
|
this.SymbolEdited(null, null); |
|
} |
|
} |
|
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_FillSymbol != null) |
|
{ |
|
ILineSymbol outline = this.m_FillSymbol.Outline; |
|
outline.Width = Math.Abs(Convert.ToDouble(e.NewValue)); |
|
this.m_FillSymbol.Outline = outline; |
|
} |
|
this.PreviewGalleryItem(); |
|
if (this.SymbolEdited != null) |
|
{ |
|
this.SymbolEdited(null, null); |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
} |
|
}
|
|
|