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.
142 lines
4.3 KiB
142 lines
4.3 KiB
6 months ago
|
using System;
|
||
|
using System.ComponentModel;
|
||
|
using System.Drawing;
|
||
|
using System.Windows.Forms;
|
||
|
using DevExpress.XtraEditors;
|
||
|
using DevExpress.XtraEditors.Controls;
|
||
|
using ESRI.ArcGIS.Carto;
|
||
|
using KGIS.Plugin.LayerProperty.Utils;
|
||
|
|
||
|
namespace KGIS.Plugin.LayerProperty.View.UC_Controls
|
||
|
{
|
||
|
public class FormImportRasterRender : XtraForm
|
||
|
{
|
||
|
private IContainer components;
|
||
|
private ButtonEdit btnOpenLayer;
|
||
|
private SimpleButton btnOK;
|
||
|
private SimpleButton btnCancel;
|
||
|
private LabelControl labelControl1;
|
||
|
private IRasterLayer CurrentLayer;
|
||
|
private IRasterRenderer rasterRenderer;
|
||
|
public IRasterRenderer RasterRenderer
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return this.rasterRenderer;
|
||
|
}
|
||
|
set
|
||
|
{
|
||
|
this.rasterRenderer = value;
|
||
|
}
|
||
|
}
|
||
|
protected override void Dispose(bool disposing)
|
||
|
{
|
||
|
if (disposing && this.components != null)
|
||
|
{
|
||
|
this.components.Dispose();
|
||
|
}
|
||
|
base.Dispose(disposing);
|
||
|
}
|
||
|
private void InitializeComponent()
|
||
|
{
|
||
|
this.btnOpenLayer = new ButtonEdit();
|
||
|
this.btnOK = new SimpleButton();
|
||
|
this.btnCancel = new SimpleButton();
|
||
|
this.labelControl1 = new LabelControl();
|
||
|
((ISupportInitialize)this.btnOpenLayer.Properties).BeginInit();
|
||
|
base.SuspendLayout();
|
||
|
this.btnOpenLayer.Location = new Point(54, 12);
|
||
|
this.btnOpenLayer.Name = "btnOpenLayer";
|
||
|
this.btnOpenLayer.Properties.Buttons.AddRange(new EditorButton[]
|
||
|
{
|
||
|
new EditorButton()
|
||
|
});
|
||
|
this.btnOpenLayer.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
|
||
|
this.btnOpenLayer.Size = new Size(271, 21);
|
||
|
this.btnOpenLayer.TabIndex = 0;
|
||
|
this.btnOpenLayer.ButtonClick += new ButtonPressedEventHandler(this.btnOpenLayer_ButtonClick);
|
||
|
this.btnOK.Location = new Point(83, 54);
|
||
|
this.btnOK.Name = "btnOK";
|
||
|
this.btnOK.Size = new Size(75, 23);
|
||
|
this.btnOK.TabIndex = 1;
|
||
|
this.btnOK.Text = "确定";
|
||
|
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
|
||
|
this.btnCancel.Location = new Point(173, 55);
|
||
|
this.btnCancel.Name = "btnCancel";
|
||
|
this.btnCancel.Size = new Size(75, 23);
|
||
|
this.btnCancel.TabIndex = 1;
|
||
|
this.btnCancel.Text = "取消";
|
||
|
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||
|
this.labelControl1.Location = new Point(12, 12);
|
||
|
this.labelControl1.Name = "labelControl1";
|
||
|
this.labelControl1.Size = new Size(36, 14);
|
||
|
this.labelControl1.TabIndex = 2;
|
||
|
this.labelControl1.Text = "图层:";
|
||
|
base.AutoScaleDimensions = new SizeF(6f, 12f);
|
||
|
base.AutoScaleMode = AutoScaleMode.Font;
|
||
|
base.ClientSize = new Size(335, 100);
|
||
|
base.Controls.Add(this.labelControl1);
|
||
|
base.Controls.Add(this.btnCancel);
|
||
|
base.Controls.Add(this.btnOK);
|
||
|
base.Controls.Add(this.btnOpenLayer);
|
||
|
base.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||
|
base.MaximizeBox = false;
|
||
|
base.MinimizeBox = false;
|
||
|
base.Name = "FormImportRasterRender";
|
||
|
base.ShowIcon = false;
|
||
|
base.ShowInTaskbar = false;
|
||
|
base.StartPosition = FormStartPosition.CenterScreen;
|
||
|
this.Text = "导入符号化";
|
||
|
((ISupportInitialize)this.btnOpenLayer.Properties).EndInit();
|
||
|
base.ResumeLayout(false);
|
||
|
base.PerformLayout();
|
||
|
}
|
||
|
public FormImportRasterRender()
|
||
|
{
|
||
|
this.InitializeComponent();
|
||
|
}
|
||
|
public void InitForm(IRasterLayer rasterLayer)
|
||
|
{
|
||
|
this.CurrentLayer = rasterLayer;
|
||
|
}
|
||
|
private void btnOpenLayer_ButtonClick(object sender, ButtonPressedEventArgs e)
|
||
|
{
|
||
|
ILayerFile layerFile = RenderUtil.OpenLayerFile();
|
||
|
if (layerFile != null && layerFile.Layer != null)
|
||
|
{
|
||
|
if (layerFile.Layer is IFeatureLayer)
|
||
|
{
|
||
|
XtraMessageBox.Show("图层类型不一致!", "确认提示");
|
||
|
return;
|
||
|
}
|
||
|
IRasterLayer rasterLayer = layerFile.Layer as IRasterLayer;
|
||
|
if (!rasterLayer.Renderer.GetType().Equals(this.CurrentLayer.Renderer.GetType()))
|
||
|
{
|
||
|
XtraMessageBox.Show("图层的渲染类型不一致!", "确认提示");
|
||
|
return;
|
||
|
}
|
||
|
ILayer arg_6B_0 = layerFile.Layer;
|
||
|
this.rasterRenderer = rasterLayer.Renderer;
|
||
|
this.btnOpenLayer.Text = layerFile.Layer.Name;
|
||
|
}
|
||
|
}
|
||
|
private void btnOK_Click(object sender, System.EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
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();
|
||
|
}
|
||
|
}
|
||
|
}
|