Example #1
0
        /// <summary>
        /// 更新用于系数校正射线生成及校正的经纬度范围
        /// </summary>
        /// <returns></returns>
        public Result updateCalibrationRange()
        {
            try
            {
                //更新数据库中待生成轨迹所选区域范围,经纬度
                Hashtable paramHt = new Hashtable();
                double    maxLon  = Double.Parse(this.MaxLongitude.ToString());
                double    maxLat  = Double.Parse(this.MaxLatitude.ToString());
                double    minLon  = Double.Parse(this.MinLongitude.ToString());
                double    minLat  = Double.Parse(this.MinLatitude.ToString());
                paramHt["MaxLon"] = maxLon;
                paramHt["MaxLat"] = maxLat;
                paramHt["MinLon"] = minLon;
                paramHt["MinLat"] = minLat;

                Point pMin = new Point(minLon, minLat, 0);
                pMin = PointConvertByProj.Instance.GetProjectPoint(pMin);
                Point pMax = new Point(maxLon, maxLat, 0);
                pMax            = PointConvertByProj.Instance.GetProjectPoint(pMax);
                paramHt["MinX"] = Math.Round(pMin.X, 3);
                paramHt["MinY"] = Math.Round(pMin.Y, 3);
                paramHt["MaxX"] = Math.Round(pMax.X, 3);
                paramHt["MaxY"] = Math.Round(pMax.Y, 3);

                IbatisHelper.ExecuteDelete("DeleteRayAdjRange", null);
                IbatisHelper.ExecuteInsert("insertRayAdjRange", paramHt);

                return(new Result(true, "系数校正区域范围更新成功!"));
            }
            catch (Exception e)
            {
                return(new Result(false, "系数矫正区域范围更新失败!" + e));
            }
        }
        public static Result RefreshCell()
        {
            //LTE.GIS.OperateCellLayer cellLayer = new LTE.GIS.OperateCellLayer();
            //if (!cellLayer.RefreshCellLayer())
            //    return new Result(false, "小区数据为空");
            //return new Result(true);
            try
            {
                GisClient.Result res = GisClient.ServiceApi.getGisLayerService().RefreshCell();
                if (res.Ok)
                {
                    Hashtable ht = new Hashtable();
                    //TODO:最好以地区名最为索引标志,可以通过项目创建时数据库中的地区名称来获得
                    ht["IndexName"] = "南京";
                    ht["ShpName"]   = res.ShpName;
                    ht["Type"]      = "Cell";
                    ht["DateTime"]  = DateTime.Now;
                    IbatisHelper.ExecuteInsert("insShp", ht);

                    return(new Result(true, "小区图层刷新成功"));
                }
                else
                {
                    return(new Result(false, "小区图层刷新失败"));
                }
            }
            catch (Exception e)
            {
                return(new Result(false, "远程调用失败" + e));
            }
            finally
            {
                ServiceApi.CloseConn();
            }
        }
Example #3
0
        //获取[参数]范围内的地面栅格中心点
        public static int constructGGridsByArea(double minGx, double maxGx, double minGy, double maxGy)
        {
            //Console.WriteLine("{0}", 1);
            if (ggrids != null)
            {
                ggrids.Clear();
            }
            ggrids = new Dictionary <string, Point>();

            Hashtable ht = new Hashtable();

            ht["minGXID"] = minGx;
            ht["maxGXID"] = maxGx;
            ht["minGYID"] = minGy;
            ht["maxGYID"] = maxGy;
            //Console.WriteLine("{0}", MinGxid);

            DataTable grids = IbatisHelper.ExecuteQueryForDataTable("getGroundGridsCenterByArea", ht);
            //Console.WriteLine("{0}", grids.Rows.Count);
            double x, y, z;
            int    gxid, gyid;
            string key;

            for (int i = 0, cnt = grids.Rows.Count; i < cnt; i++)
            {
                gxid = Convert.ToInt32(grids.Rows[i]["GXID"]);
                gyid = Convert.ToInt32(grids.Rows[i]["GYID"]);
                x    = Convert.ToDouble(grids.Rows[i]["CX"]);
                y    = Convert.ToDouble(grids.Rows[i]["CY"]);
                z    = Convert.ToDouble(grids.Rows[i]["Dem"]);
                key  = string.Format("{0},{1}", gxid, gyid);
                ggrids.Add(key, new Point(x, y, z));
            }
            return(ggrids.Count);
        }
Example #4
0
        /// <summary>
        /// 判断初始化工作是否完成,完成后才可进行系数校正射线生成等工作
        /// </summary>
        /// <returns></returns>
        public static bool checkInitFinished()
        {
            DataTable resultTb     = IbatisHelper.ExecuteQueryForDataTable("getInitZeroStateCnt", null);
            double    zeroStateCnt = double.Parse(resultTb.Rows[0][0].ToString());

            return(zeroStateCnt == 0);
        }
        public static void constructGridTin()
        {
            //清除前一部分区域的数据,防止内存溢出 2019.7.22 xsx
            gridTIN.Clear();

            // 2019.5.28 地形
            Hashtable ht = new Hashtable();

            ht["minGXID"] = minGXID;
            ht["maxGXID"] = maxGXID;
            ht["minGYID"] = minGYID;
            ht["maxGYID"] = maxGYID;

            DataTable dt2 = IbatisHelper.ExecuteQueryForDataTable("GetAccelerateStructTIN", ht);

            List <int> TINid;                        //哈希表中每一个key值(栅格)对应的TIN id 列表

            for (int i = 0; i < dt2.Rows.Count; i++) //按行遍历DataTable
            {
                string key = dt2.Rows[i]["GXID"].ToString() + "," + dt2.Rows[i]["GYID"].ToString() + "," + dt2.Rows[i]["GZID"].ToString();

                if (!gridTIN.ContainsKey(key))
                {//若key不存在,创建新的键值对
                    TINid = new List <int>();
                    TINid.Add(Convert.ToInt32(dt2.Rows[i]["TINID"]));
                    gridTIN.Add(key, TINid);
                }
                else
                {//若key存在,更新键值对
                    gridTIN[key].Add(Convert.ToInt32(dt2.Rows[i]["TINID"]));
                }
            }
        }
Example #6
0
        public Result getShpByAreaLonLat([FromBody] areaShpLayer ob)
        {
            Result    res = new Result();
            Hashtable ht  = new Hashtable();

            ht["minLongitude"] = ob.minLongitude;
            ht["maxLongitude"] = ob.maxLongitude;
            ht["minLatitude"]  = ob.minLatitude;
            ht["maxLatitude"]  = ob.maxLatitude;
            ht["type"]         = ob.type;
            object shpobj = IbatisHelper.ExecuteQueryForDataTable("getAreaShpByLonLat", ht);

            if (shpobj != null)
            {
                res.ok   = true;
                res.obj  = shpobj;
                res.code = "1";
            }
            else
            {
                res.ok   = false;
                res.msg  = "资源不存在,请联系管理员";
                res.code = "3";
            }
            return(res);
        }
        // 2019.6.5 为计算建筑物海拔做准备
        public static void constructBuildingCenter()
        {
            Hashtable ht = new Hashtable();

            ht["minGXID"] = minGXID;
            ht["maxGXID"] = maxGXID;
            ht["minGYID"] = minGYID;
            ht["maxGYID"] = maxGYID;

            DataTable dt = IbatisHelper.ExecuteQueryForDataTable("GetBuildingCenterPre", ht);

            int    bid;
            double x, y, z;

            for (int i = 0; i < dt.Rows.Count; i++)//按行遍历DataTable
            {
                bid = Convert.ToInt32(dt.Rows[i]["BuildingID"]);
                if (bid > maxID)
                {
                    maxID = bid;
                }
                if (bid < minID)
                {
                    minID = bid;
                }
                x = Convert.ToDouble(dt.Rows[i]["BCenterX"]);
                y = Convert.ToDouble(dt.Rows[i]["BCenterY"]);
                z = Convert.ToDouble(dt.Rows[i]["BHeight"]);
                buildingCenter.Add(bid, new Point(x, y, z));
            }
        }
        public Result PostFixTerminalLayer()
        {
            try
            {
                GisClient.Result res = GisClient.ServiceApi.getGisLayerService().refreshFixTerminalLayer();
                if (res.Ok)
                {
                    Hashtable ht = new Hashtable();
                    ht["IndexName"] = "固定终端";
                    ht["ShpName"]   = res.ShpName;
                    ht["Type"]      = "fix";
                    ht["DateTime"]  = DateTime.Now;
                    IbatisHelper.ExecuteInsert("insShp", ht);

                    return(new Result(true, "固定终端图层刷新成功"));
                }
                else
                {
                    return(new Result(false, "固定终端图层刷新失败"));
                }
            }
            catch (Exception e)
            {
                return(new Result(false, "远程调用失败" + e));
            }
            finally
            {
                ServiceApi.CloseConn();
            }
        }
        public static void constructGrid3D()
        {
            Hashtable para = new Hashtable();

            para["minGXID"] = minGXID;
            para["maxGXID"] = maxGXID;
            para["minGYID"] = minGYID;
            para["maxGYID"] = maxGYID;
            DataTable dt = IbatisHelper.ExecuteQueryForDataTable("GetBuildingGrid3D", para);

            for (int i = 0; i < dt.Rows.Count; i++)//按行遍历DataTable
            {
                int buildingid = Convert.ToInt32(dt.Rows[i][0].ToString());
                //gxid,gyid,gzid
                string value = dt.Rows[i][1].ToString() + "," + dt.Rows[i][2].ToString() + "," + dt.Rows[i][3].ToString();
                if (bgrid3d.ContainsKey(buildingid))
                {
                    bgrid3d[buildingid].Add(value);
                }
                else
                {
                    List <string> list = new List <string>();
                    list.Add(value);
                    bgrid3d.Add(buildingid, list);
                }
            }
        }
        public Result UpdateSelectPoints()
        {
            Hashtable ht = new Hashtable();

            ht["fromName"] = this.virname;
            DataTable spinfo = IbatisHelper.ExecuteQueryForDataTable("GetSelectedPoint", ht);

            Point endavg = new Point(this.inflon, this.inflat, 0);

            PointConvertByProj.Instance.GetProjectPoint(endavg);

            if (spinfo.Rows.Count < 1)
            {
                return(new Result(false, "无初始选点数据"));
            }
            for (int i = 0; i < spinfo.Rows.Count; i++)
            {
                int    ci      = Convert.ToInt32(spinfo.Rows[i]["CI"].ToString());
                double x       = Convert.ToDouble(spinfo.Rows[i]["x"].ToString());
                double y       = Convert.ToDouble(spinfo.Rows[i]["y"].ToString());
                Point  start   = new Point(x, y, 0);
                double Azimuth = LTE.Geometric.GeometricUtilities.getPolarCoord(start, endavg).theta / Math.PI * 180;
                Azimuth = GeometricUtilities.ConvertGeometricArithmeticAngle(Azimuth + 1);
                Hashtable htupdate = new Hashtable();
                htupdate["fromName"] = this.virname;
                htupdate["CI"]       = ci;
                htupdate["Azimuth"]  = Azimuth;
                IbatisHelper.ExecuteUpdate("UpdatetbSelectedPointByCI", htupdate);
            }
            return(new Result(true, "更新成功"));
        }
Example #11
0
        public double dbmPt(double EIRP, double mjDir, double mjTilt, out double HLoss, out double VLoss)
        {
            //dbmPt = EiRP- HLoss(Dir,θ) - VLoss(Tilt, Φ)
            Hashtable paramTable = new Hashtable();

            paramTable["gainType"]  = "KRE738819_902";
            paramTable["direction"] = 0; // 0对应HLoss
            paramTable["degree"]    = (int)mjDir % 360;
            HLoss = Convert.ToDouble(IbatisHelper.ExecuteQueryForDataTable("getLoss", paramTable).Rows[0]["Loss"]);

            paramTable["direction"] = 1; // 1对应VLoss.
            paramTable["degree"]    = (int)mjTilt % 360;
            VLoss = Convert.ToDouble(IbatisHelper.ExecuteQueryForDataTable("getLoss", paramTable).Rows[0]["Loss"]);

            //旧版代码,从内存读取
            //AbstrGain abstrGain = GainFactory.GetabstractGain("KRE738819_902");
            //double[] HAGain = abstrGain.GetHAGain();
            //double[] VAGain = abstrGain.GetVAGain();
            ////double HLoss = HAGain[(int)Math.Round(mjDir)];
            ////double VLoss = VAGain[(int)Math.Round(mjTilt)];
            //HLoss = HAGain[(int)mjDir % 360];
            //VLoss = VAGain[(int)mjTilt % 360];

            //double dbmPt = EIRP - HAGain[(int)Math.Round(mjDir)] - VAGain[(int)Math.Round(mjTilt)] - 2;
            double dbmPt = EIRP - HLoss - VLoss - 2;

            return(dbmPt);
        }
        // 2019.7.20 xsx 建筑物栅格还未划分时,根据范围和中心点得到建筑物中心点
        public static void constructBuildingCenterByArea(double minGx, double maxGx, double minGy, double maxGy)
        {
            //清除前一部分区域的数据,防止内存溢出 2019.7.22 xsx
            buildingCenter.Clear();

            Hashtable ht = new Hashtable();

            ht["minGX"] = minGx;
            ht["maxGX"] = maxGx;
            ht["minGY"] = minGy;
            ht["maxGY"] = maxGy;

            DataTable dt = IbatisHelper.ExecuteQueryForDataTable("GetBuildingCenterByArea", ht);

            int    bid;
            double x, y, z;

            for (int i = 0; i < dt.Rows.Count; i++)//按行遍历DataTable
            {
                bid = Convert.ToInt32(dt.Rows[i]["BuildingID"]);
                if (bid > maxID)
                {
                    maxID = bid;
                }
                if (bid < minID)
                {
                    minID = bid;
                }
                x = Convert.ToDouble(dt.Rows[i]["BCenterX"]);
                y = Convert.ToDouble(dt.Rows[i]["BCenterY"]);
                z = Convert.ToDouble(dt.Rows[i]["BHeight"]);
                buildingCenter.Add(bid, new Point(x, y, z));
            }
            //return dt;
        }
Example #13
0
        public Result LocateByPath()
        {
            PathAnalysis pa  = new PathAnalysis(virname);
            ResultRecord ans = pa.StartAnalysis(ratioAP, ratioP, ratioAPW);

            Hashtable ht = new Hashtable();

            ht["Version"] = this.virname;
            ht["k"]       = this.k;
            DataTable dt = IbatisHelper.ExecuteQueryForDataTable("queryLocResult", ht);

            dt = JWDCompute(dt);
            if (!ans.GetIsLocated())
            {
                return(new Result(false, ans.GetMsg()));
            }
            else
            {
                string msg = string.Format("定位结果坐标:{0}\n干扰源坐标:{1}\n定位精度:{2}米", ans.GetResLocation(), ans.GetReaLocation(), ans.GetPrecise());
                //return new Result(true, msg, ans);
                return(new Result(true, msg, dt));
            }

            //return new Result(true, "ok", dt);
        }
        /// <summary>
        /// 用于更新用于定位的两个路测表
        /// </summary>
        /// <returns></returns>
        public Result UpdateDTDataForLoc()
        {
            IbatisHelper.ExecuteDelete("deleteNousetbDTInf", null);   //去除无效路测数据
            IbatisHelper.ExecuteDelete("deleteNousetbDTNoInf", null); //去除无效路测数据

            //获取tbDTData数据,对每一行数据,计算得到需要的内容,然后
            DataTable dtInfo = IbatisHelper.ExecuteQueryForDataTable("SelectTbDTInf", null);

            if (!GetTotalintoTmp(dtInfo))
            {
                return(new Result(false, "更新失败,请查看日志"));
            }
            int count = IbatisHelper.ExecuteUpdate("UpdatetbDTInfByTmp", null); //更新的行数

            IbatisHelper.ExecuteUpdate("UpdatetbDTInfByCell", null);            //根据eNodeID和CI更新btsname,cellname
            Debug.WriteLine("tbDTInf一共更新:" + count + "条数据");

            dtInfo.Clear();
            dtInfo = IbatisHelper.ExecuteQueryForDataTable("SelectTbDTNoInf", null);
            if (!GetTotalintoTmp(dtInfo))
            {
                return(new Result(false, "更新失败,请查看日志"));
            }
            count = IbatisHelper.ExecuteUpdate("UpdatetbDTNoInfByTmp", null); //更新的行数
            IbatisHelper.ExecuteUpdate("UpdatetbDTNoInfByCell", null);        //根据eNodeID和CI更新btsname,cellname
            Debug.WriteLine("tbDTNoInf一共更新:" + count + "条数据");
            return(new Result(true, "更新成功"));
        }
        private bool TestDis(DataTable dtinfo, ref double minD, ref double maxD, ref double avgD, ref double areax, ref double areay)
        {
            if (dtinfo == null || dtinfo.Rows.Count < 1)
            {
                Debug.WriteLine("传入参数不正确");
                return(false);
            }
            Hashtable ht = new Hashtable();

            ht["BtsName"] = this.virname;
            DataTable tbcell = IbatisHelper.ExecuteQueryForDataTable("GettbSource", ht);

            if (tbcell == null || tbcell.Rows.Count < 1 || tbcell.Rows[0]["x"] == DBNull.Value || tbcell.Rows[0]["y"] == DBNull.Value)
            {
                Debug.WriteLine("未找到对应的小区地理信息");
                return(false);
            }
            double endx = Convert.ToDouble(tbcell.Rows[0]["x"]);
            double endy = Convert.ToDouble(tbcell.Rows[0]["y"]);
            double sum = 0;
            double minx = double.MaxValue, miny = double.MaxValue, maxx = double.MinValue, maxy = double.MinValue;

            for (int i = 0; i < dtinfo.Rows.Count; i++)
            {
                double x = Convert.ToDouble(dtinfo.Rows[i]["x"]);
                double y = Convert.ToDouble(dtinfo.Rows[i]["y"]);
                if (x < minx)
                {
                    minx = x;
                }
                if (x > maxx)
                {
                    maxx = x;
                }
                if (y < miny)
                {
                    miny = y;
                }
                if (y > maxy)
                {
                    maxy = y;
                }
                double dis = distanceXY(x, y, endx, endy);
                if (dis < minD)
                {
                    minD = dis;
                }
                if (dis > maxD)
                {
                    maxD = dis;
                }
                sum += dis;
            }
            areax = (maxx - minx);
            areay = (maxy - miny);
            avgD  = sum / dtinfo.Rows.Count;
            return(true);
        }
        /// <summary>
        /// 选点程序
        /// </summary>
        /// <returns></returns>
        public Result GetPoints()
        {
            Init();
            AddToVirsource();
            Hashtable ht = new Hashtable();

            ht["BtsName"] = this.virname;
            ht["RSRP"]    = this.RSRPCons;
            DataTable dtinfo = IbatisHelper.ExecuteQueryForDataTable("GetDTSet", ht);//获取大于RSRP的BtsName对应的路测信息

            DataTable firstRet = ComputePointByD(dtinfo, this.pointNum, this.DisCons);

            if (firstRet != null && firstRet.Rows.Count > this.pointNum)//先进行距离筛选,
            {
                Debug.WriteLine(dtinfo.Rows.Count + "进入角度约束阶段》》》" + firstRet.Rows.Count);
                DataTable secRet = ComputePointByA(firstRet, this.pointNum, this.AngleCons);

                if (secRet != null && secRet.Rows.Count == this.pointNum)
                {
                    Debug.WriteLine("进入信息填写阶段》》》");
                    //暂时试试用干扰源计算方位角的结果,如果用干扰源计算方位角不行,则说明不行
                    if (CompleteAzimuth(secRet) && tb.Rows.Count == this.pointNum)
                    {
                        double minD = double.MaxValue, maxD = double.MinValue, avgD = 0, areax = 0, areay = 0;
                        if (TestDis(tb, ref minD, ref maxD, ref avgD, ref areax, ref areay))
                        {
                            Debug.WriteLine("干扰源的距离平均:" + avgD + "  与干扰源的最远距离" + maxD + "  与干扰源的最近距离" + minD + "  包围盒长" + areax + "  包围盒宽" + areay);
                        }
                        Hashtable ht1 = new Hashtable();
                        ht1["fromName"] = this.virname;
                        IbatisHelper.ExecuteDelete("deletetbRayLoc", ht1);
                        WriteDataToBase(100);
                        return(new Result {
                            ok = true, msg = "成功写入数据库", code = "1"
                        });;
                    }
                    else
                    {
                        Debug.WriteLine("写入失败》》》");
                        return(new Result(false, "写入失败"));
                    }
                }
                else
                {
                    Debug.WriteLine("无满足角度约束的足够数量的点》》》");
                    return(new Result(false, "无满足角度约束的足够数量的点》》》"));
                }
            }
            else
            {
                Debug.WriteLine("无满足距离约束的足够数量的点》》》");
                return(new Result(false, "无满足距离约束的足够数量的点》》》"));
            }
        }
        public void WriteDt(DataRange dataRange)
        {
            RedisMq.subscriber.Subscribe("cover2db_finish", (channel, message) => {
                Hashtable ht     = new Hashtable();
                DataTable dtable = new DataTable();

                //数据模拟阶段,选取top k
                int sRec = 2000 * 2000;
                int k    = sRec / (canGridL * canGridW);

                ht["eNodeB"] = message;
                ht["k"]      = k;

                //删除已有的路测点
                ht["fromName"] = dataRange.infAreaId + "_" + message;
                IbatisHelper.ExecuteDelete("delSelectDt", ht);

                DataTable dt = DB.IbatisHelper.ExecuteQueryForDataTable("qureyMockDT", ht);

                dtable.Columns.Add("ID", System.Type.GetType("System.Int32"));
                dtable.Columns.Add("x", System.Type.GetType("System.Decimal"));
                dtable.Columns.Add("y", System.Type.GetType("System.Decimal"));
                //dtable.Columns.Add("Lon", System.Type.GetType("System.Decimal"));
                //dtable.Columns.Add("Lat", System.Type.GetType("System.Decimal"));
                dtable.Columns.Add("RSRP", System.Type.GetType("System.Double"));
                dtable.Columns.Add("InfName", System.Type.GetType("System.String"));
                //dtable.Columns.Add("DtType", System.Type.GetType("System.String"));

                int initOff    = 5000;
                int uid        = (int)UIDHelper.GenUIdByRedis("DT", dt.Rows.Count) + initOff;
                string infName = dataRange.infAreaId + "_" + message;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var row         = dt.Rows[i];
                    int gxid        = (int)row["GXID"];
                    int gyid        = (int)row["GYID"];
                    double rsrp     = (double)row["ReceivedPowerdbm"];
                    Point geo       = GridHelper.getInstance().GridToGeo(gxid, gyid);
                    Point proj      = GridHelper.getInstance().GridToXY(gxid, gyid);
                    DataRow thisrow = dtable.NewRow();
                    thisrow["ID"]   = uid + i;
                    thisrow["x"]    = proj.X;
                    thisrow["y"]    = proj.Y;
                    //thisrow["Lon"] = geo.X;
                    //thisrow["Lat"] = geo.Y;
                    thisrow["RSRP"]    = rsrp;
                    thisrow["InfName"] = infName;
                    //thisrow["DtType"] = "mock";
                    dtable.Rows.Add(thisrow);
                }
                //DataUtil.BCPDataTableImport(dtable, "tbUINTF");
                SelectDT(infName, dtable);
            });
        }
Example #18
0
        private static void getGrids1()
        {
            DataTable tb = IbatisHelper.ExecuteQueryForDataTable("GetDTgrids", null);

            foreach (DataRow dataRow in tb.Rows)
            {
                int    gxid = int.Parse(dataRow["gxid"].ToString());
                int    gyid = int.Parse(dataRow["gyid"].ToString());
                string id   = string.Format("{0},{1},{2}", gxid, gyid, 0);
                tbDTgrids.Add(id);
            }
        }
Example #19
0
 // 删除虚拟路测
 public static Result deleteVDT()
 {
     try
     {
         IbatisHelper.ExecuteDelete("DeleteDT", null);
     }
     catch (Exception e)
     {
         return(new Result(false, e.ToString()));
     }
     return(new Result(true));
 }
        private static bool Init()
        {
            DataTable tb = IbatisHelper.ExecuteQueryForDataTable("getAdjCoeff1", null);

            if (tb.Rows.Count < 1)
            {
                scenNum = 0;
                return(false);
            }

            scenNum = Convert.ToInt32(tb.Rows[0][0].ToString()) + 1;
            return(true);
        }
Example #21
0
        /// <summary>
        /// 构造小区信息,其中小区的坐标信息中默认为投影坐标, 使用了arcgis
        /// </summary>
        internal override void constructSourceInfo()
        {
            DataTable cellInfoTable;

            switch (this.cellType)
            {
            case CellType.GSM900:                                  //数据库
            case CellType.GSM1800:
            {
                Hashtable ht = new Hashtable();
                //ht["eNodeB"] = this.eNodeB;
                //ht["CI"] = this.CI;
                ht["cellName"] = this.SourceName;
                cellInfoTable  = IbatisHelper.ExecuteQueryForDataTable("GetGSMCellInfo", ht);
                if (cellInfoTable != null)
                {
                    DataRow row = cellInfoTable.Rows[0];

                    this.Azimuth     = double.Parse(row["Azimuth"].ToString());
                    this.Inclination = double.Parse(row["Tilt"].ToString());
                    this.Inclination = this.Inclination > 0 ? this.Inclination : 7;
                    this.EIRP        = double.Parse(row["EIRP"].ToString());

                    double x, y, z;
                    x = double.Parse(row["x"].ToString());
                    y = double.Parse(row["y"].ToString());
                    z = double.Parse(row["AntHeight"].ToString());
                    double z1 = double.Parse(row["Altitude"].ToString());
                    this.SourcePoint = new Point(x, y, z + z1);

                    string cellType = row["NetType"].ToString();
                    this.cellType = CellType.GSM1800;        //设置默认为GSM1800
                    if (cellType == "GSM900" || cellType == "GSM900小区")
                    {
                        this.cellType = CellType.GSM900;
                    }
                    if (cellType == "GSM1800" || cellType == "GSM1800小区")
                    {
                        this.cellType = CellType.GSM1800;
                    }

                    this.frequncy = Convert.ToInt32(row["EARFCN"]);
                }

                break;
            }

            default:
                break;
            }
        }
        // 2019.6.5 为计算建筑物海拔作准备
        public static void constructAccelerateStructAltitude()
        {
            Hashtable ht = new Hashtable();

            ht["minGXID"] = minGXID;
            ht["maxGXID"] = maxGXID;
            ht["minGYID"] = minGYID;
            ht["maxGYID"] = maxGYID;

            // 建筑物
            DataTable dt = IbatisHelper.ExecuteQueryForDataTable("GetAccelerateStruct", ht);

            List <int> bid;                         //哈希表中每一个key值(栅格)对应的建筑物id列表

            for (int i = 0; i < dt.Rows.Count; i++) //按行遍历DataTable
            {
                string key = dt.Rows[i][0].ToString() + "," + dt.Rows[i][1].ToString() + "," + dt.Rows[i][2].ToString();

                if (!accgrids.ContainsKey(key))
                {//若key不存在,创建新的键值对
                    bid = new List <int>();
                    bid.Add(Convert.ToInt32(dt.Rows[i][3]));
                    accgrids.Add(key, bid);
                }
                else
                {//若key存在,更新键值对
                    accgrids[key].Add(Convert.ToInt32(dt.Rows[i][3]));
                }
            }

            // 2019.5.28 地形
            DataTable dt2 = IbatisHelper.ExecuteQueryForDataTable("GetAccelerateStructTIN", ht);

            List <int> TINid;                        //哈希表中每一个key值(栅格)对应的TIN id 列表

            for (int i = 0; i < dt2.Rows.Count; i++) //按行遍历DataTable
            {
                string key = dt2.Rows[i]["GXID"].ToString() + "," + dt2.Rows[i]["GYID"].ToString() + "," + dt2.Rows[i]["GZID"].ToString();

                if (!gridTIN.ContainsKey(key))
                {//若key不存在,创建新的键值对
                    TINid = new List <int>();
                    TINid.Add(Convert.ToInt32(dt2.Rows[i]["TINID"]));
                    gridTIN.Add(key, TINid);
                }
                else
                {//若key存在,更新键值对
                    gridTIN[key].Add(Convert.ToInt32(dt2.Rows[i]["TINID"]));
                }
            }
        }
        public double dbmPt(double EIRP, double mjDir, double mjTilt)
        {
            //夹角度数为小数时,按比例取大于它和小于它的整度数对应的损耗
            //dbmPt = EiRP- HLoss(Dir,θ) - VLoss(Tilt, Φ)
            Hashtable paramTable = new Hashtable();

            paramTable["gainType"]  = "KRE738819_902";
            paramTable["direction"] = 0; // 0对应HLoss
            paramTable["degree"]    = (int)Math.Floor(mjDir) % 360;
            double HLoss1 = Convert.ToDouble(IbatisHelper.ExecuteQueryForDataTable("getLoss", paramTable).Rows[0]["Loss"]);

            paramTable["degree"] = (int)Math.Ceiling(mjDir) % 360;
            double HLoss2 = Convert.ToDouble(IbatisHelper.ExecuteQueryForDataTable("getLoss", paramTable).Rows[0]["Loss"]);
            double w1     = Math.Abs(mjDir - Math.Floor(mjDir) % 360);
            double HLoss  = HLoss1 * w1 + HLoss2 * (1 - w1);

            paramTable["direction"] = 1; // 1对应VLoss.
            paramTable["degree"]    = (int)Math.Floor(mjTilt) % 360;
            double VLoss1 = Convert.ToDouble(IbatisHelper.ExecuteQueryForDataTable("getLoss", paramTable).Rows[0]["Loss"]);

            paramTable["degree"] = (int)Math.Ceiling(mjTilt) % 360;
            double VLoss2 = Convert.ToDouble(IbatisHelper.ExecuteQueryForDataTable("getLoss", paramTable).Rows[0]["Loss"]);
            double w2     = Math.Abs(mjTilt - Math.Floor(mjTilt) % 360);
            double VLoss  = VLoss1 * w2 + VLoss2 * (1 - w2);


            //旧版代码,夹角度数为小数时采用随机取整
            ////dbmPt = EiRP- HLoss(Dir,θ) - VLoss(Tilt, Φ)
            //Hashtable paramTable = new Hashtable();
            //paramTable["gainType"] = "KRE738819_902";
            //paramTable["direction"] = 0; // 0对应HLoss
            //paramTable["degree"] = (int)Math.Round(mjDir) % 360;
            //double HLoss = Convert.ToDouble(IbatisHelper.ExecuteQueryForDataTable("getLoss", paramTable).Rows[0]["Loss"]);

            //paramTable["direction"] = 1; // 1对应VLoss.
            //paramTable["degree"] = (int)Math.Round(mjTilt) % 360;
            //double VLoss = Convert.ToDouble(IbatisHelper.ExecuteQueryForDataTable("getLoss", paramTable).Rows[0]["Loss"]);

            //旧版代码,从内存读取
            //AbstrGain abstrGain = GainFactory.GetabstractGain("KRE738819_902");
            //double[] HAGain = abstrGain.GetHAGain();
            //double[] VAGain = abstrGain.GetVAGain();
            //double HLoss = HAGain[(int)Math.Round(mjDir) % 360];
            //double VLoss = VAGain[(int)Math.Round(mjTilt) % 360];

            double dbmPt = EIRP - HLoss - VLoss - 2;

            return(dbmPt);
        }
        public Result overlaygrass()
        {
            DataTable dt1 = DB.IbatisHelper.ExecuteQueryForDataTable("GetFishnetShpState", null);  // Ibatis 数据访问,判断用户是否做了渔网生成

            if (dt1.Rows[0][0].ToString() == "0")
            {
                return(new Result(false, "用户未进行渔网生成"));
            }
            //     else
            //     { return new Result(true, "用户未进行渔网生成"); }

            DataTable dt2 = DB.IbatisHelper.ExecuteQueryForDataTable("GetGrass_overlayState", null); // Ibatis 数据访问,判断用户是否做了水面叠加分析,做了则删除它

            if (dt2.Rows[0][0].ToString() == "1")                                                    //存在水面叠加图层
            {
                try                                                                                  //更新加速场景表,前提条件表
                {
                    IbatisHelper.ExecuteDelete("UpdatetbDependTableDuetoGrass_overlay", null);
                    IbatisHelper.ExecuteDelete("deleteAdjcoefficient", null);
                    IbatisHelper.ExecuteUpdate("UpdatetbAccelerateGridSceneDuetoGrass_overlay", null);
                }
                catch (Exception ex)
                { return(new Result(false, ex.ToString())); }
            }


            try
            {
                GisClient.Result res = GisClient.ServiceApi.getGisLayerService().overlaygrass();
                if (res.Ok)
                {
                    //更新tbDependTabled的Grass_overlay
                    IbatisHelper.ExecuteUpdate("UpdatetbDependTableGrass_overlay", null);
                    return(new Result(true, res.Msg));
                }
                else
                {
                    return(new Result(false, res.Msg));
                }
            }
            catch (Exception e)
            {
                return(new Result(false, "远程调用失败" + e));
            }
            finally
            {
                ServiceApi.CloseConn();
            }
        }
        public Result validateCell(ref CellInfo cellInfo)
        {
            if (this.cellName == string.Empty)
            {
                return(new Result(false, "请输入小区名称"));
            }
            DataTable dt = IbatisHelper.ExecuteQueryForDataTable("SingleGetCellType", this.cellName);

            if (dt.Rows.Count == 0)
            {
                return(new Result(false, "您输入的小区名称有误,请重新输入!"));
            }
            cellInfo.eNodeB = Convert.ToInt32(dt.Rows[0]["eNodeB"]);
            cellInfo.CI     = Convert.ToInt32(dt.Rows[0]["CI"]);
            return(new Result(true));
        }
        /// <summary>
        /// 写入数据库
        /// </summary>
        /// <param name="batchSize"></param>
        public void WriteDataToBase(int batchSize)
        {
            Hashtable ht = new Hashtable();

            ht["cellname"] = this.virname;
            IbatisHelper.ExecuteDelete("deletbSelectedPoint", ht);
            using (SqlBulkCopy bcp = new SqlBulkCopy(DataUtil.ConnectionString))
            {
                bcp.BatchSize            = batchSize;
                bcp.BulkCopyTimeout      = 1000;
                bcp.DestinationTableName = "tbSelectedPoints";
                bcp.WriteToServer(tb);
                bcp.Close();
            }
            Debug.WriteLine("入库完成");
        }
Example #27
0
        private void writeReRayToDb()
        {
            Console.WriteLine("start writing reRay to db...................................");
            // 删除旧的reRay
            Hashtable ht = new Hashtable();

            ht["CI"]     = this.cellInfo.CI;
            ht["eNodeB"] = this.cellInfo.eNodeB;
            IbatisHelper.ExecuteDelete("deleteSpecifiedReRay", ht);

            System.Data.DataTable dtable = new System.Data.DataTable();
            dtable.Columns.Add("ci");
            dtable.Columns.Add("emitX");
            dtable.Columns.Add("emitY");
            dtable.Columns.Add("emitZ");
            dtable.Columns.Add("pwrDbm");
            dtable.Columns.Add("dirX");
            dtable.Columns.Add("dirY");
            dtable.Columns.Add("dirZ");
            dtable.Columns.Add("type");

            for (int i = 0; i < this.MultiTasksReRay.Count; i++)
            {
                System.Data.DataRow thisrow = dtable.NewRow();
                thisrow["ci"]     = this.cellInfo.CI;
                thisrow["emitX"]  = Math.Round(this.MultiTasksReRay[i].emitX, 3);
                thisrow["emitY"]  = Math.Round(this.MultiTasksReRay[i].emitY, 3);
                thisrow["emitZ"]  = Math.Round(this.MultiTasksReRay[i].emitZ, 3);
                thisrow["pwrDbm"] = Math.Round(this.MultiTasksReRay[i].pwrDbm, 3);
                thisrow["dirX"]   = Math.Round(this.MultiTasksReRay[i].dirX, 4);
                thisrow["dirY"]   = Math.Round(this.MultiTasksReRay[i].dirY, 4);
                thisrow["dirZ"]   = Math.Round(this.MultiTasksReRay[i].dirZ, 4);
                thisrow["type"]   = this.MultiTasksReRay[i].type;
                dtable.Rows.Add(thisrow);
            }

            using (System.Data.SqlClient.SqlBulkCopy bcp = new System.Data.SqlClient.SqlBulkCopy(DataUtil.ConnectionString))
            {
                bcp.BatchSize            = dtable.Rows.Count;
                bcp.BulkCopyTimeout      = 1000;
                bcp.DestinationTableName = "tbReRay";
                bcp.WriteToServer(dtable);
                bcp.Close();
            }
            dtable.Clear();
            Console.WriteLine("tbReRay 写入结束!");
        }
Example #28
0
        public Result cluster()
        {
            DataTable dt11 = DB.IbatisHelper.ExecuteQueryForDataTable("GetClustertoDBState", null);  // Ibatis 数据访问,判断用户是否做了场景划分

            if (dt11.Rows[0][0].ToString() == "0")
            {
                return(new Result(false, "用户未进行场景划分"));
            }


            DataTable dt2 = DB.IbatisHelper.ExecuteQueryForDataTable("GetClusterShpState", null); // Ibatis 数据访问,判断用户是否做了结果图层

            if (dt2.Rows[0][0].ToString() == "1")                                                 //做了结果图层
            {
                try                                                                               //更新前提条件表
                {
                    IbatisHelper.ExecuteDelete("UpdatetbDependTableDuetoClusterShp", null);
                    IbatisHelper.ExecuteDelete("deleteAdjcoefficient", null);
                }
                catch (Exception ex)
                { return(new Result(false, ex.ToString())); }
            }

            try
            {
                GisClient.Result res = GisClient.ServiceApi.getGisLayerService().cluster();
                if (res.Ok)
                {
                    //更新tbDependTabled的Grass_overlay
                    IbatisHelper.ExecuteUpdate("UpdatetbDependTableClusterShp", null);
                    return(new Result(true, res.Msg));
                }
                else
                {
                    return(new Result(false, res.Msg));
                }
            }
            catch (Exception e)
            {
                return(new Result(false, "远程调用失败" + e));
            }
            finally
            {
                ServiceApi.CloseConn();
            }
        }
Example #29
0
        /// <summary>
        /// 获取中心点在范围内的地面栅格中心点
        /// </summary>
        /// <returns></returns>
        public static int constructGGrids(ref Geometric.Point p1, ref Geometric.Point p2,
                                          ref Geometric.Point p3, ref Geometric.Point p4)
        {
            //Console.WriteLine("{0}", 1);
            ggrids = new Dictionary <string, Point>();

            Hashtable ht = new Hashtable();

            Grid3D gid1 = new Grid3D(), gid2 = new Grid3D(), gid3 = new Grid3D(), gid4 = new Grid3D();

            GridHelper.getInstance().PointXYZToGrid3D1(p1, ref gid1);
            GridHelper.getInstance().PointXYZToGrid3D1(p2, ref gid2);
            GridHelper.getInstance().PointXYZToGrid3D1(p3, ref gid3);
            GridHelper.getInstance().PointXYZToGrid3D1(p4, ref gid4);

            //Console.WriteLine("from: {0}", from * 180 / Math.PI);
            //Console.WriteLine("to: {0}", to * 180 / Math.PI);
            //Console.WriteLine("alpha: {0}", alpha * 180 / Math.PI);
            //Console.WriteLine("theta: {0}", theta * 180 / Math.PI);

            ht["x1"] = gid1.gxid;
            ht["x2"] = gid2.gxid;
            ht["x3"] = gid3.gxid;
            ht["x4"] = gid4.gxid;
            ht["y1"] = gid1.gyid;
            ht["y2"] = gid2.gyid;
            ht["y3"] = gid3.gyid;
            ht["y4"] = gid4.gyid;
            DataTable grids = IbatisHelper.ExecuteQueryForDataTable("getGroundGridsCenter", ht);
            //Console.WriteLine("{0}", grids.Rows.Count);
            double x, y, z;
            int    gxid, gyid;
            string key;

            for (int i = 0, cnt = grids.Rows.Count; i < cnt; i++)
            {
                gxid = Convert.ToInt32(grids.Rows[i]["GXID"]);
                gyid = Convert.ToInt32(grids.Rows[i]["GYID"]);
                x    = Convert.ToDouble(grids.Rows[i]["CX"]);
                y    = Convert.ToDouble(grids.Rows[i]["CY"]);
                z    = Convert.ToDouble(grids.Rows[i]["Dem"]);
                key  = string.Format("{0},{1}", gxid, gyid);
                ggrids.Add(key, new Point(x, y, z));
            }
            return(ggrids.Count);
        }
        private void AddToVirsource()
        {
            //判断是否已经有
            //若有,直接返回true
            Hashtable ht1 = new Hashtable();

            ht1["cellname"] = this.virname;
            DataTable isExist = IbatisHelper.ExecuteQueryForDataTable("GetVirSourceAllInfo", ht1);

            if (isExist.Rows.Count == 0 || isExist.Rows[0]["x"] == DBNull.Value)
            {
                Debug.WriteLine("未添加过该目标源");
                Hashtable htbts = new Hashtable();
                htbts["BtsName"] = this.virname;
                DataTable dtcell = IbatisHelper.ExecuteQueryForDataTable("GetSource", htbts);
                if (dtcell != null && dtcell.Rows.Count == 1)
                {
                    Hashtable ht = new Hashtable();
                    ht["CellName"]  = this.virname;
                    ht["Longitude"] = Convert.ToDouble(dtcell.Rows[0]["Longitude"]);
                    ht["Latitude"]  = Convert.ToDouble(dtcell.Rows[0]["Latitude"]);
                    ht["x"]         = Convert.ToDouble(dtcell.Rows[0]["x"]);
                    ht["y"]         = Convert.ToDouble(dtcell.Rows[0]["y"]);
                    ht["z"]         = 0;
                    ht["Altitude"]  = 0;
                    ht["AntHeight"] = Convert.ToDouble(dtcell.Rows[0]["AntHeight"]);

                    // 2017.4.28 添加
                    ht["Tilt"]    = Convert.ToInt32(dtcell.Rows[0]["Tilt"]);
                    ht["EIRP"]    = Convert.ToInt32(dtcell.Rows[0]["EIRP"]);
                    ht["NetType"] = "";
                    ht["CI"]      = Convert.ToInt32(dtcell.Rows[0]["CI"]);
                    ht["EARFCN"]  = Convert.ToInt32(dtcell.Rows[0]["EARFCN"]);
                    ht["eNodeB"]  = Convert.ToInt32(dtcell.Rows[0]["eNodeB"]);
                    IbatisHelper.ExecuteInsert("insertVirSource", ht);
                }
                else
                {
                    Debug.WriteLine("无该版本路测干扰源信息");
                }
            }
            else
            {
                Debug.WriteLine("已添加过该目标源");
            }
        }