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

114 lines
4.3 KiB

using ESRI.ArcGIS.Carto;
using KGIS.Framework.Utils.Helper;
using KGIS.Plugin.LayerProperty.Utils;
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 FormImportFeatureSymbology : Form
{
private IFeatureLayer CurrentLayer;
private IFeatureRenderer featureRenderer;
public IFeatureRenderer FeatureRenderer
{
get
{
return this.featureRenderer;
}
set
{
this.featureRenderer = value;
}
}
public FormImportFeatureSymbology()
{
InitializeComponent();
}
public void Init(IMap map, IFeatureLayer currentLyr)
{
this.CurrentLayer = currentLyr;
if (map != null)
{
for (int i = 0; i < map.LayerCount; i++)
{
ILayer layer = map.get_Layer(i);
if (currentLyr != null && layer is IFeatureLayer2 && (currentLyr as IFeatureLayer2).ShapeType == (layer as IFeatureLayer2).ShapeType)
{
ItemInfo<ILayer, string> item = new ItemInfo<ILayer, string>(layer, layer.Name);
this.cmbSelectLayer.Properties.Items.Add(item);
}
}
this.cmbSelectLayer.SelectedIndex = 0;
}
}
private void btnOpenLayer_Click(object sender, System.EventArgs e)
{
ILayerFile layerFile = RenderUtil.OpenLayerFile();
if (layerFile != null && layerFile.Layer != null)
{
if (!(layerFile.Layer is IFeatureLayer))
{
MessageHelper.ShowTips("图层类型不一致!");
return;
}
IFeatureLayer2 featureLayer = layerFile.Layer as IFeatureLayer2;
if (featureLayer.ShapeType != (this.CurrentLayer as IFeatureLayer2).ShapeType)
{
MessageHelper.ShowTips("要素几何类型不一致!");
return;
}
IGeoFeatureLayer geoFeatureLayer = layerFile.Layer as IGeoFeatureLayer;
this.featureRenderer = geoFeatureLayer.Renderer;
this.cmbSelectLayer.Text = layerFile.Layer.Name;
}
}
private void btnOK_Click(object sender, System.EventArgs e)
{
try
{
if (!(this.featureRenderer is ISimpleRenderer))
{
if (this.featureRenderer is IUniqueValueRenderer)
{
IUniqueValueRenderer uniqueValueRenderer = this.featureRenderer as IUniqueValueRenderer;
FormUniqueRendererFieldMatch formUniqueRendererFieldMatch = new FormUniqueRendererFieldMatch();
formUniqueRendererFieldMatch.InitForm(this.CurrentLayer, uniqueValueRenderer);
if (formUniqueRendererFieldMatch.ShowDialog(this) == DialogResult.OK)
{
for (int i = 0; i < uniqueValueRenderer.FieldCount; i++)
{
uniqueValueRenderer.set_Field(i, formUniqueRendererFieldMatch.ValueFields.GetValue(i).ToString());
}
}
}
else
{
if (!(this.featureRenderer is IClassBreaksRenderer) && !(this.featureRenderer is IProportionalSymbolRenderer))
{
IChartRenderer arg_96_0 = this.featureRenderer as IChartRenderer;
}
}
}
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();
}
}
}