|
|
|
|
using DevExpress.XtraEditors;
|
|
|
|
|
using ESRI.ArcGIS.Carto;
|
|
|
|
|
using ESRI.ArcGIS.Geodatabase;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace KGIS.Plugin.LayerProperty.View
|
|
|
|
|
{
|
|
|
|
|
public partial class FormPointRatation : XtraForm
|
|
|
|
|
{
|
|
|
|
|
private IFeatureLayer2 m_orendlyr;
|
|
|
|
|
private IFeatureRenderer m_orender;
|
|
|
|
|
private IRotationRenderer gRotationRenderer;
|
|
|
|
|
public IRotationRenderer RotationRenderer
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.GetRotationRend(this.m_orendlyr, this.m_orender);
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.gRotationRenderer = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public FormPointRatation()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
public bool Init(IFeatureLayer2 orendlyr, IFeatureRenderer orender)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
bool result;
|
|
|
|
|
if (orendlyr == null || orender == null)
|
|
|
|
|
{
|
|
|
|
|
result = false;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
this.m_orendlyr = orendlyr;
|
|
|
|
|
this.m_orender = orender;
|
|
|
|
|
ITable table = (ITable)orendlyr;
|
|
|
|
|
IFields fields = table.Fields;
|
|
|
|
|
this.cmbFields.Properties.Items.Clear();
|
|
|
|
|
this.cmbFields.Properties.Items.Add("<none>");
|
|
|
|
|
for (int i = 0; i < fields.FieldCount; i++)
|
|
|
|
|
{
|
|
|
|
|
IField field = fields.get_Field(i);
|
|
|
|
|
string name = field.Name;
|
|
|
|
|
if (field.Type == esriFieldType.esriFieldTypeDouble || field.Type == esriFieldType.esriFieldTypeInteger || field.Type == esriFieldType.esriFieldTypeSingle || field.Type == esriFieldType.esriFieldTypeSmallInteger)
|
|
|
|
|
{
|
|
|
|
|
this.cmbFields.Properties.Items.Add(name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
IRotationRenderer rotationRenderer = (IRotationRenderer)orender;
|
|
|
|
|
this.gRotationRenderer = rotationRenderer;
|
|
|
|
|
if (rotationRenderer.RotationField == "<none>" || rotationRenderer.RotationField == "")
|
|
|
|
|
{
|
|
|
|
|
this.cmbFields.EditValue = "<none>";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.cmbFields.EditValue = rotationRenderer.RotationField;
|
|
|
|
|
}
|
|
|
|
|
if (rotationRenderer.RotationType == esriSymbolRotationType.esriRotateSymbolGeographic)
|
|
|
|
|
{
|
|
|
|
|
this.radbtnGeographic.Checked = true;
|
|
|
|
|
this.radbtnArithmetic.Checked = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (rotationRenderer.RotationType == esriSymbolRotationType.esriRotateSymbolArithmetic)
|
|
|
|
|
{
|
|
|
|
|
this.radbtnArithmetic.Checked = true;
|
|
|
|
|
this.radbtnGeographic.Checked = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result = true;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
//RdbUtil.AddException(ex);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
private void btnOk_Click(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (this.gRotationRenderer == null)
|
|
|
|
|
{
|
|
|
|
|
this.gRotationRenderer = new SimpleRendererClass();
|
|
|
|
|
}
|
|
|
|
|
this.gRotationRenderer.RotationField = this.cmbFields.Text;
|
|
|
|
|
if (this.radbtnArithmetic.Checked)
|
|
|
|
|
{
|
|
|
|
|
this.gRotationRenderer.RotationType = esriSymbolRotationType.esriRotateSymbolArithmetic;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (this.radbtnGeographic.Checked)
|
|
|
|
|
{
|
|
|
|
|
this.gRotationRenderer.RotationType = esriSymbolRotationType.esriRotateSymbolGeographic;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
base.DialogResult = DialogResult.OK;
|
|
|
|
|
base.Close();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
//RdbUtil.AddException(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void btnCancel_Click(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.DialogResult = DialogResult.Cancel;
|
|
|
|
|
base.Close();
|
|
|
|
|
}
|
|
|
|
|
private IRotationRenderer GetRotationRend(IFeatureLayer2 orendlyr, IFeatureRenderer orender)
|
|
|
|
|
{
|
|
|
|
|
IRotationRenderer result;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (orendlyr == null || orender == null)
|
|
|
|
|
{
|
|
|
|
|
result = null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
IRotationRenderer rotationRenderer = (IRotationRenderer)orender;
|
|
|
|
|
if (this.cmbFields.Text == "<none>")
|
|
|
|
|
{
|
|
|
|
|
rotationRenderer.RotationField = "";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rotationRenderer.RotationField = this.cmbFields.Text;
|
|
|
|
|
}
|
|
|
|
|
if (this.radbtnArithmetic.Checked)
|
|
|
|
|
{
|
|
|
|
|
rotationRenderer.RotationType = esriSymbolRotationType.esriRotateSymbolArithmetic;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (this.radbtnGeographic.Checked)
|
|
|
|
|
{
|
|
|
|
|
rotationRenderer.RotationType = esriSymbolRotationType.esriRotateSymbolGeographic;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result = rotationRenderer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
//RdbUtil.AddException(ex);
|
|
|
|
|
result = null;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|