📄 mainwebform.aspx.cs
字号:
MapCurRect = MapControl1.ViewBounds;
}
protected void MapControl1_ViewBoundsChanged(object sender, SuperMap.IS.WebControls.EventArguments.ViewBoundsChangedEventArgs e)
{
CurMapScale =1/MapControl1.ViewScale;
labelScale.Text =Math.Round(CurMapScale,1).ToString ();
// InitMap2();
MapCurRect = MapControl1.ViewBounds;
}
protected void LayerControl1_PreRender(object sender, EventArgs e)
{
// LayerControl1.DisplayFilter = new SuperMap.IS.WebControls.Utility.LayerFilter();
}
#endregion
#region dialog
/// <summary>
/// 显示距离量算、面积量算的结果(弹出对话框),以及结果为空时弹出对话框以提示用户。
/// </summary>
/// <param name="result"></param>
private void DisplayResult(string result)
{
string script = string.Empty;
string displayResult = string.Empty;
if (string.IsNullOrEmpty(result))
{
displayResult = "没有匹配的结果!";
}
else
{
displayResult = "结果为: " + result.Replace("\"", "\\\"");
}
ShowDialog(displayResult);
// this.ShowAlertDialog("DisplayResult", displayResult);
}
/// <summary>
/// 在浏览器端显示弹出对话框。
/// </summary>
/// <returns></returns>
private bool ShowAlertDialog(string key, string msg)
{
System.Diagnostics.Debug.Assert(key != null && key.Length > 0);
System.Diagnostics.Debug.Assert(msg != null && msg.Length > 0);
if (Page.IsStartupScriptRegistered(key))
{
return false;
}
// 由于SmartNav的影响, 这里借助了客户端的一个隐藏字段, 否则会每次都弹出结果对话框.
Page.RegisterHiddenField(key, msg);
string script;
script = "<script language='javascript'>";
script += "window.onload=function(){ var msg = document.getElementById('" + key + "').value; if(msg != \"\") alert(msg)} </script>";
Page.RegisterStartupScript(key, script);
return true;
}
#endregion
#region GridView选择定位
private ArrayList m_selectTZ = new ArrayList();
/// <summary>
/// 得到已经选择的台站
/// </summary>
private void GetSelectTZ()
{
int index = 0;
DataSet ds = TZResult;
// MapControl1.CustomLayer.Clear();
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
return;
foreach (GridViewRow gvr in GridView3.Rows)
{
CheckBox select = (CheckBox)gvr.FindControl("checkBoxSelect");
if (select.Checked)
{
tranStationInfo stationInfo=new tranStationInfo ();
stationInfo.STAT_GUID = ds.Tables[0].Rows[gvr.RowIndex]["guid"].ToString();
stationInfo.STAT_NAME = ds.Tables[0].Rows[gvr.RowIndex]["stat_name"].ToString();
stationInfo.STAT_TDI = ds.Tables[0].Rows[gvr.RowIndex]["stat_tdi"].ToString();
stationInfo.STAT_APP_TYPE = ds.Tables[0].Rows[gvr.RowIndex]["stat_app_type"].ToString();
stationInfo.STAT_LA = ds.Tables[0].Rows[gvr.RowIndex]["stat_la"].ToString();
stationInfo.STAT_LG = ds.Tables[0].Rows[gvr.RowIndex]["stat_lg"].ToString();
stationInfo.STAT_ORG_NAME = ds.Tables[0].Rows[gvr.RowIndex]["app_org_name"].ToString();
m_selectTZ.Add(stationInfo);
}
// index++;
}
}
/// <summary>
/// 选择台站定位
/// </summary>
private void SelectTZDingWei()
{
if (m_selectTZ == null || m_selectTZ.Count == 0)
{
this.ShowDialog("请选择台站!");
return;
}
InsertTZIntoMap(m_selectTZ);
}
/// <summary>
/// gridView中每行的双击事件
/// </summary>
private void SelectRowDBClick()
{
if (Request["tzindex"] != null)
{
DataSet ds = TZResult;
int index = Convert.ToInt16(Request["tzindex"]);
if (ds.Tables[0].Rows.Count < index)
return;
tranStationInfo stationInfo = new tranStationInfo();
stationInfo.STAT_GUID = ds.Tables[0].Rows[index ]["guid"].ToString();
stationInfo.STAT_NAME = ds.Tables[0].Rows[index]["stat_name"].ToString();
stationInfo.STAT_TDI = ds.Tables[0].Rows[index]["stat_tdi"].ToString();
stationInfo.STAT_APP_TYPE = ds.Tables[0].Rows[index]["stat_app_type"].ToString();
stationInfo.STAT_LA = ds.Tables[0].Rows[index]["stat_la"].ToString();
stationInfo.STAT_LG = ds.Tables[0].Rows[index]["stat_lg"].ToString();
stationInfo.STAT_ORG_NAME = ds.Tables[0].Rows[index]["app_org_name"].ToString();
ArrayList tzList = new ArrayList();
tzList.Add(stationInfo);
if (tzList == null || tzList.Count == 0)
{
ShowDialog("没有满足条件的数据!");
return;
}
InsertTZIntoMap(tzList);
this.Page.RegisterHiddenField("tzIndex", "");
// this.ShowDialog(Request["tzindex"].ToString());
}
}
/// <summary>
/// 根据gridview中的选择项进行定位
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void IBtnDW_Click(object sender, ImageClickEventArgs e)
{
ClearMap();
GetSelectTZ();
if (m_selectTZ == null || m_selectTZ.Count == 0)
{
ShowDialog("没有满足条件的数据!");
return;
}
InsertTZIntoMap(m_selectTZ);
// GetCoord(m_selectTZ);
}
protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Attributes.Add("onmouseover", " currentcolor=this.style.backgroundColor;this.style.backgroundColor='#ACBCDE';");
//当鼠标离开的时候 将背景颜色还原的以前的颜色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor;");
DataSet ds = TZResult;
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
return;
if (e.Row.RowIndex >= 0)
{
if (Convert.ToString(ds.Tables[0].Rows[e.Row.RowIndex]["stat_lg"]) == "" || Convert.ToString(ds.Tables[0].Rows[e.Row.RowIndex]["stat_la"]) == "")
{
CheckBox checkbox = (CheckBox)e.Row.FindControl("checkBoxSelect");
checkbox.Enabled = false;
}
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count < e.Row.RowIndex)
return;
string zlclick = ConfigurationManager.AppSettings["SpecailStationUrl"];
string sqClick = ConfigurationManager.AppSettings["ZLStationUrl"];
StringBuilder zlString = new StringBuilder();
StringBuilder sqString = new StringBuilder();
sqString.AppendFormat("{0}?APP_GUID={1}&NET_NAME={2}&APP_CODE={3}&APP_TYPE=T", sqClick, ds.Tables[0].Rows[e.Row.RowIndex]["APPLY_GUID"], HttpUtility.UrlEncode(ds.Tables[0].Rows[e.Row.RowIndex]["net_name"].ToString(), System.Text.Encoding.UTF8), ds.Tables[0].Rows[e.Row.RowIndex]["app_code"]);
zlString.AppendFormat("{0}{1},{2},{3},{4}", zlclick, ds.Tables[0].Rows[e.Row.RowIndex]["guid"], ds.Tables[0].Rows[e.Row.RowIndex]["stat_name"], ds.Tables[0].Rows[e.Row.RowIndex]["stat_app_type"], ds.Tables[0].Rows[e.Row.RowIndex]["stat_tdi"]);
//((LinkButton)e.Row.Cells[0].FindControl("btnCode")).Attributes.Add("onclick", string.Format("window.open('{0}')", sqString));
//((LinkButton)e.Row.Cells[0].FindControl("btnGuid")).Attributes.Add("onclick", string.Format("window.open('{0}')", zlString));
e.Row.Cells[1].Attributes.Add("onclick", string.Format("window.open('{0}')", sqString));
e.Row.Cells[2].Attributes.Add("onclick", string.Format("window.open('{0}')", zlString));
//else
//{
// e.Row.Attributes.Add("ondblclick", "SMISCreateHiddenField(MapControl1, \"tzindex\", \"tzindex\",'" + e.Row.RowIndex.ToString() + "');MapControl1_DoPostBack(); ");
//}
}
}
/// <summary>
/// 全选
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void checkboxAll_CheckedChanged(object sender, EventArgs e)
{
if (GridView3.Rows.Count <= 0)
return;
foreach (GridViewRow row in GridView3.Rows)
{
CheckBox check = (CheckBox)row.Cells[0].FindControl("checkBoxSelect");
if (check != null)
check.Checked = checkboxAll.Checked;
}
}
protected void GridView3_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
DataSet ds = TZResult;
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
return;
int index = e.RowIndex;
if (ds.Tables[0].Rows.Count < index)
return;
ClearMap();
tranStationInfo stationInfo = new tranStationInfo();
stationInfo.STAT_GUID = ds.Tables[0].Rows[index]["guid"].ToString();
stationInfo.STAT_NAME = ds.Tables[0].Rows[index]["stat_name"].ToString();
stationInfo.STAT_TDI = ds.Tables[0].Rows[index]["stat_tdi"].ToString();
stationInfo.STAT_APP_TYPE = ds.Tables[0].Rows[index]["stat_app_type"].ToString();
stationInfo.STAT_LA = ds.Tables[0].Rows[index]["stat_la"].ToString();
stationInfo.STAT_LG = ds.Tables[0].Rows[index]["stat_lg"].ToString();
stationInfo.STAT_ORG_NAME = ds.Tables[0].Rows[index]["app_org_name"].ToString();
ArrayList tzList = new ArrayList();
tzList.Add(stationInfo);
if (tzList == null || tzList.Count == 0)
{
ShowDialog("没有选择数据!");
return;
}
InsertTZIntoMap(tzList);
// this.Page.RegisterHiddenField("tzIndex", "");
// e.Row.Attributes.Add("ondblclick", "SMISCreateHiddenField(MapControl1, \"tzindex\", \"tzindex\",'" + e.Row.RowIndex.ToString() + "');MapControl1_DoPostBack(); ");
}
#endregion
#region 类型查询
protected void btnTypeQuery_Click(object sender, ImageClickEventArgs e)
{
string type = GetSelectType();
PointF cenPoint = GetXY();
if (type == "" && (cenPoint.X == 0.0 || RADIUS.Value == ""))
{
// ClientScript.RegisterClientScriptBlock(this.GetType(), "dialog", "<script>alert('请选择类型或者输入查询坐标!');</script>");
ShowDialog( "请选择类型或者输入查询坐标!");
return;
}
double distance = 0;
if (RADIUS.Value != "")
{
try
{
distance = Convert.ToDouble(RADIUS.Value);
}
catch { }
}
MapControl1.CustomLayer.Clear();
ArrayList tzList = this.getMapCoorsRange.GetStatInfoByType(type, distance, Convert.ToDouble(cenPoint.X), Convert.ToDouble(cenPoint.Y));
TZResult = this.getMapCoorsRange.objDs;
DataBinderTZ();
if (tzList.Count == 0)
{
this.ShowDialog("没有满足条件的数据!");
}
else
{
InsertTZIntoMap(tzList);
// GetCoord(tzList);
}
}
/// <summary>
/// 得到中心点坐标
/// </summary>
/// <returns></returns>
private PointF GetXY()
{
PointF point = new PointF(0, 0);
if (STAT_LG_1.Value == "" || STAT_LA_1.Value =="")
{
return point ;
}
try
{
point.X += Convert.ToSingle(STAT_LG_1.Value);
point.Y += Convert.ToSingle(STAT_LA_1.Value);
if (STAT_LG_2.Value != "")
{
point.X += Convert.ToSingle(STAT_LG_2.Value) / 60;
}
if (STAT_LA_2.Value != "")
{
point.Y += Convert.ToSingle(STAT_LA_2.Value) / 60;
}
if (STAT_LG_3.Value != "")
{
point.X += Convert.ToSingle(STAT_LG_3.Value) / 3600;
}
if (STAT_LA_3.Value != "")
{
point.Y += Convert.ToSingle(STAT_LA_3.Value) / 3600;
}
}
catch
{
//ClientScript.RegisterClientScriptBlock(this.GetType(), "dialog", "alert('输入的值不正确!')");
ShowDialog("输入的值不正确!");
point = new Point(0, 0);
}
return point;
}
/// <summary>
/// 得到选择类型
/// </summary>
/// <returns></returns>
private string GetSelectType()
{
string type = "";
bool isFirst = true;
if (CheckBox1.Checked) // 地球站-E
{
isFirst = false;
type = "E";
}
if (CheckBox2.Checked) // 广播电台-B
{
if (!isFirst)
type += ",";
isFirst = false;
type += "B";
}
if (CheckBox3.Checked) // 雷达站-R
{
if (!isFirst)
type += ",";
isFirst = false;
type += "R";
}
if (CheckBox4.Checked) // 蜂窝基站-C
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -