Example #1
0
        /// <summary>
        /// 有多少个小格存在于大格中
        /// </summary>
        /// <returns></returns>
        public DataTable htgetsmallExistBig(Hashtable ht, List <clsPoi> clsPoi)
        {
            try
            {
                DataTable dt1 = new DataTable();

                dt1.Columns.Add(new DataColumn("col"));
                dt1.Columns.Add(new DataColumn("row"));
                dt1.Columns.Add(new DataColumn("voice_call_num"));
                dt1.Columns.Add(new DataColumn("data_call_num"));
                dt1.Columns.Add(new DataColumn("voice_drop_num"));
                dt1.Columns.Add(new DataColumn("data_drop_num"));
                dt1.Columns.Add(new DataColumn("DODATA_CALL_NUM"));

                foreach (clsPoi t in clsPoi)
                {
                    //遍历查找功能函数。确定有多少格子在这个大格子中(callnum;dropnum)
                    clsResult cls = new clsResult();
                    cls.LsData = new List <clsData>();
                    clsPoi clsP = t as clsPoi;
                    if (ht.ContainsKey(clsP.longitudeandlatitude))
                    {
                        clsData newcls = ht[clsP.longitudeandlatitude] as clsData;
                        if (newcls == null)
                        {
                            continue;
                        }

                        DataRow dr = dt1.NewRow();
                        dr["col"] = clsP.Column;
                        dr["row"] = clsP.Row;

                        dr["voice_call_num"]  = newcls.Voice_call_num;
                        dr["data_call_num"]   = newcls.Data_call_num;
                        dr["voice_drop_num"]  = newcls.Voice_drop_num;
                        dr["data_drop_num"]   = newcls.Data_drop_num;
                        dr["DODATA_CALL_NUM"] = newcls.DODATA_CALL_NUM;
                        dt1.Rows.Add(dr);
                    }
                }
                return(dt1);
            }
            catch (Exception ex)
            {
                clsTool.WriteLog(ex.Message + ex.StackTrace, "getsmallExistBig大格子里有多少个小格子");
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// 有多少个小格存在于大格中
        /// </summary>
        /// <returns></returns>
        public DataTable newgetsmallExistBig(DataTable dt, List <clsPoi> clsPoi,
                                             int XLength, int YLength, int city_id,
                                             DateTime date, string strTime, float minlongitude, float maxlongitude)
        {
            try
            {
                string    result = string.Empty;
                DataTable dt1    = new DataTable();

                dt1.Columns.Add(new DataColumn("col"));
                dt1.Columns.Add(new DataColumn("row"));
                dt1.Columns.Add(new DataColumn("voice_call_num"));
                dt1.Columns.Add(new DataColumn("voice_drop_num"));
                dt1.Columns.Add(new DataColumn("data_call_num"));
                dt1.Columns.Add(new DataColumn("data_drop_num"));
                dt1.Columns.Add(new DataColumn("DODATA_CALL_NUM"));

                //查找功能函数
                for (int kk = 0; kk < dt.Rows.Count; kk++)
                {
                    for (int i = 0; i < clsPoi.Count; i++)   //大格子是一个范围的值(即对角线的值结构)
                    {
                        //遍历查找功能函数。确定有多少格子在这个大格子中(callnum;dropnum)
                        clsResult cls = new clsResult();
                        cls.LsData = new List <clsData>();
                        clsPoi clsP = clsPoi[i] as clsPoi;

                        double longitude_lb = clsP.longitude_lb;     //左下角的坐标
                        double latitude_lb  = clsP.latitude_lb;      //左下角的坐标的结构对象

                        double longitude_rb     = clsP.longitude_rb; //右上角的坐标
                        double latitude_rb      = clsP.latitude_rb;  //右上角的坐标
                        string longtiuandlatiud = dt.Rows[kk]["key"].ToString();
                        if (clsP.longitudeandlatitude == dt.Rows[kk]["key"].ToString())
                        {
                            clsData clsquota = new clsData();
                            DataRow dr       = dt1.NewRow();
                            dr["col"] = clsP.Column;
                            dr["row"] = clsP.Row;
                            if (dt.Rows[kk]["voice_call_num"] != null && dt.Rows[kk]["voice_call_num"].ToString() != "")  //接入次数(1X语音业务)
                            {
                                clsquota.Voice_call_num = Convert.ToSingle(dt.Rows[kk]["voice_call_num"]);
                            }
                            else
                            {
                                clsquota.Voice_call_num = 0;
                            }
                            dr["voice_call_num"] = clsquota.Voice_call_num;
                            if (dt.Rows[kk]["voice_drop_num"] != null && dt.Rows[kk]["voice_drop_num"].ToString() != "")  //掉话次数(1X语音业务)
                            {
                                clsquota.Voice_drop_num = Convert.ToSingle(dt.Rows[kk]["Voice_drop_num"]);
                            }
                            else
                            {
                                clsquota.Voice_drop_num = 0;
                            }
                            dr["voice_drop_num"] = clsquota.Voice_drop_num;
                            if (dt.Rows[kk]["data_call_num"] != null && dt.Rows[kk]["data_call_num"].ToString() != "")   //接入次数(1X数据业务)
                            {
                                clsquota.Data_call_num = Convert.ToSingle(dt.Rows[kk]["data_call_num"]);
                            }
                            else
                            {
                                clsquota.Data_call_num = 0;
                            }
                            dr["data_call_num"] = clsquota.Data_call_num;

                            if (dt.Rows[kk]["data_drop_num"] != null && dt.Rows[kk]["data_drop_num"].ToString() != "")   //掉话次数(1X数据业务)
                            {
                                clsquota.Data_drop_num = Convert.ToSingle(dt.Rows[kk]["data_drop_num"]);
                            }
                            else
                            {
                                clsquota.Data_drop_num = 0;
                            }
                            dr["data_drop_num"] = clsquota.Data_drop_num;

                            if (dt.Rows[kk]["DODATA_CALL_NUM"] != null && dt.Rows[kk]["DODATA_CALL_NUM"].ToString() != "") //DO业务:接入次
                            {
                                clsquota.DODATA_CALL_NUM = Convert.ToSingle(dt.Rows[kk]["DODATA_CALL_NUM"]);
                            }
                            else
                            {
                                clsquota.DODATA_CALL_NUM = 0;
                            }
                            dr["DODATA_CALL_NUM"] = clsquota.DODATA_CALL_NUM;
                            dt1.Rows.Add(dr);
                        }
                    }
                }
                return(dt1);
            }
            catch (Exception ex)
            {
                clsTool.WriteLog(ex.Message + ex.StackTrace, "getsmallExistBig大格子里有多少个小格子");
                return(null);
            }
        }
Example #3
0
        //Dictionary<int, int> dic = new Dictionary<int, int>();
        /// <summary>
        /// 得到数据组构(0.01表示是1KM的间隔)(以前的换算是0.001)来进行处理的
        /// </summary>
        /// <param name="city_id"></param>
        /// <returns></returns>
        public string[,] array(int city_id, out int XResultLengTh, out int YResultLengTh)
        {
            int i            = 0;
            int longitude_lb = -1;
            int latitude_lb  = -1;

            int XLengTh = 0;
            int YLengTh = 0;

            strSQL = string.Format(@" select * from cfg_city where city_id ={0}", city_id);
            DataTable dt  = NOAP.CommonDB.DBAcess.Instance().GetDataTable(strSQL);
            clsPoi    Poi = new clsPoi();

            //113.9772	24.59921	116.6004	27.0461
            //取的城市的左上角,右下角
            for (i = 0; i < dt.Rows.Count; i++)
            {
                Poi.longitude_lb = Convert.ToSingle(dt.Rows[i]["longitude_lb"].ToString());    //经度 左上角
                Poi.latitude_lb  = Convert.ToSingle(dt.Rows[i]["latitude_lb"].ToString());     //纬度

                Poi.longitude_rb = Convert.ToSingle(dt.Rows[i]["longitude_rb"].ToString());
                Poi.latitude_rb  = Convert.ToSingle(dt.Rows[i]["latitude_rb"].ToString());
            }
            //获取大格子的值
            for (double k = Poi.longitude_lb; k < Poi.longitude_rb; k = k + 0.01f) //经度
            {
                longitude_lb = longitude_lb + 1;                                   //x轴的表示方法
            }
            for (double j = Poi.latitude_lb; j < Poi.latitude_rb; j = j + 0.01f)   //纬度
            {
                latitude_lb = latitude_lb + 1;                                     //y轴的表示方法
            }
            arrGrid = new string[longitude_lb, latitude_lb];
            XLengTh = longitude_lb;
            YLengTh = latitude_lb;

            XResultLengTh = XLengTh;
            YResultLengTh = YLengTh;

            longitude_lb = -1;
            latitude_lb  = -1;;

            #region 注释
            //获取经续度的值结构图
            for (double u = Poi.longitude_lb; u < Poi.longitude_rb; u = u + 0.01f)     //经度
            {
                longitude_lb = longitude_lb + 1;
                if (longitude_lb >= XLengTh)
                {
                    break;
                }
                for (double v = Poi.latitude_lb; v < Poi.latitude_rb; v = v + 0.01f)   //纬度
                {
                    latitude_lb = latitude_lb + 1;
                    if (latitude_lb >= YLengTh)
                    {
                        latitude_lb = -1;
                        continue;
                    }
                    clsPoi BigPoi = new clsPoi();
                    BigPoi.longitude_lb = u;
                    BigPoi.latitude_lb  = v;

                    BigPoi.longitude_rb = u + 0.01f;
                    BigPoi.latitude_rb  = v + 0.01f;

                    lstBigPoi.Add(BigPoi);    //临时获取点的X轴的坐标

                    string strResult = Convert.ToString(u) + "|" + Convert.ToString(v);
                    arrGrid[longitude_lb, latitude_lb] = strResult;
                }
            }
            #endregion
            return(arrGrid);
        }
Example #4
0
        /// <summary>
        /// 有多少个小格存在于大格中
        /// </summary>
        /// <returns></returns>
        public DataTable getsmallExistBig(DataTable dt, List <clsPoi> clsPoi,
                                          int XLength, int YLength, int city_id,
                                          DateTime date, string strTime, float minlongitude, float maxlongitude)

        {
            try
            {
                string    result = string.Empty;
                DataTable dt1    = new DataTable();
                for (int i = 0; i < clsPoi.Count; i++)   //大格子是一个范围的值(即对角线的值结构)
                {
                    //遍历查找功能函数。确定有多少格子在这个大格子中(callnum;dropnum)
                    clsResult cls = new clsResult();
                    cls.LsData = new List <clsData>();
                    clsPoi clsP = clsPoi[i] as clsPoi;
                    //if (clsP.longitude_lb <= minlongitude) continue;  //
                    double longitude_lb = clsP.longitude_lb; //左下角的坐标
                    double latitude_lb  = clsP.latitude_lb;  //左下角的坐标的结构对象

                    double longitude_rb = clsP.longitude_rb; //右上角的坐标
                    double latitude_rb  = clsP.latitude_rb;  //右上角的坐标

                    string strWhere = string.Format(@"latitude>={0} and longitude>={1} and 
                                               latitude<={2} and longitude<={3}"
                                                    , latitude_lb, longitude_lb, latitude_rb, longitude_rb);

                    DataRow[] dr = dt.Select(strWhere, "longitude asc");
                    for (int kk = 0; kk < dr.Length; kk++)
                    {
                        clsData clsquota = new clsData();
                        #region 性能指标
                        if (dr[kk]["voice_call_num"] != null && dr[kk]["voice_call_num"].ToString() != "")  //接入次数(1X语音业务)
                        {
                            clsquota.Voice_call_num = Convert.ToSingle(dr[kk]["voice_call_num"]);
                        }
                        else
                        {
                            clsquota.Voice_call_num = 0;
                        }
                        if (dr[kk]["voice_drop_num"] != null && dr[kk]["voice_drop_num"].ToString() != "")  //掉话次数(1X语音业务)
                        {
                            clsquota.Voice_drop_num = Convert.ToSingle(dr[kk]["Voice_drop_num"]);
                        }
                        else
                        {
                            clsquota.Voice_drop_num = 0;
                        }
                        if (dr[kk]["data_call_num"] != null && dr[kk]["data_call_num"].ToString() != "")   //接入次数(1X数据业务)
                        {
                            clsquota.Data_call_num = Convert.ToSingle(dr[kk]["data_call_num"]);
                        }
                        else
                        {
                            clsquota.Data_call_num = 0;
                        }

                        if (dr[kk]["data_drop_num"] != null && dr[kk]["data_drop_num"].ToString() != "")   //掉话次数(1X数据业务)
                        {
                            clsquota.Data_drop_num = Convert.ToSingle(dr[kk]["data_drop_num"]);
                        }
                        else
                        {
                            clsquota.Data_drop_num = 0;
                        }

                        if (dr[kk]["DODATA_CALL_NUM"] != null && dr[kk]["DODATA_CALL_NUM"].ToString() != "") //DO业务:接入次数DODATA_CALL_NUM
                        {
                            clsquota.DODATA_CALL_NUM = Convert.ToSingle(dr[kk]["DODATA_CALL_NUM"]);
                        }
                        else
                        {
                            clsquota.DODATA_CALL_NUM = 0;
                        }
                        #endregion
                        //clsquota.Data_drop_num = Convert.ToSingle(dr[kk]["callnum"]);
                        //clsquota.Voice_call_num = Convert.ToSingle(dr[kk]["callnum"]);
                        cls.Latitude  = dt.Rows[kk]["latitude"].ToString();
                        cls.Longitude = dt.Rows[kk]["longitude"].ToString();
                        if (dr[kk]["GRID_ID"] != null && dr[kk]["GRID_ID"].ToString() != "")
                        {
                            clsquota.XYZUOBIAO = Convert.ToString(dr[kk]["GRID_ID"]);              //确定坐标点
                        }
                        clsquota.Row    = clsP.Row;                                                //得到行号
                        clsquota.Column = clsP.Column;                                             //得到列号
                        cls.LsData.Add(clsquota);
                    }
                    arrayData.Add(cls); //得到所有大格子的数据结构
                } //得到个数据结构图
                dt1 = getZhiBiao(arrayData, city_id, date, strTime);
                return(dt1);
            }
            catch (Exception ex)
            {
                clsTool.WriteLog(ex.Message + ex.StackTrace, "getsmallExistBig大格子里有多少个小格子");
                return(null);
            }
        }
Example #5
0
        /// <summary>
        /// 得到城市的大格子
        /// </summary>
        /// <param name="city_id"></param>
        /// <param name="Initlongitude"></param>
        /// <param name="Initlatitude"></param>
        /// <param name="xLength"></param>
        /// <param name="yLength"></param>
        /// <returns></returns>
        public List <clsPoi> Bigarray(int city_id, out double Initlongitude, out double Initlatitude, out int xLength, out int yLength)
        {
            List <clsPoi> bigPoiList = new List <clsPoi>();

            Initlongitude = 0f; //经度
            Initlatitude  = 0f; //纬度
            xLength       = 0;
            yLength       = 0;

            int longitude_lb = -1;
            int latitude_lb  = -1;

            strSQL = string.Format(@" select * from cfg_city where city_id ={0}", city_id);
            DataTable dt = NOAP.CommonDB.DBAcess.Instance().GetDataTable(strSQL);

            if (dt == null || dt.Rows.Count == 0)
            {
                return(new List <clsPoi>());
            }
            clsPoi Poi = new clsPoi();

            //113.9772	24.59921	116.6004	27.0461
            //取的城市的左上角,右下角
            Poi.longitude_lb = Convert.ToSingle(dt.Rows[0]["longitude_lb"].ToString()); //经度 左上角
            Poi.latitude_lb  = Convert.ToSingle(dt.Rows[0]["latitude_lb"].ToString());  //纬度

            Poi.longitude_rb = Convert.ToSingle(dt.Rows[0]["longitude_rb"].ToString());
            Poi.latitude_rb  = Convert.ToSingle(dt.Rows[0]["latitude_rb"].ToString());

            Initlongitude = Poi.longitude_lb;
            Initlatitude  = Poi.latitude_rb;

            //获取经续度的值结构图
            double lb_longitude = Convert.ToSingle(Math.Round(Poi.longitude_lb, 2));
            double rb_latitude  = Convert.ToSingle(Math.Round(Poi.latitude_rb, 2));

            for (double u = lb_longitude; u < Poi.longitude_rb; u += 0.01f) //经度
            {
                longitude_lb = longitude_lb + 1;
                for (double v = rb_latitude; v > Poi.latitude_lb; v -= 0.01f) //纬度
                {
                    latitude_lb = latitude_lb + 1;
                    clsPoi BigPoi = new clsPoi();
                    BigPoi.longitude_lb = Convert.ToSingle(Math.Round(u, 2));
                    BigPoi.latitude_lb  = Convert.ToSingle(Math.Round(v, 2));

                    BigPoi.longitude_rb = Convert.ToSingle(Math.Round(Convert.ToDouble(u + 0.01f), 2));
                    BigPoi.latitude_rb  = Convert.ToSingle(Math.Round(Convert.ToDouble(v - 0.01f), 2));

                    BigPoi.Row    = latitude_lb;
                    BigPoi.Column = longitude_lb;

                    BigPoi.longitudeandlatitude = Convert.ToString(BigPoi.longitude_lb * 100) +
                                                  Convert.ToString(BigPoi.latitude_lb * 100);

                    bigPoiList.Add(BigPoi);
                }

                if (yLength == 0)
                {
                    yLength = latitude_lb;
                }

                latitude_lb = -1;
            }

            xLength = longitude_lb;

            return(bigPoiList);
        }