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

📄 mainwebform new.aspx.cs

📁 supermap开发的基站管理系统
💻 CS
📖 第 1 页 / 共 5 页
字号:
    /// </summary>
    private DataTable CurMapLayerConfigTable
    {
        set
        {
            RemovePreDay(Global.CurMapCurLayerConfig);
            if (PageTimeHidden.Value == "")
                SetPageTime();
            if (!Global.CurMapCurLayerConfig.Contains(PageTimeHidden.Value))
            {
                Global.CurMapCurLayerConfig.Add(PageTimeHidden.Value, value);

            }
            else
                Global.CurMapCurLayerConfig[PageTimeHidden.Value] = value;
        }
        get
        {
            string pageTime = PageTimeHidden.Value;
            if (pageTime == "")
                return StaticClass.CreateLayerTable(); ;
            if (!Global.CurMapCurLayerConfig.ContainsKey(pageTime))
                return StaticClass.CreateLayerTable(); ;
            return (DataTable)Global.CurMapCurLayerConfig[pageTime];
        }
    }

    #endregion
    /// <summary>
    /// 删除前一天的记录
    /// </summary>
    /// <param name="ht"></param>
    private void RemovePreDay(Hashtable ht)
    {
        IDictionaryEnumerator enume = ht.GetEnumerator();
        ArrayList dayList = new ArrayList();

        while (enume.MoveNext())
        {
            DateTime day = Convert.ToDateTime( enume.Key);
            if (day.AddDays(1).ToShortDateString() == DateTime.Now.ToShortDateString())  //是前一天的记录
                dayList.Add(enume.Key);
        }
        foreach (object dayKey in dayList)
        {
            ht.Remove(dayKey);
        }
    }
    /// <summary>
    /// 设置该页面唯一标识
    /// </summary>
    private void SetPageTime()
    {
        PageTimeHidden.Value = DateTime.Now.ToString();
    }
    #endregion

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

    #region 页面事件
    protected void Page_Init(object sender, EventArgs e)
    {
        
    }
   
    protected void Page_Load(object sender, EventArgs e)
    {
       // this.MapControl1.MapName = "World";
        if (!Page.IsPostBack)
        {
            SetPageTime();   //设置该网页的唯一标识
            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.btnPrint.Attributes["onclick"] = "javascript:var ret=window.showModalDialog('../DataManage/BuildListColumnsXml/ExcelCaptionSelect.aspx?ModelName=ExcelCols&ModelPath=~/DataManage/BuildListColumnsXml/ExcelCols.xml',window,'dialogHeight:600px;dialogWidth:640px');if(ret==null) return false;";
        //}

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

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

        }
        
        InitMapQuery();
    }
    protected void Page_PreRender(object sender, EventArgs e)
    {

        if (!IsPostBack)
            ClearMap();
       //按照相应的比例尺显示地图
      
       //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进行台站定位
        {
           // Response.Write(Request["Guids"].ToString());
            if (!Request.Params["Guids"].Contains(str))
            {
                ClearMap();
                QueryGuids(Request.Params["Guids"]);
            }
                // Request.Params["Guids"] = null;
                this.Page.RegisterHiddenField("Guids", str);
            
            
        }
    }
    /// <summary>
    /// 传入的netGuid和要查询的类型,画链路
    /// </summary>
    /// <param name="strGuid"></param>
    /// <param name="strGuidType"></param>
    private void addStatLink(string strGuid, string strGuidType)
    {
        ArrayList llTZlist = this.CurLLMapCoordList;
        ArrayList statList = new ArrayList();//查询到的台站列表
        ArrayList centerPointList = new ArrayList();//保存计算中心点结果集
        double douLg = 0.0, douLa = 0.0;//临时保存经纬度坐标            
        int index = 0;//记录链路名称序号
        string strTemp = "";
        strTemp = strGuidType;
        string strNetGuid = "";
        string sql="";
        string strNetLinkSql="";
        if (strGuidType == "net")
        {
            sql = "select station.station_guid guid,station.stat_name stat_name,station.stat_lg stat_lg,station.stat_la stat_la,station.stat_app_type stat_app_type,station.stat_tdi stat_tdi,station.app_code app_code,station.app_org_name app_org_name,station.apply_guid apply_guid,station.stat_app_type||','||station.stat_tdi stat_type_tdi,station.net_name net_name from v_rsbt_station_apply_net station where station.net_guid='" + strGuid + "' order by station.app_code,station.stat_tdi asc";
            strNetLinkSql = "select station.guid guid ,station.app_code app_code,station.stat_lg stat_lg,station.stat_la stat_la,station.stat_name stat_name,station.stat_app_type stat_app_type,station.stat_tdi stat_tdi,org.org_name org_name from rsbt_station station,rsbt_org org,rsbt_net net where net.guid=station.net_guid and net.org_guid=org.guid and station.net_guid='" + strGuid + "'";
        }
        else if (strGuidType == "statInfo")
        {
            strNetGuid = this.getMapCoorsRange.getNetGuidByStatGuid(strGuid);
            //sql = "select guid,stat_lg,stat_la,stat_name,stat_app_type,stat_tdi from rsbt_station station where station.net_guid='" + strNetGuid + "'";
            sql = "select station.station_guid guid,station.stat_name stat_name,station.stat_lg stat_lg,station.stat_la stat_la,station.stat_app_type stat_app_type,station.stat_tdi stat_tdi,station.app_code app_code,station.app_org_name app_org_name,station.apply_guid apply_guid,station.stat_app_type||','||station.stat_tdi stat_type_tdi,station.net_name net_name from v_rsbt_station_apply_net station where station.net_guid='" + strNetGuid + "' order by station.app_code,station.stat_tdi asc";
            strNetLinkSql = "select station.guid guid ,station.app_code app_code,station.stat_lg stat_lg,station.stat_la stat_la,station.stat_name stat_name,station.stat_app_type stat_app_type,station.stat_tdi stat_tdi,org.org_name org_name from rsbt_station station,rsbt_org org,rsbt_net net where net.guid=station.net_guid and net.org_guid=org.guid and station.net_guid='" + strNetGuid + "'";
            strGuidType = "net";
        }
        statList = this.getMapCoorsRange.QueryStationList(sql, strGuidType);
        TZResult = this.getMapCoorsRange.objDs;
        DataBinderTZ();
        
        centerPointList = statList;
   
        if (statList.Count > 0)
        {
          
            InsertTZIntoMap(statList);
          
            if (strGuidType == "net" && strTemp == "")
            {
                statList = this.getMapCoorsRange.getStatLinkByNetGuid(strGuid, strGuidType);
            }
            if (strTemp == "statInfo")
            {
                statList = this.getMapCoorsRange.getStatLinkByNetGuid(strNetGuid, strGuidType);
            }

            if (statList.Count > 0)
            {
                centerPointList = this.getMapCoorsRange.getCenterMapCoord(centerPointList);
                
                for (int j = 0; j < statList.Count; j++)
                {
                    sql = "select station.station_guid guid,station.stat_name stat_name,station.stat_lg stat_lg,station.stat_la stat_la,station.stat_app_type stat_app_type,station.stat_tdi stat_tdi,station.app_code app_code,station.app_org_name app_org_name,station.apply_guid apply_guid,station.stat_app_type||','||station.stat_tdi stat_type_tdi,station.net_name net_name from v_rsbt_station_apply_net station where station.station_guid in('" + ((radio_stationLinkObj)statList[j]).LINK_STATION_GUID_A + "','" + ((radio_stationLinkObj)statList[j]).LINK_STATION_GUID_B + "')   order by station.app_code,station.stat_tdi asc";                           
                
                   ArrayList  tempList = this.getMapCoorsRange.QueryStationList(sql, strGuidType);
                    if (tempList.Count > 0)
                    {
                       MapCoord[] statLinkMapCoord = new MapCoord[2];
                        for (int k = 0; k < tempList.Count; k++)
                        {
                            statLinkMapCoord[k] = new MapCoord(double.Parse(((tranStationInfo)tempList[k]).STAT_LG), double.Parse(((tranStationInfo)tempList[k]).STAT_LA));
                        }
                        if (statLinkMapCoord.Length > 0)
                        {
                            index = MapControl1.CustomLayer.Lines.Count + 1;
                            
                            string gName = "testStatLine" + index.ToString();
                            this.MapControl1.CustomLayer.Lines.Add("line" + index.ToString(), statLinkMapCoord, "0.0001", "Red");
                            this.MapControl1.CustomLayer.Visible = true;
                            llTZlist.Add(statLinkMapCoord);
                           // index++;
                        }
                        
                    }
                }
                this.MapControl1.Update();
                this.CurLLMapCoordList = llTZlist;
            }

⌨️ 快捷键说明

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