⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainwebform.aspx.cs

📁 supermap开发的基站管理系统
💻 CS
📖 第 1 页 / 共 5 页
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Drawing;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

using SuperMap.IS.Utility;
using SuperMap.IS.Web;
using SuperMap.IS.WebControls;
using SuperMap.IS.ServiceInterface;
public partial class MainWebForm : System.Web.UI.Page
{
    #region 属性

    public int QueryCount;
    public double CurMapScale;

   
    GetMapCoordsRange getMapCoorsRange = new GetMapCoordsRange();
    /// <summary>
    /// 记录是第几次访问
    /// </summary>
    private int PostBackCount
    {
        set
        {
            Session["PostBackCount"] = value;
        }
        get
        {
            if (Session["PostBackCount"] == null)
                return 0;
            return (int)Session["PostBackCount"];
        }
    }
    /// <summary>
    /// 当前台站查询结果
    /// </summary>
    private DataSet TZResult
    {
        set
        {
            Session["TZResult"] = value;
        }
        get
        {
            if (Session["TZResult"] == null)
                return null;
            return (DataSet)Session["TZResult"];
        }
    }
    /// <summary>
    /// 当前画在地图上的台站集合
    /// </summary>
    private ArrayList CurTZList
    {
        set
        {
            Session["CurTZList"] = value;
        }
        get
        {
            if (Session["CurTZList"] == null)
                return null;
            return (ArrayList)Session["CurTZList"];
        }
    }
    /// <summary>
    /// 记录当前地图上画链路的台站集合(主要用在地图打印)

    /// </summary>
    private ArrayList CurLLMapCoordList
    {
        set
        {
            Session["CurLLMapCoordList"] = value;
        }
        get
        {
            if (Session["CurLLMapCoordList"] == null)
                return new ArrayList();
            return (ArrayList)Session["CurLLMapCoordList"];
        }
    }
    /// <summary>
    /// 记录当前地图方位角信息(包括方位角的两个台站和之间的关系)(主要用在地图打印)

    /// </summary>
    private ArrayList CurFWJList
    {
        set
        {
            Session["CurFWJList"] = value;
        }
        get
        {
            if (Session["CurFWJList"] == null)
                return new ArrayList();
            return (ArrayList)Session["CurFWJList"];
        }
    }
    /// <summary>
    /// 把当前地图按照一定比例进行放大

    /// </summary>
    private float  CurScale
    {
        set
        {
            Session["CurScale"] = value;
        }
        get
        {
            if (Session["CurScale"] == null)
                return 0;
            return (float)Session["CurScale"];
        }
    }
    /// <summary>
    /// 地图 当前显示的矩形

    /// </summary>
    private MapRect MapCurRect
    {
        set
        {
            Session["MapCurRect"] = value;
        }
        get
        {
            if (Session["MapCurRect"] == null)
                return null;
            return (MapRect)Session["MapCurRect"];
        }
    }
    /// <summary>
    /// 地图查询的类型

    /// </summary>
    private string QueryMapType
    {
        set
        {
            Session["QueryMapType"] = value;
        }
    }
    /// <summary>
    /// 地图查询的两点坐标

    /// </summary>
    private MapCoord[] MapQueryMapCoords
    {
        set
        {
            Session["MapQueryMapCoords"] = value;
        }
    }
    #endregion

    //-----------------------------------------------------------------------------------------------------------------------------------

    #region 页面事件
    protected void Page_Init(object sender, EventArgs e)
    {
        if (Request["width"] != null && Request["height"] != null)
        {
            ResetMapControlSize(Convert.ToInt16(Request["width"]), Convert.ToInt16(Request["height"]));

        }
    }
   
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
            this.PostBackCount = 0;
        //HttpCookie userinfoold = Request.Cookies["userinfo"];
        //if (userinfoold == null || userinfoold.Values["userid"].ToString() == "")
        //{
        //    string err = "";
        //    err = "用户cookie数据丢失";
        //    Response.Redirect("~/others/RightsIntroduce.aspx?Err=" + err);
        //    return;
        //}
        //else
        //{
        //    Global_LoginInfo.strUserAreaCode = userinfoold.Values["areacode"];
        //    Global_LoginInfo.strUserName = HttpUtility.UrlDecode(userinfoold.Values["username"], System.Text.Encoding.UTF8);
        //    this.getMapCoorsRange.strAreaCode = Global_LoginInfo.strUserAreaCode;
        //}

        this.getMapCoorsRange.strAreaCode = "1300";
        DataBinderTZ();
        PostBackCount++;
        InitLayerConfig();
        SelectRowDBClick();

        if (this.PostBackCount >= 2)
        {
            PLTZDingWei();

        }
        InitMapQuery();
    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
           MapControlCallBack();
           //this.MapControl1.ViewEntire();
           //this.MapControl1.Update();
       }

       //按照相应的比例尺显示地图
       if (CurMapScale != 0.0)
       {
           MapControl1.ViewScale = CurMapScale;
           MapControl1.Update();
           CurMapScale = 0.0;
       }
       //if (PostBackCount == 2)
       //{
       //     //this.MapControl1.ViewEntire();
       //     //this.MapControl1.Update();
       //     MapCoord[] coords = new MapCoord[2];
       //     coords[0] = MapControl1.CenterPoint;
            
       //     coords[1] = new MapCoord(MapControl1.CenterPoint.X + 0.001, MapControl1.CenterPoint.Y + 0.001);
       //     this.MapControl1.CustomLayer.Lines.Add("dd" + this.MapControl1.CustomLayer.Lines.Count, coords);
       //     MapControl1.CustomLayer.Visible = true;
       //     MapControl1.Update();
       //     Response.Write(coords[0].X.ToString() + "+" + coords[0].Y.ToString());
       // }

        InitPageClient();
        //  if (!IsPostBack)
        //    InitLayerConfig(); 

        InitMap2();
        ShowQueryResultInWindow();
    }
    /// <summary>
    /// 把地图信息写到前台页面

    /// </summary>
    private void InitPageClient()
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.Append("<script language=javascript>");
        sb.Append("var mapLeft = " + this.MapControl1.ViewBounds.LeftBottom.X + ";");
        sb.Append("var mapRight = " + this.MapControl1.ViewBounds.RightTop.X + ";");
        sb.Append("var mapTop = " + this.MapControl1.ViewBounds.RightTop.Y + ";");
        sb.Append("var mapBottom = " + this.MapControl1.ViewBounds.LeftBottom.Y + ";");
        sb.Append("var mapWidth = " + this.MapControl1.Width.Value + ";");
        sb.Append("var mapHeight = " + this.MapControl1.Height.Value + ";");
        sb.Append("var borderWidth = " + this.MapControl1.BorderWidth.Value + ";");
        sb.Append("var mapScaleReciprocal = " + (int)(1 / this.MapControl1.ViewScale) + ";");
        //sb.Append("document.all.MapControl1.onmousemove = \"ShowCursorPos()\";");
        sb.Append("</script>");
        Page.RegisterStartupScript("viriables", sb.ToString());
    }
    public int TZResultCount = 0;
    private void DataBinderTZ()
    {
        DataSet ds = TZResult;
        if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count >0)
        {
            GridView3.DataSource = ds.Tables[0];
            this.DataBind();
            IBtnDW.Visible = true;
            checkboxAll.Enabled = true;
            TZResultCount = ds.Tables[0].Rows.Count;
        }
        else
        {
            IBtnDW.Visible = false;
            GridView3.DataSource = null;
            this.DataBind();
            checkboxAll.Enabled = false;
            TZResultCount = 0;
        }
    }
    /// <summary>
    /// 地图控件放大的回调函数

    /// </summary>
    private void MapControlCallBack()
    {
        if (!IsPostBack)
        {
            StringBuilder sbJS = new StringBuilder("<script type='text/javascript'>");
            sbJS.Append("function postBackScreenSize(){");
            sbJS.Append("SMISCreateHiddenField(MapControl1,'width','width',screen.width);");
            sbJS.Append("SMISCreateHiddenField(MapControl1,'height','height',screen.height);");
            sbJS.Append("MapControl1_DoPostBack();}");
            sbJS.Append("window.onload=postBackScreenSize;");
            sbJS.Append("</script>");
            Page.RegisterStartupScript("pageSize", sbJS.ToString());
        }
    }
    private void ResetMapControlSize(int width, int height)
    {
        MapControlWidth = width - 80;
        MapControlHeight = height - 305;

        this.MapControl1.Width = MapControlWidth;
        this.MapControl1.Height = MapControlHeight;
      
    }
    #endregion 

    #region 频率台定位

    /// <summary>
    /// 频率台站定位
    /// </summary>
    private void PLTZDingWei()
    {
        string str = "msmzlh";
        if (Request["StatLg"] != null && Request["StatLa"] != null && Convert.ToString(Request["StatLg"]) != "" && Convert.ToString(Request["StatLa"]) != "")   //经纬度定位

        {
            if (!Request.Params["StatLg"].Contains(str) && !Request.Params["StatLa"].Contains(str))
            {
                ClearMap();
                double x = Convert.ToDouble(Request["StatLg"]);
                double y = Convert.ToDouble(Request["StatLa"]);
                string tzName = "";
                string tzFactory = "";
                Common.FunctionIO fo = new Common.FunctionIO();
                string strLg_d = "", strLg_m = "", strLg_s = "", strLa_d = "", strLa_m = "", strLa_s = "";
                //把度转换程度分秒  开始 -------------------------------------------------
                fo.DToString(fo.Func_ConvertToDecimal(x.ToString()) * 3600, ref strLg_d, ref strLg_m, ref strLg_s, 1);
                fo.DToString(fo.Func_ConvertToDecimal(y.ToString()) * 3600, ref strLa_d, ref strLa_m, ref strLa_s, 1);
                string strLg = strLg_d + "°" + strLg_m + "′" + strLg_s + "″";
                string strLa = strLa_d + "°" + strLa_m + "′" + strLa_s + "″";

                string returnStr = string.Format("<div><img id='img' src='images/hotballold.gif'  onmouseout=CloseTZProperty(); onmousemove =ShowTZProperty(this,'{0}','{1}','{2}','{3}'); /></div>", tzName, tzFactory, strLg, strLa);
                MapControl1.CustomLayer.Marks.Add("tz", x, y, returnStr);
                MapControl1.CustomLayer.Visible = true;
                MapControl1.CenterPoint = new MapCoord(x, y);
                this.CurMapScale = 0.00002;
                MapControl1.Update();
            }
                this.Page.RegisterHiddenField("StatLg", str);
                this.Page.RegisterHiddenField("StatLa", str);
            
        }
        else if (Request["netguid"] != null && Request["strGuidType"] != null && Convert.ToString(Request["netguid"]) != "" && Convert.ToString(Request["strGuidType"]) != "")//传入的netGuid和要查询的类型,画链路

        {
            if (!Request.Params["netguid"].Contains(str) && !Request.Params["strGuidType"].Contains(str))
            {
                ClearMap();
                addStatLink(Request["netguid"], Request["strGuidType"]);
            }
                this.Page.RegisterHiddenField("strGuidType", str);
                this.Page.RegisterHiddenField("netguid", str);
            
        }
        //多个台站的Guid,参数格式            
        else if (Request["Guids"] != null )//通过台站Guid进行台站定位

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -