|
|
|
|
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.Geometry;
|
|
|
|
|
|
|
|
|
|
namespace KGIS.Plugin.LayerProperty.View.UC_Controls
|
|
|
|
|
{
|
|
|
|
|
public partial class UCExtentSet : UserControl
|
|
|
|
|
{
|
|
|
|
|
private double left;
|
|
|
|
|
private double bottom;
|
|
|
|
|
private double right;
|
|
|
|
|
private double top;
|
|
|
|
|
public new double Left
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.left;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.left = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public new double Bottom
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.bottom;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.bottom = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public new double Right
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.right;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.right = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public new double Top
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.top;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.top = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public UCExtentSet()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
public void SetEnvelope(IEnvelope envelope, bool readOnly)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
this.txtBottom.Text = "";
|
|
|
|
|
this.txtLeft.Text = "";
|
|
|
|
|
this.txtRight.Text = "";
|
|
|
|
|
this.txtTop.Text = "";
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
this.txtBottom.Properties.ReadOnly = readOnly;
|
|
|
|
|
this.txtLeft.Properties.ReadOnly = readOnly;
|
|
|
|
|
this.txtRight.Properties.ReadOnly = readOnly;
|
|
|
|
|
this.txtTop.Properties.ReadOnly = readOnly;
|
|
|
|
|
if (envelope != null)
|
|
|
|
|
{
|
|
|
|
|
this.txtBottom.Text = envelope.YMin.ToString();
|
|
|
|
|
this.txtLeft.Text = envelope.XMin.ToString();
|
|
|
|
|
this.txtRight.Text = envelope.XMax.ToString();
|
|
|
|
|
this.txtTop.Text = envelope.YMax.ToString();
|
|
|
|
|
ISpatialReference spatialReference = envelope.SpatialReference;
|
|
|
|
|
this.SetUnit(spatialReference);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void SetUnit(ISpatialReference spatialReference)
|
|
|
|
|
{
|
|
|
|
|
if (spatialReference is IGeographicCoordinateSystem)
|
|
|
|
|
{
|
|
|
|
|
IGeographicCoordinateSystem geographicCoordinateSystem = spatialReference as IGeographicCoordinateSystem;
|
|
|
|
|
IAngularUnit coordinateUnit = geographicCoordinateSystem.CoordinateUnit;
|
|
|
|
|
string text = (coordinateUnit != null) ? coordinateUnit.Name : "未知";
|
|
|
|
|
this.lblUnit1.Text = text;
|
|
|
|
|
this.lblUnit2.Text = text;
|
|
|
|
|
this.lblUnit3.Text = text;
|
|
|
|
|
this.lblUnit4.Text = text;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (spatialReference is IProjectedCoordinateSystem)
|
|
|
|
|
{
|
|
|
|
|
IProjectedCoordinateSystem projectedCoordinateSystem = spatialReference as IProjectedCoordinateSystem;
|
|
|
|
|
ILinearUnit coordinateUnit2 = projectedCoordinateSystem.CoordinateUnit;
|
|
|
|
|
string text2 = (coordinateUnit2 != null) ? coordinateUnit2.Name : "未知";
|
|
|
|
|
this.lblUnit1.Text = text2;
|
|
|
|
|
this.lblUnit2.Text = text2;
|
|
|
|
|
this.lblUnit3.Text = text2;
|
|
|
|
|
this.lblUnit4.Text = text2;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string text3 = "未知";
|
|
|
|
|
this.lblUnit1.Text = text3;
|
|
|
|
|
this.lblUnit2.Text = text3;
|
|
|
|
|
this.lblUnit3.Text = text3;
|
|
|
|
|
this.lblUnit4.Text = text3;
|
|
|
|
|
}
|
|
|
|
|
private void txtTop_EditValueChanged(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.top = Convert.ToDouble(this.txtTop.Text);
|
|
|
|
|
}
|
|
|
|
|
private void txtRight_EditValueChanged(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.right = Convert.ToDouble(this.txtRight.Text);
|
|
|
|
|
}
|
|
|
|
|
private void txtLeft_EditValueChanged(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.left = Convert.ToDouble(this.txtLeft.Text);
|
|
|
|
|
}
|
|
|
|
|
private void txtBottom_EditValueChanged(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.bottom = Convert.ToDouble(this.txtBottom.Text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|