/// <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 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, "更新成功")); }
//获取[参数]范围内的地面栅格中心点 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); }
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"])); } } }
// 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)); } }
// 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; }
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); }
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); }
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); } } }
/// <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, "更新成功")); }
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); }
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, "无满足距离约束的足够数量的点》》》")); } }
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); } }
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); }
/// <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 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> /// <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("已添加过该目标源"); } }
/// <summary> /// 获取小区信息 /// </summary> void InitCellInfo() { //获取小区表信息,并存储到cellmap中,pci为key //cellmap = new Dictionary<int, List<UseCell>>(); DataTable celldt = IbatisHelper.ExecuteQueryForDataTable("SelectCellInfo", null); if (cellmap != null && cellmap.Count == celldt.Rows.Count) { Debug.WriteLine("已初始化,小区数:" + cellmap.Count); return; } //获取小区表信息,并存储到cellmap中,pci为key cellmap = new Dictionary <int, List <UseCell> >(); foreach (DataRow cellRow in celldt.Rows) { double lon = double.Parse(cellRow["Longitude"].ToString()); double lat = double.Parse(cellRow["Latitude"].ToString()); int eNodeB = int.Parse(cellRow["eNodeB"].ToString()); int cellid = int.Parse(cellRow["CellID"].ToString()); int pci = int.Parse(cellRow["PCI"].ToString()); UseCell curcell = new UseCell(lon, lat, eNodeB, cellid); if (cellmap.ContainsKey(pci)) { List <UseCell> list = new List <UseCell>(cellmap[pci]); cellmap.Remove(pci); list.Add(curcell); cellmap.Add(pci, list); } else { List <UseCell> list = new List <UseCell>(); list.Add(curcell); cellmap.Add(pci, list); } } //验证 int count = 0; foreach (KeyValuePair <int, List <UseCell> > kv in cellmap) { count += kv.Value.Count; } Debug.WriteLine("共有小区数:" + count); }
//从真实路测获取所有主小区为该小区的路测点,将经纬坐标转换为栅格id,jinhj private static void getGrids(int cellIndex) { Hashtable ht = new Hashtable(); ht["cellIndex"] = cellIndex; DataTable tb = IbatisHelper.ExecuteQueryForDataTable("GetAllDTGridsOfACell", ht); foreach (DataRow dataRow in tb.Rows) { double x = double.Parse(dataRow["x"].ToString()); double y = double.Parse(dataRow["y"].ToString()); int gxid = -1; int gyid = -1; GridHelper.getInstance().XYToGGrid(x, y, ref gxid, ref gyid); string id = string.Format("{0},{1},{2}", gxid, gyid, 0); tbDTgrids.Add(id); } }
/// <summary> /// 初始化网格边界条件 /// </summary> /// <returns></returns> private static bool Init() { DataTable area = new DataTable(); Hashtable ht = new Hashtable(); ht["id"] = 1; // 1表示用的是全局地图,2表示用的是局部地图 area = IbatisHelper.ExecuteQueryForDataTable("getGridRange", ht); if (area.Rows.Count < 1) { return(false); } else { minlong = Convert.ToDouble(area.Rows[0]["AreaMinLong"].ToString()); minlat = Convert.ToDouble(area.Rows[0]["AreaMinLat"].ToString()); maxlong = Convert.ToDouble(area.Rows[0]["AreaMaxLong"].ToString()); maxlat = Convert.ToDouble(area.Rows[0]["AreaMaxLat"].ToString()); oX = Convert.ToDouble(area.Rows[0]["AreaMinX"].ToString()); oY = Convert.ToDouble(area.Rows[0]["AreaMinY"].ToString()); maxX = Convert.ToDouble(area.Rows[0]["AreaMaxX"].ToString()); maxY = Convert.ToDouble(area.Rows[0]["AreaMaxY"].ToString()); ggridsize = Convert.ToInt32(area.Rows[0]["GGridSize"].ToString()); MaxGGXID = Convert.ToInt32(area.Rows[0]["MaxGGXID"].ToString()); MaxGGYID = Convert.ToInt32(area.Rows[0]["MaxGGYID"].ToString()); gheight = Convert.ToDouble(area.Rows[0]["GHeight"].ToString()); gbaseheight = Convert.ToDouble(area.Rows[0]["GBaseHeight"].ToString()); agridsize = Convert.ToInt32(area.Rows[0]["AGridSize"].ToString()); agridvsize = Convert.ToInt32(area.Rows[0]["AGridVSize"].ToString()); MaxAGXID = Convert.ToInt32(area.Rows[0]["MaxAGXID"].ToString()); MaxAGYID = Convert.ToInt32(area.Rows[0]["MaxAGYID"].ToString()); minX = Convert.ToDouble(area.Rows[0]["MinX"].ToString()); minY = Convert.ToDouble(area.Rows[0]["MinY"].ToString()); MinGGXID = Convert.ToInt32(area.Rows[0]["MinGGXID"].ToString()); MinGGYID = Convert.ToInt32(area.Rows[0]["MinGGYID"].ToString()); MinAGXID = Convert.ToInt32(area.Rows[0]["MinAGXID"].ToString()); MinAGYID = Convert.ToInt32(area.Rows[0]["MinAGYID"].ToString()); } return(true); }
/// <summary> /// 从数据库表tbGrid3D中取出所有符合条件的数据,并以GXID,GYID,GZID排序,组成空间网格集合 /// </summary> /// <returns></returns> public static void constructGrid3D(ref Geometric.Point p1, ref Geometric.Point p2, ref Geometric.Point p3, ref Geometric.Point p4) { Hashtable para = 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); para["x1"] = gid1.gxid; para["x2"] = gid2.gxid; para["x3"] = gid3.gxid; para["x4"] = gid4.gxid; para["y1"] = gid1.gyid; para["y2"] = gid2.gyid; para["y3"] = gid3.gyid; para["y4"] = gid4.gyid; DataTable dt = IbatisHelper.ExecuteQueryForDataTable("GetBuildingGrid3D1", para); //Console.WriteLine(string.Format("{0} {1} {3} {4} {5} {6} {7}", gid1.gxid, gid2.gxid, gid3.gxid, gid4.gxid, gid1.gyid, gid2.gyid, gid3.gyid, gid4.gyid); 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); } } }
/// <summary> /// 平滑处理 /// </summary> public static void constructBuildingVertexOriginal() { maxBID = int.MinValue; minBID = int.MaxValue; DataTable dt = IbatisHelper.ExecuteQueryForDataTable("GetBuildingVertexOriginal", null); List <Point> vcollection; Point t; int bid; double x, y; for (int i = 0; i < dt.Rows.Count; i++) { bid = Convert.ToInt32(dt.Rows[i]["BuildingID"]); if (bid > maxBID) { maxBID = bid; } if (bid < minBID) { minBID = bid; } x = Convert.ToDouble(dt.Rows[i]["VertexX"]); y = Convert.ToDouble(dt.Rows[i]["VertexY"]); t = new Point(x, y, 0); if (buildingVertexOriginal.ContainsKey(bid)) { buildingVertexOriginal[bid].Add(t); } else { vcollection = new List <Point>(); vcollection.Add(t); buildingVertexOriginal.Add(bid, vcollection); } } }
// 获取区域内的 TIN public static int constructTINVertex() { //清除前一部分区域的数据,防止内存溢出 2019.7.22 xsx TINVertex.Clear(); Hashtable ht = new Hashtable(); ht["minX"] = MinX; ht["maxX"] = MaxX; ht["minY"] = MinY; ht["maxY"] = MaxY; //DataTable dt = IbatisHelper.ExecuteQueryForDataTable("GetTINVertex", ht); //通过矩形覆盖方式取,防止顶点在外面在内的特殊情况 DataTable dt = IbatisHelper.ExecuteQueryForDataTable("GetTINVertexByArea", ht); List <Point> vcollection; for (int i = 0; i < dt.Rows.Count; i++) { int TINid = Convert.ToInt32(dt.Rows[i]["TINID"]); double x = Convert.ToDouble(dt.Rows[i]["VertexX"]); double y = Convert.ToDouble(dt.Rows[i]["VertexY"]); double z = Convert.ToDouble(dt.Rows[i]["VertexHeight"]); Point t = new Point(x, y, z); if (TINVertex.ContainsKey(TINid)) { TINVertex[TINid].Add(t); } else { vcollection = new List <Point>(); vcollection.Add(t); TINVertex.Add(TINid, vcollection); } } return(TINVertex.Count); }
private static bool Init() { DataTable tb = IbatisHelper.ExecuteQueryForDataTable("getAdjCoeff", null); scenNum = tb.Rows.Count; if (scenNum < 1) { scenNum = 0; return(false); } coeff = new double[scenNum, 3]; for (int i = 0; i < scenNum; i++) { coeff[i, 0] = Convert.ToDouble(tb.Rows[i]["DirectCoefficient"].ToString()); coeff[i, 1] = Convert.ToDouble(tb.Rows[i]["ReflectCoefficient"].ToString()); coeff[i, 2] = Convert.ToDouble(tb.Rows[i]["DiffracteCoefficient"].ToString()); } return(true); }
public static bool refreshInfLayer() { DataTable gridTable = IbatisHelper.ExecuteQueryForDataTable("GetInfSource", null); if (gridTable.Rows.Count < 1) { return(false); } IRgbColor pColor = new RgbColorClass(); //颜色 IGraphicsLayer pLayer = ((object)GISMapApplication.Instance.Scene as IBasicMap).BasicGraphicsLayer; IPoint pt = null; pColor.RGB = System.Drawing.Color.FromArgb(0, 0, 255).ToArgb(); foreach (DataRow dataRow in gridTable.Rows) { pt = GeometryUtilities.ConstructPoint3D(double.Parse(dataRow["x"].ToString()), double.Parse(dataRow["y"].ToString()), double.Parse(dataRow["z"].ToString())); DrawUtilities.DrawPoint(pLayer as IGraphicsContainer3D, pt, pColor, 25); } return(true); }
//MessageBox.Show(this, "入库完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); /// <summary> /// 用目标干扰源计算方位角 /// </summary> /// <param name="dtinfo"></param> /// <returns></returns> private Boolean CompleteAzimuthVir(DataTable dtinfo) { Hashtable ht = new Hashtable(); ht["BtsName"] = this.virname; DataTable tbcell = IbatisHelper.ExecuteQueryForDataTable("GettbSource", ht); if (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"]); Point end = new Point(endx, endy, 0); tb.Clear(); for (int i = 0; i < dtinfo.Rows.Count; i++) { Debug.WriteLine(i); double x = Convert.ToInt32(dtinfo.Rows[i]["x"]); double y = Convert.ToInt32(dtinfo.Rows[i]["y"]); Point start = new Point(x, y, 0); double azimuth = GeometricUtilities.getPolarCoord(start, end).theta / Math.PI * 180; azimuth = GeometricUtilities.ConvertGeometricArithmeticAngle(azimuth + 1); DataRow thisrow = tb.NewRow(); thisrow["fromName"] = this.virname; thisrow["x"] = x; thisrow["y"] = y; thisrow["ReceivePW"] = dtinfo.Rows[i]["ReceivePW"]; thisrow["CI"] = dtinfo.Rows[i]["CI"]; thisrow["Azimuth"] = azimuth; thisrow["Distance"] = distanceXY(start.X, start.Y, end.X, end.Y) + 300; tb.Rows.Add(thisrow); } return(true); }