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.
282 lines
9.9 KiB
282 lines
9.9 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 ESRI.ArcGIS.Carto; |
|
using KGIS.Plugin.LayerProperty.Properties; |
|
using DevExpress.XtraEditors; |
|
using KGIS.Plugin.LayerProperty.Interface; |
|
|
|
namespace KGIS.Plugin.LayerProperty.View.UC_Controls |
|
{ |
|
public partial class UCPolylineLabelPlacementSet : XtraUserControl, IPropertyPage |
|
{ |
|
private IBasicOverposterLayerProperties4 m_LayerProperties; |
|
private bool isPageDirty; |
|
public event System.EventHandler EditorChanged; |
|
public bool IsPageDirty |
|
{ |
|
get |
|
{ |
|
return this.isPageDirty; |
|
} |
|
set |
|
{ |
|
this.isPageDirty = value; |
|
} |
|
} |
|
public UCPolylineLabelPlacementSet() |
|
{ |
|
InitializeComponent(); |
|
} |
|
public void InitUC(object layerProperty) |
|
{ |
|
try |
|
{ |
|
this.m_LayerProperties = (layerProperty as IBasicOverposterLayerProperties4); |
|
this.groupControl2.Enabled = true; |
|
ILineLabelPosition lineLabelPosition = this.m_LayerProperties.LineLabelPosition; |
|
if (lineLabelPosition.Horizontal) |
|
{ |
|
this.rdgOrientationSet.SelectedIndex = 0; |
|
this.groupControl2.Enabled = false; |
|
} |
|
else |
|
{ |
|
if (lineLabelPosition.Parallel) |
|
{ |
|
this.rdgOrientationSet.SelectedIndex = 1; |
|
} |
|
else |
|
{ |
|
if (lineLabelPosition.ProduceCurvedLabels) |
|
{ |
|
this.rdgOrientationSet.SelectedIndex = 2; |
|
} |
|
else |
|
{ |
|
if (lineLabelPosition.Perpendicular) |
|
{ |
|
this.rdgOrientationSet.SelectedIndex = 3; |
|
} |
|
} |
|
} |
|
} |
|
if (lineLabelPosition.Above || lineLabelPosition.Below) |
|
{ |
|
this.cmbOrientationSys.SelectedIndex = 1; |
|
this.pictureEdit1.Image = Resources.LineLabelPage; |
|
this.chkAbove.Checked = lineLabelPosition.Above; |
|
this.chkBelow.Checked = lineLabelPosition.Below; |
|
} |
|
else |
|
{ |
|
if (lineLabelPosition.Left || lineLabelPosition.Right) |
|
{ |
|
this.cmbOrientationSys.SelectedIndex = 0; |
|
this.pictureEdit1.Image = Resources.LineLabelLine; |
|
this.chkAbove.Checked = lineLabelPosition.Left; |
|
this.chkBelow.Checked = lineLabelPosition.Right; |
|
} |
|
else |
|
{ |
|
this.cmbOrientationSys.SelectedIndex = 1; |
|
this.pictureEdit1.Image = Resources.LineLabelPage; |
|
} |
|
} |
|
this.chkInLine.Checked = lineLabelPosition.OnTop; |
|
this.spOffSet.EditValue = lineLabelPosition.Offset; |
|
if (lineLabelPosition.AtStart) |
|
{ |
|
this.cmbLocation.SelectedIndex = 1; |
|
} |
|
else |
|
{ |
|
if (lineLabelPosition.AtEnd) |
|
{ |
|
this.cmbLocation.SelectedIndex = 2; |
|
} |
|
else |
|
{ |
|
if (lineLabelPosition.InLine) |
|
{ |
|
this.cmbLocation.SelectedIndex = 0; |
|
} |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
public bool CanWrite2Prop() |
|
{ |
|
return true; |
|
} |
|
public void Write2Prop() |
|
{ |
|
this.GetOrientationSet(); |
|
this.GetPositionSet(); |
|
this.GetLocatoinSet(); |
|
this.isPageDirty = false; |
|
} |
|
public void SetDefaultValue(object value) |
|
{ |
|
} |
|
private void cmbOrientationSys_SelectedIndexChanged(object sender, System.EventArgs e) |
|
{ |
|
if (this.cmbOrientationSys.SelectedIndex == 0) |
|
{ |
|
this.pictureEdit1.Image = Resources.LineLabelLine; |
|
this.chkAbove.Text = "在线的左边"; |
|
this.chkBelow.Text = "在线的右边"; |
|
return; |
|
} |
|
this.pictureEdit1.Image = Resources.LineLabelPage; |
|
this.chkAbove.Text = "在线的上边"; |
|
this.chkBelow.Text = "在线的下边"; |
|
} |
|
private void cmbLocation_SelectedIndexChanged(object sender, System.EventArgs e) |
|
{ |
|
if (this.cmbLocation.SelectedIndex == 0) |
|
{ |
|
this.btnPropertiesSet.Enabled = false; |
|
return; |
|
} |
|
this.btnPropertiesSet.Enabled = true; |
|
} |
|
private void btnProiriSet_Click(object sender, System.EventArgs e) |
|
{ |
|
} |
|
private void rdgOrientationSet_SelectedIndexChanged(object sender, System.EventArgs e) |
|
{ |
|
try |
|
{ |
|
this.groupControl2.Enabled = true; |
|
this.cmbLocation.Enabled = true; |
|
if (this.rdgOrientationSet.SelectedIndex == 0) |
|
{ |
|
this.groupControl2.Enabled = false; |
|
} |
|
else |
|
{ |
|
if (this.rdgOrientationSet.SelectedIndex == 2) |
|
{ |
|
this.cmbLocation.Enabled = false; |
|
} |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
private void GetOrientationSet() |
|
{ |
|
try |
|
{ |
|
ILineLabelPosition lineLabelPosition = this.m_LayerProperties.LineLabelPosition; |
|
lineLabelPosition.Horizontal = false; |
|
lineLabelPosition.Parallel = false; |
|
lineLabelPosition.ProduceCurvedLabels = false; |
|
lineLabelPosition.Perpendicular = false; |
|
if (this.rdgOrientationSet.SelectedIndex == 0) |
|
{ |
|
lineLabelPosition.Horizontal = true; |
|
} |
|
else |
|
{ |
|
if (this.rdgOrientationSet.SelectedIndex == 1) |
|
{ |
|
lineLabelPosition.Parallel = true; |
|
} |
|
else |
|
{ |
|
if (this.rdgOrientationSet.SelectedIndex == 2) |
|
{ |
|
lineLabelPosition.ProduceCurvedLabels = true; |
|
} |
|
else |
|
{ |
|
if (this.rdgOrientationSet.SelectedIndex == 3) |
|
{ |
|
lineLabelPosition.Perpendicular = true; |
|
} |
|
} |
|
} |
|
} |
|
this.m_LayerProperties.LineLabelPosition = lineLabelPosition; |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
private void GetPositionSet() |
|
{ |
|
try |
|
{ |
|
ILineLabelPosition lineLabelPosition = this.m_LayerProperties.LineLabelPosition; |
|
lineLabelPosition.Above = false; |
|
lineLabelPosition.Below = false; |
|
lineLabelPosition.OnTop = true; |
|
lineLabelPosition.Left = false; |
|
lineLabelPosition.Right = false; |
|
if (this.cmbOrientationSys.SelectedIndex == 1) |
|
{ |
|
lineLabelPosition.Below = this.chkBelow.Checked; |
|
lineLabelPosition.Above = this.chkAbove.Checked; |
|
lineLabelPosition.OnTop = this.chkInLine.Checked; |
|
} |
|
else |
|
{ |
|
lineLabelPosition.Left = this.chkAbove.Checked; |
|
lineLabelPosition.Right = this.chkBelow.Checked; |
|
lineLabelPosition.OnTop = this.chkInLine.Checked; |
|
} |
|
lineLabelPosition.Offset = Convert.ToDouble(this.spOffSet.EditValue); |
|
this.m_LayerProperties.LineLabelPosition = lineLabelPosition; |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
private void GetLocatoinSet() |
|
{ |
|
try |
|
{ |
|
ILineLabelPosition lineLabelPosition = this.m_LayerProperties.LineLabelPosition; |
|
lineLabelPosition.AtStart = false; |
|
lineLabelPosition.AtEnd = false; |
|
lineLabelPosition.InLine = false; |
|
if (this.cmbLocation.SelectedIndex == 1) |
|
{ |
|
lineLabelPosition.AtStart = true; |
|
} |
|
else |
|
{ |
|
if (this.cmbLocation.SelectedIndex == 2) |
|
{ |
|
lineLabelPosition.AtEnd = true; |
|
} |
|
else |
|
{ |
|
lineLabelPosition.InLine = true; |
|
} |
|
} |
|
this.m_LayerProperties.LineLabelPosition = lineLabelPosition; |
|
} |
|
catch (Exception ex) |
|
{ |
|
//RdbUtil.AddException(ex); |
|
} |
|
} |
|
} |
|
}
|
|
|