private void startChildPro() { ////test //processNum = 1; //this.processNum = 1; Random r = new Random(DateTime.Now.Second); LTE.Geometric.Point p = cellInfo.SourcePoint; //double deltaA = (this.toAngle - this.fromAngle + 360) % 360 / processNum; double deltaA = (this.toAngle - this.fromAngle) / processNum; double from, to; string calcBids = ""; int bidsNum = Convert.ToInt32(Math.Round(this.bids.Count * 1.0 / processNum)); try { for (int i = 0; i < this.processNum; i++) { //string threadTaskName = taskName + i; from = (fromAngle + i * deltaA + 360) % 360; to = (fromAngle + (i + 1) * deltaA + 360) % 360; //if (to > this.toAngle) // to = this.toAngle; Console.WriteLine("thread" + i + "from: " + from + " to:" + to); calcBids = "-1"; for (int j = i * bidsNum, k = 0, bound = i == this.processNum - 1 ? this.bids.Count - j : bidsNum; k < bound; k++) { calcBids += "," + this.bids[j + k]; } ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = "LTE.CalcProcess.exe"; psi.Arguments = string.Format("{0} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15} {16} {17} {18} {19} {20} {21} {22} {23} {24} {25} {26} {27} {28} {29} {30} {31} {32} {33} {34} {35} {36}", this.baseMMFName, 0, i + 1, cellInfo.SourceName, p.X, p.Y, 0, 0, p.Z, cellInfo.eNodeB, cellInfo.CI, cellInfo.Azimuth, cellInfo.Inclination, cellInfo.cellType, cellInfo.frequncy, cellInfo.EIRP, cellInfo.directCoefficient, cellInfo.reflectCoefficient, cellInfo.diffracteCoefficient, cellInfo.diffracteCoefficient2, from, to, this.distance, this.reflectionNum, this.diffractionNum, this.computeIndoor, this.Handle.ToInt32(), calcBids, this.diffPointsMargin, this.computeVSide, deltaA, this.reRay, this.isRecordReray, this.rayLoc, this.rayAdj, this.userId, taskName); psi.UseShellExecute = true; //当前exe与子进程在同一级目录下 psi.WorkingDirectory = this.basePath; psi.ErrorDialog = true; Process pro = Process.Start(psi); //pro.WaitForInputIdle(); //pro.Refresh(); //this.paList.Add(new ProcessArgs(pro)); } } catch (Exception ee) { MessageBox.Show(string.Format("启动子程序异常:路径 = {0}\n, 原因:", this.basePath, ee.Message)); //修改为异常退出 System.Environment.Exit(3); } }
/// <summary> /// 返回5*5网格右上角对应的地理坐标 /// </summary> /// <param name="gxid"></param> /// <param name="gyid"></param> /// <param name="gzid"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="z"></param> public Point GridToRightUpGeo(int gxid, int gyid) { double x = oX + gxid * (ggridsize + 1); double y = oY + gyid * (ggridsize + 1); LTE.Geometric.Point p = new LTE.Geometric.Point(); p.X = x; p.Y = y; return(PointConvertByProj.Instance.GetGeoPoint(p)); }
public static List <int> getSelectedBuildings(LTE.Geometric.Point p, double fromAngle, double toAngle, double radius) { IPoint centralPoint = GeometryUtilities.ConstructPoint2D(p.X, p.Y); double arithmeticToAngle = GeometricUtilities.GetRadians(GeometricUtilities.ConvertGeometricArithmeticAngle(toAngle)); double angle = (toAngle - fromAngle + 360) % 360; bool isCCW = true; if (angle > 180) { angle = 360 - angle; isCCW = false; } else if (angle == 0) { angle = 360; } double arcDistance = radius * GeometricUtilities.GetRadians(angle); IPoint fromPoint = GeometryUtilities.ConstructPoint_AngleDistance(centralPoint, arithmeticToAngle, radius); ICircularArc circularArc = GeometryUtilities.ConstructCircularArc(centralPoint, fromPoint, isCCW, arcDistance); //逆时针 IPoint toPoint = circularArc.ToPoint; ISegment fromSegment = GeometryUtilities.ConstructLine(centralPoint, fromPoint) as ISegment; ISegment toSegment = GeometryUtilities.ConstructLine(toPoint, centralPoint) as ISegment; ISegment[] segmentArray = new ISegment[] { fromSegment, circularArc as ISegment, toSegment }; IGeometryCollection polygon = GeometryUtilities.ConstructPolygon(segmentArray); IPolygon pPolygon = polygon as IPolygon; IGeometry pGeometry = GeometryUtilities.ConvertProjToGeo(pPolygon as IGeometry); IFeatureLayer pFeatureLayer = GISMapApplication.Instance.GetLayer(LayerNames.Projecton) as IFeatureLayer; IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass; ISpatialFilter spatialFilter = new SpatialFilterClass(); spatialFilter.Geometry = pGeometry; spatialFilter.GeometryField = pFeatureClass.ShapeFieldName; spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; //Execute the spatialfilter IFeatureCursor featureCursor = pFeatureClass.Search(spatialFilter, false); IFeature pFeature = null; List <int> bids = new List <int>(); while ((pFeature = featureCursor.NextFeature()) != null) { bids.Add(pFeature.OID); } return(bids); }
/// <summary> /// 返回5*5网格中心点对应的地理坐标 /// </summary> /// <param name="gxid"></param> /// <param name="gyid"></param> /// <param name="gzid"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="z"></param> public Point GridToGeo(int gxid, int gyid) { double half = 0.5 * ggridsize; double x = oX + gxid * ggridsize + half; double y = oY + gyid * ggridsize + half; LTE.Geometric.Point p = new LTE.Geometric.Point(); p.X = x; p.Y = y; return(PointConvertByProj.Instance.GetGeoPoint(p)); }
public static void drawSector(LTE.Geometric.Point p, double fromAngle, double toAngle, double radius) { IPoint centralPoint = GeometryUtilities.ConstructPoint2D(p.X, p.Y); double arithmeticToAngle = GeometricUtilities.GetRadians(GeometricUtilities.ConvertGeometricArithmeticAngle(toAngle)); double angle = (toAngle - fromAngle) % 360; bool isCCW = true; if (angle > 180) { angle = 360 - angle; isCCW = false; } if (angle == 0) { angle = 360; } double arcDistance = radius * GeometricUtilities.GetRadians(angle); IPoint fromPoint = GeometryUtilities.ConstructPoint_AngleDistance(centralPoint, arithmeticToAngle, radius); ICircularArc circularArc = GeometryUtilities.ConstructCircularArc(centralPoint, fromPoint, isCCW, arcDistance); IPoint toPoint = circularArc.ToPoint; ISegment fromSegment = GeometryUtilities.ConstructLine(centralPoint, fromPoint) as ISegment; ISegment toSegment = GeometryUtilities.ConstructLine(toPoint, centralPoint) as ISegment; ISegment[] segmentArray = new ISegment[] { fromSegment, circularArc as ISegment, toSegment }; IGeometryCollection polygon = GeometryUtilities.ConstructPolygon(segmentArray); //画扇形 IGraphicsContainer3D graphicsContainer3D = GISMapApplication.Instance.GetLayer(LayerNames.Rays) as IGraphicsContainer3D; IPolygonElement polygonElement = new PolygonElementClass(); IElement element = polygonElement as IElement; element.Geometry = polygon as IGeometry; graphicsContainer3D.AddElement(element); }
/// <summary> /// 获取扇形与地面网格相交的网格中心点 /// </summary> /// <param name="p"></param> /// <param name="fromAngle"></param> /// <param name="toAngle"></param> /// <param name="radius"></param> /// <returns></returns> public static List <LTE.Geometric.Point> getSelectedGridsCenterPoints(LTE.Geometric.Point p, double fromAngle, double toAngle, double radius) { IPoint centralPoint = GeometryUtilities.ConstructPoint2D(p.X, p.Y); double arithmeticToAngle = GeometricUtilities.GetRadians(GeometricUtilities.ConvertGeometricArithmeticAngle(toAngle)); double angle = (toAngle - fromAngle) % 360; bool isCCW = true; if (angle > 180) { angle = 360 - angle; isCCW = false; } if (angle == 0) { angle = 360; } double arcDistance = radius * GeometricUtilities.GetRadians(angle); IPoint fromPoint = GeometryUtilities.ConstructPoint_AngleDistance(centralPoint, arithmeticToAngle, radius); ICircularArc circularArc = GeometryUtilities.ConstructCircularArc(centralPoint, fromPoint, isCCW, arcDistance); IPoint toPoint = circularArc.ToPoint; ISegment fromSegment = GeometryUtilities.ConstructLine(centralPoint, fromPoint) as ISegment; ISegment toSegment = GeometryUtilities.ConstructLine(toPoint, centralPoint) as ISegment; ISegment[] segmentArray = new ISegment[] { fromSegment, circularArc as ISegment, toSegment }; IGeometryCollection polygon = GeometryUtilities.ConstructPolygon(segmentArray); //画扇形 //IGraphicsContainer3D graphicsContainer3D = GISMapApplication.Instance.GetLayer(LayerNames.Rays) as IGraphicsContainer3D; //IPolygonElement polygonElement = new PolygonElementClass(); //IElement element = polygonElement as IElement; //element.Geometry = polygon as IGeometry; //graphicsContainer3D.AddElement(element); IGeometry pGeometry = GeometryUtilities.ConvertProjToGeo(polygon as IGeometry); //地面网格图层是经纬度 IFeatureLayer groundFeatureLayer = GISMapApplication.Instance.GetLayer(LayerNames.GroundGrids) as IFeatureLayer; IFeatureClass groundFeatureClass = groundFeatureLayer.FeatureClass; ISpatialFilter spatialFilter = new SpatialFilterClass(); spatialFilter.Geometry = pGeometry; //spatialFilter.Geometry = pPolygon as IGeometry; spatialFilter.GeometryField = groundFeatureClass.ShapeFieldName; spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; IFeatureCursor featureCursor = groundFeatureClass.Search(spatialFilter, false); int CenterXIndex = groundFeatureClass.Fields.FindField("CenterX"); int CenterYIndex = groundFeatureClass.Fields.FindField("CenterY"); int xindex = groundFeatureClass.Fields.FindField("GXID"); int yindex = groundFeatureClass.Fields.FindField("GYID"); IFeature pFeature; List <LTE.Geometric.Point> centerPoints = new List <LTE.Geometric.Point>(); while ((pFeature = featureCursor.NextFeature()) != null) { int gxid = (int)pFeature.get_Value(xindex); int gyid = (int)pFeature.get_Value(yindex); double centerX = double.Parse(pFeature.get_Value(CenterXIndex).ToString()); double centerY = double.Parse(pFeature.get_Value(CenterYIndex).ToString()); IPoint crossWithGround = GeometryUtilities.ConstructPoint3D(centerX, centerY, 0); double lng = crossWithGround.X, lat = crossWithGround.Y; crossWithGround = (IPoint)GeometryUtilities.ConvertGeoToProj(crossWithGround as IGeometry); centerPoints.Add(new LTE.Geometric.Point(crossWithGround.X, crossWithGround.Y, crossWithGround.Z)); } System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor); System.Runtime.InteropServices.Marshal.ReleaseComObject(groundFeatureLayer); System.Runtime.InteropServices.Marshal.ReleaseComObject(groundFeatureClass); System.Runtime.InteropServices.Marshal.ReleaseComObject(spatialFilter); System.Runtime.InteropServices.Marshal.ReleaseThreadCache(); return(centerPoints); }
public static LTE.Geometric.Point ConstructPoint3D(LTE.Geometric.Point point, double z) { return(new LTE.Geometric.Point(point.X, point.Y, z)); }
//轨迹数据字典 // key:"cellid,gxid,gyid" // value: TrajInfo{ key: "trajID", value: List<NodeInfo> } public static Dictionary <string, TrajInfo> buildingGrids(ref DataTable tb) { Dictionary <string, TrajInfo> rayDic = new Dictionary <string, TrajInfo>(); //DataTable tb = new DataTable(); //tb = IbatisHelper.ExecuteQueryForDataTable("getRays", null); double h = (int)GridHelper.getInstance().getGHeight(); if (tb.Rows.Count < 1) { return(rayDic); } else { for (int i = 0; i < tb.Rows.Count; i++) { int cellID = Convert.ToInt32(tb.Rows[i]["cellID"].ToString()); int Gxid = Convert.ToInt32(tb.Rows[i]["gxid"].ToString()); int Gyid = Convert.ToInt32(tb.Rows[i]["gyid"].ToString()); int trajID = Convert.ToInt32(tb.Rows[i]["trajID"].ToString()); double EmitPwrW = Convert.ToDouble(tb.Rows[i]["emitPwrW"].ToString()); int rayType = Convert.ToInt32(tb.Rows[i]["rayType"].ToString()); int rayLevel = Convert.ToInt32(tb.Rows[i]["rayLevel"].ToString()); double distance = Convert.ToDouble(tb.Rows[i]["distance"].ToString()); double Angle = Convert.ToDouble(tb.Rows[i]["angle"].ToString()); double attenuation = Convert.ToDouble(tb.Rows[i]["attenuation"].ToString()); double RecePwrW = Convert.ToDouble(tb.Rows[i]["recePwrW"].ToString()); string scen = tb.Rows[i]["proportion"].ToString(); int ptScen = Convert.ToInt32(tb.Rows[i]["endPointScen"].ToString()); //射线段读入内存结构时,将射线段的起点和终点也读进来,jinhj double pointOfIncidenceX = Convert.ToDouble(tb.Rows[i]["rayStartPointX"].ToString()); double pointOfIncidenceY = Convert.ToDouble(tb.Rows[i]["rayStartPointY"].ToString()); double pointOfIncidenceZ = Convert.ToDouble(tb.Rows[i]["rayStartPointZ"].ToString()); Point pointOfIncidence = new Point(pointOfIncidenceX, pointOfIncidenceY, pointOfIncidenceZ); double crossPointX = Convert.ToDouble(tb.Rows[i]["rayEndPointX"].ToString()); double crossPointY = Convert.ToDouble(tb.Rows[i]["rayEndPointY"].ToString()); double crossPointZ = Convert.ToDouble(tb.Rows[i]["rayEndPointZ"].ToString()); Point crossPoint = new Point(crossPointX, crossPointY, crossPointZ); RayType rayT = new RayType(); switch (rayType) { case 0: rayT = RayType.Direction; break; case 1: rayT = RayType.VReflection; break; case 2: rayT = RayType.HReflection; break; case 3: rayT = RayType.HDiffraction; break; case 4: rayT = RayType.VDiffraction; break; } // //射线段读入内存结构时,将射线段的起点和终点也读进来,jinhj NodeInfo ni = new NodeInfo(cellID, Gxid, Gyid, trajID, rayT, distance, Angle, attenuation, RecePwrW, pointOfIncidence, crossPoint); // 射线经过各场景的距离 string[] scenArr = scen.Split(';'); int n = scenArr.Count(); ni.trajScen = new double[n]; for (int j = 0; j < n; j++) { ni.trajScen[j] = Convert.ToDouble(scenArr[j]) * distance; } ni.endPointScen = ptScen; string key = string.Format("{0},{1},{2}", cellID, Gxid, Gyid); if (rayDic.Keys.Contains(key)) // 存在 rayDic[key] { if (rayDic[key].traj.Keys.Contains(trajID)) // 存在 rayDic[key].traj[trajID] { rayDic[key].traj[trajID].rayList.Add(ni); if (EmitPwrW != 0) // 射线轨迹的第一段 { rayDic[key].traj[trajID].emitPwrW = EmitPwrW; } if (ni.recePwr != 0) // 射线轨迹的最后一段 { rayDic[key].traj[trajID].recePwrW = ni.recePwr; rayDic[key].sumReceivePwrW += ni.recePwr; } } else { RayInfo rays = new RayInfo(); rays.rayList.Add(ni); rayDic[key].traj[trajID] = rays; if (EmitPwrW != 0) // 射线轨迹的第一段 { rayDic[key].traj[trajID].emitPwrW = EmitPwrW; } if (ni.recePwr != 0) // 射线轨迹的最后一段 { rayDic[key].traj[trajID].recePwrW = ni.recePwr; rayDic[key].sumReceivePwrW += ni.recePwr; } } } else { RayInfo rays = new RayInfo(); rays.rayList.Add(ni); TrajInfo ti = new TrajInfo(); ti.traj[trajID] = rays; rayDic[key] = ti; if (EmitPwrW != 0) // 射线轨迹的第一段 { rayDic[key].traj[trajID].emitPwrW = EmitPwrW; } if (ni.recePwr != 0) // 射线轨迹的最后一段 { rayDic[key].traj[trajID].recePwrW = ni.recePwr; rayDic[key].sumReceivePwrW += ni.recePwr; } } } } foreach (string key in rayDic.Keys) { rayDic[key].sumPwrDbm = ConvertUtil.convertw2dbm(rayDic[key].sumReceivePwrW); } return(rayDic); }