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.Carto; using KGIS.Plugin.LayerProperty.Properties; namespace KGIS.Plugin.LayerProperty.View.UC_Controls { public partial class UCPolygonLabelPlacementSet : XtraUserControl, IPropertyPage { private bool m_PlaceOnlyInsidePolygon; private esriOverposterPolygonPlacementMethod m_PolygonPlacementMethod; private IBasicOverposterLayerProperties4 m_LayerProperties; private bool isPageDirty; public event System.EventHandler EditorChanged; public bool IsPageDirty { get { return this.isPageDirty; } set { this.isPageDirty = value; } } public UCPolygonLabelPlacementSet() { InitializeComponent(); } public void InitUC(object layerProperty) { try { this.m_LayerProperties = (layerProperty as IBasicOverposterLayerProperties4); this.chkPlaceOnlyInsidePolygon.Checked = this.m_LayerProperties.PlaceOnlyInsidePolygon; this.rgpPlacementMethod.SelectedIndex = (int)this.m_LayerProperties.PolygonPlacementMethod; this.m_PlaceOnlyInsidePolygon = this.m_LayerProperties.PlaceOnlyInsidePolygon; this.m_PolygonPlacementMethod = this.m_LayerProperties.PolygonPlacementMethod; this.isPageDirty = false; } catch (Exception ex) { //RdbUtil.AddException(ex); } } public bool CanWrite2Prop() { return true; } public void Write2Prop() { if (this.isPageDirty) { this.m_LayerProperties.PolygonPlacementMethod = this.m_PolygonPlacementMethod; this.m_LayerProperties.PlaceOnlyInsidePolygon = this.m_PlaceOnlyInsidePolygon; this.isPageDirty = false; } } public void SetDefaultValue(object value) { } private void chkPlaceOnlyInsidePolygon_CheckedChanged(object sender, System.EventArgs e) { this.m_PlaceOnlyInsidePolygon = this.chkPlaceOnlyInsidePolygon.Checked; this.InvokeEditorChanged(); } private void rgpPlacementMethod_SelectedIndexChanged(object sender, System.EventArgs e) { this.m_PolygonPlacementMethod = (esriOverposterPolygonPlacementMethod)this.rgpPlacementMethod.SelectedIndex; switch (this.m_PolygonPlacementMethod) { case esriOverposterPolygonPlacementMethod.esriAlwaysHorizontal: this.pictureEdit1.Image = Resources.esriAlwaysHorizontal; break; case esriOverposterPolygonPlacementMethod.esriAlwaysStraight: this.pictureEdit1.Image = Resources.esriAlwaysStraight; break; case esriOverposterPolygonPlacementMethod.esriMixedStrategy: this.pictureEdit1.Image = Resources.esriMixedStrategy; break; } this.InvokeEditorChanged(); } private void InvokeEditorChanged() { if (this.EditorChanged != null) { this.EditorChanged(null, null); } this.isPageDirty = true; } } }