年度变更建库软件5.0版本
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.
 
 

184 lines
7.1 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 KGIS.Plugin.LayerProperty.Interface;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geodatabase;
using KGIS.Plugin.LayerProperty.Properties;
namespace KGIS.Plugin.LayerProperty.View.UC_Controls
{
public partial class UCPointLabelPlacementSet : XtraUserControl, IPropertyPage
{
private IBasicOverposterLayerProperties4 m_LayerProperties;
private Array Angles;
private esriLabelRotationType m_LabelRotationType;
private bool m_PerpendicularToAngle;
private string m_RotationField;
private IFields fields;
private bool isPageDirty;
public event System.EventHandler EditorChanged;
public IFields Fields
{
get
{
return this.fields;
}
set
{
this.fields = value;
}
}
public bool IsPageDirty
{
get
{
return this.isPageDirty;
}
set
{
this.isPageDirty = value;
}
}
public UCPointLabelPlacementSet()
{
InitializeComponent();
}
public void InitUC(object layerProperty)
{
try
{
this.m_LayerProperties = (layerProperty as IBasicOverposterLayerProperties4);
this.m_LabelRotationType = this.m_LayerProperties.RotationType;
this.m_PerpendicularToAngle = this.m_LayerProperties.PerpendicularToAngle;
this.m_RotationField = this.m_LayerProperties.RotationField;
switch (this.m_LayerProperties.PointPlacementMethod)
{
case esriOverposterPointPlacementMethod.esriAroundPoint:
this.chkAroundPoint.Checked = true;
break;
case esriOverposterPointPlacementMethod.esriOnTopPoint:
this.chkOnTop.Checked = true;
break;
case esriOverposterPointPlacementMethod.esriSpecifiedAngles:
this.chkSpecifiedAngles.Checked = true;
this.Angles = (this.m_LayerProperties.PointPlacementAngles as Array);
break;
case esriOverposterPointPlacementMethod.esriRotationField:
this.chkSpecifiedField.Checked = true;
break;
}
this.btnAngles.Enabled = this.chkSpecifiedAngles.Checked;
this.btnRotationField.Enabled = this.chkSpecifiedField.Checked;
this.pictureEdit1.Image = Resources.TopRightAllAllowed;
this.isPageDirty = false;
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
public bool CanWrite2Prop()
{
return true;
}
public void Write2Prop()
{
if (this.isPageDirty)
{
if (this.chkAroundPoint.Checked)
{
this.m_LayerProperties.PointPlacementMethod = esriOverposterPointPlacementMethod.esriAroundPoint;
}
else
{
if (this.chkOnTop.Checked)
{
this.m_LayerProperties.PointPlacementMethod = esriOverposterPointPlacementMethod.esriOnTopPoint;
}
else
{
if (this.chkSpecifiedAngles.Checked)
{
this.m_LayerProperties.PointPlacementMethod = esriOverposterPointPlacementMethod.esriSpecifiedAngles;
this.m_LayerProperties.PointPlacementAngles = this.Angles;
}
else
{
if (this.chkSpecifiedField.Checked)
{
this.m_LayerProperties.PointPlacementMethod = esriOverposterPointPlacementMethod.esriRotationField;
this.m_LayerProperties.RotationType = this.m_LabelRotationType;
this.m_LayerProperties.PerpendicularToAngle = this.m_PerpendicularToAngle;
this.m_LayerProperties.RotationField = this.m_RotationField;
}
}
}
}
this.isPageDirty = false;
}
}
public void SetDefaultValue(object value)
{
}
private void InvokeEditorChanged()
{
if (this.EditorChanged != null)
{
this.EditorChanged(null, null);
}
this.isPageDirty = true;
}
private void chkSpecifiedAngles_CheckedChanged(object sender, System.EventArgs e)
{
this.btnAngles.Enabled = this.chkSpecifiedAngles.Checked;
this.InvokeEditorChanged();
}
private void chkSpecifiedField_CheckedChanged(object sender, System.EventArgs e)
{
this.btnRotationField.Enabled = this.chkSpecifiedField.Checked;
this.InvokeEditorChanged();
}
private void chkOnTop_CheckedChanged(object sender, System.EventArgs e)
{
this.InvokeEditorChanged();
}
private void btnRotationField_Click(object sender, System.EventArgs e)
{
FormPointLabelRatation formPointLabelRatation = new FormPointLabelRatation();
formPointLabelRatation.Init(this.fields, this.m_LayerProperties.RotationField, this.m_LayerProperties.PerpendicularToAngle, this.m_LayerProperties.RotationType);
if (formPointLabelRatation.ShowDialog(base.FindForm()) == DialogResult.OK)
{
this.m_LabelRotationType = formPointLabelRatation.LabelRotationType;
this.m_PerpendicularToAngle = formPointLabelRatation.PerpendicularToAngle;
this.m_RotationField = formPointLabelRatation.RotationField;
this.InvokeEditorChanged();
}
}
private void btnAngles_Click(object sender, System.EventArgs e)
{
try
{
this.Angles = (this.m_LayerProperties.PointPlacementAngles as Array);
FormPointPlacementAngles formPointPlacementAngles = new FormPointPlacementAngles();
formPointPlacementAngles.Init(this.Angles);
if (formPointPlacementAngles.ShowDialog(base.FindForm()) == DialogResult.OK)
{
this.Angles = formPointPlacementAngles.Angles;
this.InvokeEditorChanged();
}
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
}
}