Пример #1
0
        /// <summary>
        /// 构造小区的一个立体覆盖网格
        /// </summary>
        /// <param name="cellName"></param>
        /// <param name="lac"></param>
        /// <param name="ci"></param>
        /// <param name="gxid"></param>
        /// <param name="gyid"></param>
        /// <param name="level"></param>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <param name="z"></param>
        /// <param name="recePower"></param>
        /// <param name="pathLoss"></param>
        public void constructGrid3D(string cellName, int lac, int ci, int gxid, int gyid, int level, double x1, double y1, double x2, double y2, double z, double recePower, double pathLoss)
        {
            IDataset   dataset   = (IDataset)pFeatureLayer.FeatureClass;
            IWorkspace workspace = dataset.Workspace;
            //Cast for an IWorkspaceEdit
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            //start an edit session and operation
            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;

            Geometric.Point p   = GridHelper.getInstance().GridToGeo(gxid, gyid);
            double          lon = p.X;
            double          lat = p.Y;

            IPoint pointA = GeometryUtilities.ConstructPoint3D(x1, y1, z);
            IPoint pointB = GeometryUtilities.ConstructPoint3D(x2, y1, z);
            IPoint pointC = GeometryUtilities.ConstructPoint3D(x2, y2, z);
            IPoint pointD = GeometryUtilities.ConstructPoint3D(x1, y2, z);

            IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { pointA, pointB, pointC, pointD });

            pFeatureBuffer       = pFeatureClass.CreateFeatureBuffer();
            pFeatureBuffer.Shape = pGeometryColl as IGeometry;
            pFeatureBuffer.set_Value(this.GXIDIndex, gxid);
            pFeatureBuffer.set_Value(this.GYIDIndex, gyid);
            pFeatureBuffer.set_Value(this.LevelIndex, level);
            pFeatureBuffer.set_Value(this.eNodeBIndex, lac);
            pFeatureBuffer.set_Value(this.CIIndex, ci);
            pFeatureBuffer.set_Value(this.cellNameIndex, cellName);
            pFeatureBuffer.set_Value(this.RecePowerIndex, recePower);
            pFeatureBuffer.set_Value(this.PathLossIndex, pathLoss);
            pFeatureBuffer.set_Value(this.LongitudeIndex, lon);
            pFeatureBuffer.set_Value(this.LatitudeIndex, lat);

            pFeatureCursor.InsertFeature(pFeatureBuffer);

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            //IFeatureClassManage pFeatureClassManage = (IFeatureClassManage)pFeatureClass;
            //pFeatureClassManage.UpdateExtent();

            GISMapApplication.Instance.RefreshLayer(pFeatureLayer);
            //GISMapApplication.Instance.FullExtent(pFeatureLayer.AreaOfInterest);
        }
        /// <summary>
        /// 构造小区的一个网格
        /// </summary>
        /// <param name="cellName"></param>
        /// <param name="gxid"></param>
        /// <param name="gyid"></param>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <param name="recePower"></param>
        /// <param name="pathLoss"></param>
        public void constructGrid(string cellName, int enodeb, int ci, int gxid, int gyid, double x1, double y1, double x2, double y2, double recePower, double pathLoss)
        {
            IDataset       dataset       = (IDataset)pFeatureLayer.FeatureClass;
            IWorkspace     workspace     = dataset.Workspace;
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;

            IPoint pointA = GeometryUtilities.ConstructPoint2D(x1, y1);
            IPoint pointB = GeometryUtilities.ConstructPoint2D(x2, y1);
            IPoint pointC = GeometryUtilities.ConstructPoint2D(x2, y2);
            IPoint pointD = GeometryUtilities.ConstructPoint2D(x1, y2);

            IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { pointA, pointB, pointC, pointD });

            pFeatureBuffer       = pFeatureClass.CreateFeatureBuffer();
            pFeatureBuffer.Shape = pGeometryColl as IGeometry;
            pFeatureBuffer.set_Value(this.GXIDIndex, gxid);
            pFeatureBuffer.set_Value(this.GYIDIndex, gyid);
            pFeatureBuffer.set_Value(this.eNodeBIndex, enodeb);
            pFeatureBuffer.set_Value(this.CIIndex, ci);
            pFeatureBuffer.set_Value(this.cellNameIndex, cellName);
            pFeatureBuffer.set_Value(this.RecePowerIndex, recePower);
            pFeatureBuffer.set_Value(this.PathLossIndex, pathLoss);
            pFeatureCursor.InsertFeature(pFeatureBuffer);

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            IFeatureClassManage pFeatureClassManage = (IFeatureClassManage)pFeatureClass;

            pFeatureClassManage.UpdateExtent();

            //GISMapApplication.Instance.RefreshLayer(pFeatureLayer);
            //GISMapApplication.Instance.FullExtent(pFeatureLayer.AreaOfInterest);
        }
Пример #3
0
        /// <summary>
        /// 根据不同的参数显示DT数据
        /// </summary>
        /// <param name="btsname">是否显示某指定基站的路测数据,是则参数为具体BTSname,否则为""</param>
        /// <param name="distance">约束显示的路测点与其基站距离在distance范围内,无约束distance值小于0</param>
        /// <param name="minx">获取指定范围内的路测点,如果没有该约束,则值为负</param>
        /// <param name="miny"></param>
        /// <param name="maxx"></param>
        /// <param name="maxy"></param>
        /// <returns></returns>
        public bool constuctDTGrids(string btsname, double distance, double minx, double miny, double maxx, double maxy)
        {
            DataTable dtinfo = new DataTable();
            Hashtable ht     = new Hashtable();

            ht["btsname"]  = btsname;
            ht["distance"] = distance;

            if (distance < 0 && btsname == "")
            {
                if (minx < 1 || miny < 1 || maxx < 1 || maxy < 1)
                {
                    Debug.WriteLine("无限制");
                    dtinfo = IbatisHelper.ExecuteQueryForDataTable("GetDTInfo", null);
                }
                else
                {
                    ht["minx"] = minx;
                    ht["miny"] = miny;
                    ht["maxx"] = maxx;
                    ht["maxy"] = maxy;
                    dtinfo     = IbatisHelper.ExecuteQueryForDataTable("GetDTByRangeXY", ht);
                }
            }
            else if (distance > 0 && btsname == "")//只记录与目标距离少于dis的dt数据
            {
                Debug.WriteLine("限制距离" + btsname);
                dtinfo = IbatisHelper.ExecuteQueryForDataTable("GetDTInfoWithDis", ht);
            }
            else if (distance < 1)//只获取指定bts的路测
            {
                Debug.WriteLine("限制Bts");
                dtinfo = IbatisHelper.ExecuteQueryForDataTable("GetDTInfoWithBts", ht);
            }
            else//两个约束都有
            {
                Debug.WriteLine("限制Bts&&dis");
                dtinfo = IbatisHelper.ExecuteQueryForDataTable("GetDTInfoWithBoth", ht);
            }
            if (dtinfo.Rows.Count < 1)
            {
                return(false);
            }

            IDataset       dataset       = (IDataset)pFeatureLayer.FeatureClass;
            IWorkspace     workspace     = dataset.Workspace;
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;

            double x, y;
            double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
            double RSRP, SINR;
            int    ID;
            //int ID, PCI, eNodeB;
            //循环添加
            int      i        = 0;
            LoadInfo loadInfo = new LoadInfo();

            loadInfo.count = dtinfo.Rows.Count;
            loadInfo.loadCreate();
            foreach (DataRow dataRow in dtinfo.Rows)
            {
                if (i++ % 1000 == 0)
                {
                    loadInfo.cnt = i;
                    loadInfo.loadUpdate();
                    Console.WriteLine("已计算  " + i + "/" + dtinfo.Rows.Count);
                }
                if (!(double.TryParse(dataRow["x"].ToString(), out x) &&
                      double.TryParse(dataRow["y"].ToString(), out y) &&
                      int.TryParse(dataRow["ID"].ToString(), out ID)
                      //&& int.TryParse(dataRow["PCI"].ToString(), out PCI)
                      //&& int.TryParse(dataRow["eNodeBID"].ToString(), out eNodeB)
                      && double.TryParse(dataRow["SINR"].ToString(), out SINR) &&
                      double.TryParse(dataRow["RSRP"].ToString(), out RSRP)))
                {
                    continue;
                }

                if (!GridHelper.getInstance().XYGetGridXY(x, y, ref x1, ref y1, ref x2, ref y2))
                {
                    //不在该范围内
                    continue;
                }
                //根据x,y所在栅格,计算所在栅格的最大最小坐标
                IPoint pointA = GeometryUtilities.ConstructPoint2D(x1, y1);
                IPoint pointB = GeometryUtilities.ConstructPoint2D(x2, y1);
                IPoint pointC = GeometryUtilities.ConstructPoint2D(x2, y2);
                IPoint pointD = GeometryUtilities.ConstructPoint2D(x1, y2);

                IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { pointA, pointB, pointC, pointD });

                pFeatureBuffer       = pFeatureClass.CreateFeatureBuffer();
                pFeatureBuffer.Shape = pGeometryColl as IGeometry;
                pFeatureBuffer.set_Value(this.IdIndex, ID);
                pFeatureBuffer.set_Value(this.DeviceIndex, dataRow["Device"].ToString());
                pFeatureBuffer.set_Value(this.xIndex, x);
                pFeatureBuffer.set_Value(this.yIndex, y);
                pFeatureBuffer.set_Value(this.RSRPIndex, RSRP);
                pFeatureBuffer.set_Value(this.SINRIndex, SINR);
                //pFeatureBuffer.set_Value(this.eNodeBIndex, eNodeB);
                //pFeatureBuffer.set_Value(this.BtsnameIndex, dataRow["Btsname"].ToString());
                //pFeatureBuffer.set_Value(this.PCIIndex, PCI);
                pFeatureCursor.InsertFeature(pFeatureBuffer);
            }

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            GISMapApplication.Instance.RefreshLayer(pFeatureLayer);
            loadInfo.cnt = i;
            loadInfo.loadUpdate();
            return(true);
        }
Пример #4
0
        /// <summary>
        /// 构造 TIN 面
        /// </summary>
        public bool constuctTIN()
        {
            double minX = 0, minY = 0, maxX = 0, maxY = 0;

            InternalInterference.Grid.GridHelper.getInstance().getMinXY(ref minX, ref minY);
            InternalInterference.Grid.GridHelper.getInstance().getMaxXY(ref maxX, ref maxY);

            Hashtable ht = new Hashtable();

            ht["minX"] = minX;
            ht["maxX"] = maxX;
            ht["minY"] = minY;
            ht["maxY"] = maxY;
            DataTable gridTable = IbatisHelper.ExecuteQueryForDataTable("GetTINVertexByArea", ht);

            if (gridTable.Rows.Count < 1)
            {
                return(false);
            }

            IDataset       dataset       = (IDataset)pFeatureLayer.FeatureClass;
            IWorkspace     workspace     = dataset.Workspace;
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;

            float         x, y, z;
            List <IPoint> pts = new List <IPoint>();
            //循环添加
            int cnt = 0;
            //初始化进度信息
            LoadInfo loadInfo = new LoadInfo();

            loadInfo.count = gridTable.Rows.Count;
            loadInfo.loadCreate();
            //循环添加
            foreach (DataRow dataRow in gridTable.Rows)
            {
                if (cnt++ % 1000 == 0)
                {
                    loadInfo.cnt = cnt;
                    loadInfo.loadUpdate();
                    Console.WriteLine("已计算  " + cnt + "/" + gridTable.Rows.Count);
                }
                if (!(float.TryParse(dataRow["VertexX"].ToString(), out x) && float.TryParse(dataRow["VertexY"].ToString(), out y) && float.TryParse(dataRow["VertexHeight"].ToString(), out z)))
                {
                    continue;
                }

                IPoint pointA = GeometryUtilities.ConstructPoint3D(x, y, z);
                pts.Add(pointA);

                if (pts.Count >= 3)
                {
                    IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { pts[0], pts[1], pts[2] });
                    GeometryUtilities.MakeZAware(pGeometryColl as IGeometry);
                    pFeatureBuffer       = pFeatureClass.CreateFeatureBuffer();
                    pFeatureBuffer.Shape = pGeometryColl as IGeometry;
                    PointConvert.Instance.GetGeoPoint(pts[0]);
                    PointConvert.Instance.GetGeoPoint(pts[1]);
                    PointConvert.Instance.GetGeoPoint(pts[2]);
                    pFeatureBuffer.set_Value(this.point1Index, string.Format("{0},{1},{2}", pts[0].X, pts[0].Y, pts[0].Z));
                    pFeatureBuffer.set_Value(this.point2Index, string.Format("{0},{1},{2}", pts[1].X, pts[1].Y, pts[1].Z));
                    pFeatureBuffer.set_Value(this.point3Index, string.Format("{0},{1},{2}", pts[2].X, pts[2].Y, pts[2].Z));

                    pFeatureCursor.InsertFeature(pFeatureBuffer);
                    pts.Clear();
                }
            }

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            IFeatureClassManage pFeatureClassManage = (IFeatureClassManage)pFeatureClass;

            pFeatureClassManage.UpdateExtent();

            //GISMapApplication.Instance.RefreshLayer(pFeatureLayer);

            System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureClassManage);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(dataset);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(workspace);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);

            //更新完成进度信息
            loadInfo.cnt = cnt;
            loadInfo.loadUpdate();
            return(true);
        }
        /// <summary>
        /// 区域覆盖
        /// </summary>
        /// <param name="mingxid"></param>
        /// <param name="mingyid"></param>
        /// <param name="maxgxid"></param>
        /// <param name="maxgyid"></param>
        public bool constuctAreaGrids(int mingxid, int mingyid, int maxgxid, int maxgyid, string layerName)
        {
            DataTable gridTable = new DataTable();
            Hashtable ht        = new Hashtable();

            ht["MinGXID"] = mingxid;
            ht["MaxGXID"] = maxgxid;
            ht["MinGYID"] = mingyid;
            ht["MaxGYID"] = maxgyid;
            gridTable     = IbatisHelper.ExecuteQueryForDataTable("GetSpecifiedAreaGrids", ht);
            if (gridTable.Rows.Count < 1)
            {
                return(false);
            }

            /*
             *<select id="GetSpecifiedAreaGrids" parameterClass="Hashtable">
             *          select a.GXID, a.GYID, a.eNodeB, a.CI, d.MinLong, d.MinLat, d.MaxLong, d.MaxLat, a.ReceivedPowerdbm, a.PathLoss from tbGridPathloss a ,
             *          (select c.GXID, c.GYID, c.eNodeB, c.CI, max(c.ReceivedPowerdbm) ReceivedPowerdbm from tbGridPathloss c where c.GXID between '$MinGXID$' and '$MaxGXID$' and c.GYID between '$MinGYID$' and '$MaxGYID$'  group by c.gxid, c.gyid, c.eNodeB, c.ci having max(c.ReceivedPowerdbm) > -130 ) b,
             *          tbGridDem d
             *          where a.gxid = b.gxid and a.gyid = b.gyid and a.eNodeB = b.eNodeB and a.ci = b.ci and a.gxid = d.gxid and a.gyid = d.gyid
             *      </select>
             */
            IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();
            IFeatureClass     fclass           = featureWorkspace.OpenFeatureClass(layerName);

            //IFeatureLayer flayer = new FeatureLayer();
            pFeatureLayer.FeatureClass = pFeatureClass;

            //IFeatureLayer flayer = GISMapApplication.Instance.GetLayer(LayerNames.AreaCoverGrids) as IFeatureLayer;
            //FeatureUtilities.DeleteFeatureLayerFeatrues(flayer);

            //IFeatureClass fclass = flayer.FeatureClass;

            IDataset   dataset   = (IDataset)fclass;
            IWorkspace workspace = dataset.Workspace;
            //Cast for an IWorkspaceEdit
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            //start an edit session and operation
            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = fclass.Insert(true);
            IFeatureBuffer pFeatureBuffer;

            //int gxid, gyid, lac, ci;
            //float x1, y1, x2, y2;
            //float recePower, pathLoss;
            int    lac, ci, gxid, gyid, level;
            double x1, y1, x2, y2, z;
            double recePower, pathLoss;
            double gbaseheight = GridHelper.getInstance().getGBaseHeight();
            double gheight     = GridHelper.getInstance().getGHeight();

            //循环添加
            int cnt = 0;

            //循环添加
            foreach (DataRow dataRow in gridTable.Rows)
            {
                if (cnt++ % 1000 == 0)
                {
                    Console.WriteLine("已计算  " + cnt + "/" + gridTable.Rows.Count);
                }
                gxid  = int.Parse(dataRow["GXID"].ToString());
                gyid  = int.Parse(dataRow["GYID"].ToString());
                level = int.Parse(dataRow["Level"].ToString());
                Geometric.Point p   = GridHelper.getInstance().GridToGeo(gxid, gyid);
                double          lon = p.X;
                double          lat = p.Y;
                //lac = int.Parse(dataRow["eNodeB"].ToString());
                //ci = int.Parse(dataRow["CI"].ToString());
                recePower = double.Parse(dataRow["ReceivedPowerdbm"].ToString());
                pathLoss  = double.Parse(dataRow["PathLoss"].ToString());

                if (!(double.TryParse(dataRow["MinX"].ToString(), out x1) &&
                      double.TryParse(dataRow["MinY"].ToString(), out y1) &&
                      double.TryParse(dataRow["MaxX"].ToString(), out x2) &&
                      double.TryParse(dataRow["MaxY"].ToString(), out y2)))
                {
                    continue;
                }

                z = gheight * (level - 1) + gbaseheight;

                IPoint pointA = GeometryUtilities.ConstructPoint3D(x1, y1, z);
                IPoint pointB = GeometryUtilities.ConstructPoint3D(x2, y1, z);
                IPoint pointC = GeometryUtilities.ConstructPoint3D(x2, y2, z);
                IPoint pointD = GeometryUtilities.ConstructPoint3D(x1, y2, z);

                IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { pointA, pointB, pointC, pointD });
                GeometryUtilities.MakeZAware(pGeometryColl as IGeometry);

                pFeatureBuffer       = pFeatureClass.CreateFeatureBuffer();
                pFeatureBuffer.Shape = pGeometryColl as IGeometry;
                pFeatureBuffer.set_Value(this.GXIDIndex, gxid);
                pFeatureBuffer.set_Value(this.GYIDIndex, gyid);
                pFeatureBuffer.set_Value(this.eNodeBIndex, 0);
                pFeatureBuffer.set_Value(this.CIIndex, 0);
                pFeatureBuffer.set_Value(this.cellNameIndex, "");
                pFeatureBuffer.set_Value(this.LongitudeIndex, lon);
                pFeatureBuffer.set_Value(this.LatitudeIndex, lat);
                pFeatureBuffer.set_Value(this.LevelIndex, level);
                if (recePower > -41)
                {
                    pFeatureBuffer.set_Value(this.RecePowerIndex, -41);
                }
                //else if(recePower < -110)
                //    pFeatureBuffer.set_Value(this.RecePowerIndex, -110);
                else
                {
                    pFeatureBuffer.set_Value(this.RecePowerIndex, recePower);
                }
                pFeatureBuffer.set_Value(this.PathLossIndex, pathLoss);
                pFeatureCursor.InsertFeature(pFeatureBuffer);
            }

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            IFeatureClassManage pFeatureClassManage = (IFeatureClassManage)pFeatureClass;

            pFeatureClassManage.UpdateExtent();

            System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureClassManage);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(dataset);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(workspace);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);

            //GISMapApplication.Instance.RefreshLayer(pFeatureLayer);
            return(true);
        }
        /// <summary>
        /// 构造小区覆盖网格
        /// </summary>
        /// <param name="cellname"></param>
        /// <param name="enodeb"></param>
        /// <param name="ci"></param>
        public bool constuctCellGrids(string cellname, int enodeb, int ci)
        {
            DataTable gridTable = new DataTable();
            Hashtable ht        = new Hashtable();

            ht["eNodeB"] = enodeb;
            ht["CI"]     = ci;
            gridTable    = IbatisHelper.ExecuteQueryForDataTable("GetSpecifiedCellGrids", ht);
            if (gridTable.Rows.Count < 1)
            {
                return(false);
            }

            IDataset       dataset       = (IDataset)pFeatureLayer.FeatureClass;
            IWorkspace     workspace     = dataset.Workspace;
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;

            int    gxid, gyid, level;
            double x1, y1, x2, y2, z;
            double recePower, pathLoss;
            double gheight = GridHelper.getInstance().getGHeight();
            //循环添加
            int cnt = 0;
            //初始化进度信息
            LoadInfo loadInfo = new LoadInfo();

            loadInfo.count = gridTable.Rows.Count;
            loadInfo.loadCreate();

            foreach (DataRow dataRow in gridTable.Rows)
            {
                if (cnt++ % 1000 == 0)
                {
                    loadInfo.cnt = cnt;
                    loadInfo.loadUpdate();
                    Console.WriteLine("已计算  " + cnt + "/" + gridTable.Rows.Count);
                }
                gxid  = int.Parse(dataRow["Gxid"].ToString());
                gyid  = int.Parse(dataRow["Gyid"].ToString());
                level = int.Parse(dataRow["Level"].ToString());

                Geometric.Point p   = GridHelper.getInstance().GridToGeo(gxid, gyid);
                double          lon = p.X;
                double          lat = p.Y;

                //if (!(float.TryParse(dataRow["MinX"].ToString(), out x1) && float.TryParse(dataRow["MinY"].ToString(), out y1) && float.TryParse(dataRow["MaxX"].ToString(), out x2) && float.TryParse(dataRow["MaxY"].ToString(), out y2) && float.TryParse(dataRow["ReceivedPowerdbm"].ToString(), out recePower) && float.TryParse(dataRow["PathLoss"].ToString(), out pathLoss)))
                //    continue;

                if (!(double.TryParse(dataRow["MinX"].ToString(), out x1) && double.TryParse(dataRow["MinY"].ToString(), out y1)))
                {
                    continue;
                }
                if (!(double.TryParse(dataRow["MaxX"].ToString(), out x2) && double.TryParse(dataRow["MaxY"].ToString(), out y2)))
                {
                    continue;
                }
                if (!(double.TryParse(dataRow["ReceivedPowerdbm"].ToString(), out recePower) && double.TryParse(dataRow["PathLoss"].ToString(), out pathLoss)))
                {
                    continue;
                }
                z = gheight * level;

                IPoint pointA = GeometryUtilities.ConstructPoint3D(x1, y1, z);
                IPoint pointB = GeometryUtilities.ConstructPoint3D(x2, y1, z);
                IPoint pointC = GeometryUtilities.ConstructPoint3D(x2, y2, z);
                IPoint pointD = GeometryUtilities.ConstructPoint3D(x1, y2, z);

                IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { pointA, pointB, pointC, pointD });
                GeometryUtilities.MakeZAware(pGeometryColl as IGeometry);

                pFeatureBuffer       = pFeatureClass.CreateFeatureBuffer();
                pFeatureBuffer.Shape = pGeometryColl as IGeometry;
                pFeatureBuffer.set_Value(this.GXIDIndex, gxid);
                pFeatureBuffer.set_Value(this.GYIDIndex, gyid);
                pFeatureBuffer.set_Value(this.eNodeBIndex, enodeb);
                pFeatureBuffer.set_Value(this.CIIndex, ci);
                pFeatureBuffer.set_Value(this.cellNameIndex, cellname);
                pFeatureBuffer.set_Value(this.LevelIndex, level);
                pFeatureBuffer.set_Value(this.LongitudeIndex, lon);
                pFeatureBuffer.set_Value(this.LatitudeIndex, lat);


                if (recePower > -41)
                {
                    pFeatureBuffer.set_Value(this.RecePowerIndex, -41);
                }
                //else if(recePower < -110)
                //    pFeatureBuffer.set_Value(this.RecePowerIndex, -110);
                else
                {
                    pFeatureBuffer.set_Value(this.RecePowerIndex, recePower);
                }
                pFeatureBuffer.set_Value(this.PathLossIndex, pathLoss);
                pFeatureCursor.InsertFeature(pFeatureBuffer);

                //释放AO对象
                System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureBuffer);
                System.Runtime.InteropServices.Marshal.ReleaseComObject(pGeometryColl);
            }

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            IFeatureClassManage pFeatureClassManage = (IFeatureClassManage)pFeatureClass;

            pFeatureClassManage.UpdateExtent();

            System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureClassManage);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(dataset);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(workspace);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);

            //更新完成进度信息
            loadInfo.cnt = cnt;
            loadInfo.loadUpdate();
            //GISMapApplication.Instance.RefreshLayer(pFeatureLayer);
            return(true);
        }
Пример #7
0
        public bool constuctGrid3Ds(int mingxid, int maxgxid, int mingyid, int maxgyid, short type)
        {
            DataTable gridTable = new DataTable();
            Hashtable para      = new Hashtable();

            para["minGXID"] = mingxid;
            para["maxGXID"] = maxgxid;
            para["minGYID"] = mingyid;
            para["maxGYID"] = maxgyid;
            para["type"]    = type;

            gridTable = IbatisHelper.ExecuteQueryForDataTable("getDefect", para);
            if (gridTable.Rows.Count < 1)
            {
                return(false);
            }

            IDataset   dataset   = (IDataset)pFeatureLayer.FeatureClass;
            IWorkspace workspace = dataset.Workspace;
            //Cast for an IWorkspaceEdit
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            //start an edit session and operation
            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;

            int    gxid, gyid, level;
            double x1, y1, x2, y2, z;
            double recePower;
            double gbaseheight = GridHelper.getInstance().getGBaseHeight();
            double gheight     = GridHelper.getInstance().getGHeight();
            //循环添加
            int cnt = 0;

            foreach (DataRow dataRow in gridTable.Rows)
            {
                if (++cnt % 100 == 0)
                {
                    Console.WriteLine(cnt + "/" + gridTable.Rows.Count);
                }
                gxid  = int.Parse(dataRow["GXID"].ToString());
                gyid  = int.Parse(dataRow["GYID"].ToString());
                level = int.Parse(dataRow["GZID"].ToString());

                if (!(double.TryParse(dataRow["MinX"].ToString(), out x1) && double.TryParse(dataRow["MinY"].ToString(), out y1)))
                {
                    continue;
                }
                if (!(double.TryParse(dataRow["MaxX"].ToString(), out x2) && double.TryParse(dataRow["MaxY"].ToString(), out y2)))
                {
                    continue;
                }
                if (!(double.TryParse(dataRow["ReceivedPowerdbm"].ToString(), out recePower)))
                {
                    continue;
                }
                z = gheight * level;

                IPoint pointA = GeometryUtilities.ConstructPoint3D(x1, y1, z);
                IPoint pointB = GeometryUtilities.ConstructPoint3D(x2, y1, z);
                IPoint pointC = GeometryUtilities.ConstructPoint3D(x2, y2, z);
                IPoint pointD = GeometryUtilities.ConstructPoint3D(x1, y2, z);

                IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { pointA, pointB, pointC, pointD });
                GeometryUtilities.MakeZAware(pGeometryColl as IGeometry);


                pFeatureBuffer       = pFeatureClass.CreateFeatureBuffer();
                pFeatureBuffer.Shape = pGeometryColl as IGeometry;
                pFeatureBuffer.set_Value(this.GXIDIndex, gxid);
                pFeatureBuffer.set_Value(this.GYIDIndex, gyid);
                pFeatureBuffer.set_Value(this.LevelIndex, level);

                if (recePower > -41)
                {
                    pFeatureBuffer.set_Value(this.RecePowerIndex, -41);
                }
                else
                {
                    pFeatureBuffer.set_Value(this.RecePowerIndex, recePower);
                }
                pFeatureCursor.InsertFeature(pFeatureBuffer);
            }

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            //IFeatureClassManage pFeatureClassManage = (IFeatureClassManage)pFeatureClass;
            //pFeatureClassManage.UpdateExtent();

            System.Runtime.InteropServices.Marshal.ReleaseComObject(dataset);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(workspace);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);

            //GISMapApplication.Instance.RefreshLayer(pFeatureLayer);
            return(true);
        }
Пример #8
0
        /// <summary>
        /// 构造小区立体顶面覆盖网格
        /// </summary>
        /// <param name="cellname"></param>
        /// <param name="lac"></param>
        /// <param name="ci"></param>
        public void constuctCellGrid3Dtops(string cellname, int eNodeB, int ci)
        {
            DataTable gridTable = new DataTable();
            Hashtable ht        = new Hashtable();

            ht["eNodeB"] = eNodeB;
            ht["CI"]     = ci;
            gridTable    = IbatisHelper.ExecuteQueryForDataTable("GetSpecifiedCellGrid3Ds", ht);
            //gridTable = IbatisHelper.ExecuteQueryForDataTable("GetAreaGrid3Ds", null);

            IDataset   dataset   = (IDataset)pFeatureLayer.FeatureClass;
            IWorkspace workspace = dataset.Workspace;
            //Cast for an IWorkspaceEdit
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            //start an edit session and operation
            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;

            int    gxid, gyid, level;
            double x1, y1, x2, y2, z;
            double recePower, pathLoss;
            double gbaseheight = GridHelper.getInstance().getGBaseHeight();
            double gheight     = GridHelper.getInstance().getGHeight();

            //循环添加
            foreach (DataRow dataRow in gridTable.Rows)
            {
                gxid  = int.Parse(dataRow["Gxid"].ToString());
                gyid  = int.Parse(dataRow["Gyid"].ToString());
                level = int.Parse(dataRow["level"].ToString());
                Geometric.Point p   = GridHelper.getInstance().GridToGeo(gxid, gyid);
                double          lon = p.X;
                double          lat = p.Y;
                if (!(double.TryParse(dataRow["MinX"].ToString(), out x1) && double.TryParse(dataRow["MinY"].ToString(), out y1) && double.TryParse(dataRow["MaxX"].ToString(), out x2) && double.TryParse(dataRow["MaxY"].ToString(), out y2) && double.TryParse(dataRow["ReceivedPowerdbm"].ToString(), out recePower) && double.TryParse(dataRow["PathLoss"].ToString(), out pathLoss)))
                {
                    continue;
                }
                z = gheight * (level - 1) + gbaseheight;

                IPoint pointA = GeometryUtilities.ConstructPoint3D(x1, y1, z);
                IPoint pointB = GeometryUtilities.ConstructPoint3D(x2, y1, z);
                IPoint pointC = GeometryUtilities.ConstructPoint3D(x2, y2, z);
                IPoint pointD = GeometryUtilities.ConstructPoint3D(x1, y2, z);

                IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { pointA, pointB, pointC, pointD });
                GeometryUtilities.MakeZAware(pGeometryColl as IGeometry);


                pFeatureBuffer       = pFeatureClass.CreateFeatureBuffer();
                pFeatureBuffer.Shape = pGeometryColl as IGeometry;
                pFeatureBuffer.set_Value(this.GXIDIndex, gxid);
                pFeatureBuffer.set_Value(this.GYIDIndex, gyid);
                pFeatureBuffer.set_Value(this.LevelIndex, level);
                pFeatureBuffer.set_Value(this.eNodeBIndex, eNodeB);
                pFeatureBuffer.set_Value(this.CIIndex, ci);
                pFeatureBuffer.set_Value(this.cellNameIndex, cellname);
                pFeatureBuffer.set_Value(this.LongitudeIndex, lon);
                pFeatureBuffer.set_Value(this.LatitudeIndex, lat);
                if (recePower > -41)
                {
                    pFeatureBuffer.set_Value(this.RecePowerIndex, -41);
                }
                //else if (recePower < -110)
                //    pFeatureBuffer.set_Value(this.RecePowerIndex, -110);
                else
                {
                    pFeatureBuffer.set_Value(this.RecePowerIndex, recePower);
                }
                pFeatureBuffer.set_Value(this.PathLossIndex, pathLoss);
                pFeatureCursor.InsertFeature(pFeatureBuffer);
            }

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            //IFeatureClassManage pFeatureClassManage = (IFeatureClassManage)pFeatureClass;
            //pFeatureClassManage.UpdateExtent();

            GISMapApplication.Instance.RefreshLayer(pFeatureLayer);
            //GISMapApplication.Instance.FullExtent(pFeatureLayer.AreaOfInterest);
        }
Пример #9
0
        /// <summary>
        /// 刷新GSM900小区图层
        /// </summary>
        public bool RefreshGSM900Cell()
        {
            IList <CELL> GSM900CellData = IbatisHelper.ExecuteQueryForList <CELL>("GetGSM900CellLayerData", null);

            if (GSM900CellData.Count < 1)
            {
                return(false);
            }

            IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();
            IFeatureClass     pFeatureClass    = featureWorkspace.OpenFeatureClass(LayerNames.GSM900Cell);
            IFeatureLayer     pFeatureLayer    = new FeatureLayer();

            pFeatureLayer.FeatureClass = pFeatureClass;

            //IFeatureLayer pFeatureLayer = GISMapApplication.Instance.GetLayer(LayerNames.GSM900Cell) as IFeatureLayer;

            FeatureUtilities.DeleteFeatureLayerFeatrues(pFeatureLayer);

            //IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;

            #region 测试
            //设置字段
            //IField pField = new FieldClass();
            //IFieldEdit pFieldEdit = (IFieldEdit)pField;

            //添加新的zhcellname
            //pField = new FieldClass();
            //pFieldEdit = (IFieldEdit)pField;
            //pFieldEdit.Name_2 = System.DateTime.Now.Month.ToString()+System.DateTime.Now.Millisecond.ToString();
            //pFeatureClass.AddField(pField);

            //清除旧的field(从第三个开始删除,前面两个是必须字段,不能删除,第三个删除不了,下面作更新第三个)
            //while (pFeatureClass.Fields.FieldCount > 3)
            //{
            //    string fieldName = pFeatureClass.Fields.get_Field(2).Name;

            // FeatureUtilities.DeletField(pFeatureClass, fieldName);
            //}

            ////增加新的field

            ////因最后一个删除不了,这里作修改,cell_name
            //pField = new FieldClass();
            //pFieldEdit = (IFieldEdit)pField;
            //pFieldEdit.Name_2 = "cell_name";
            //pFeatureClass.AddField(pField);



            ////添加新的zhcellname
            //pField = new FieldClass();
            //pFieldEdit = (IFieldEdit)pField;
            //pFieldEdit.Name_2 = "zhcellname";
            //pFeatureClass.AddField(pField);

            ////添加新的longitude
            //pField = new FieldClass();
            //pFieldEdit = (IFieldEdit)pField;
            //pFieldEdit.Name_2 = "longitude";
            //pFeatureClass.AddField(pField);

            ////添加新的latitude
            //pField = new FieldClass();
            //pFieldEdit = (IFieldEdit)pField;
            //pFieldEdit.Name_2 = "latitude";
            //pFeatureClass.AddField(pField);

            ////添加新的height
            //pField = new FieldClass();
            //pFieldEdit = (IFieldEdit)pField;
            //pFieldEdit.Name_2 = "height";
            //pFeatureClass.AddField(pField);

            ////添加新的tilt
            //pField = new FieldClass();
            //pFieldEdit = (IFieldEdit)pField;
            //pFieldEdit.Name_2 = "tilt";
            //pFeatureClass.AddField(pField);
            #endregion 测试

            IDataset   dataset   = (IDataset)pFeatureClass;
            IWorkspace workspace = dataset.Workspace;
            //Cast for an IWorkspaceEdit
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;
            //start an edit session and operation
            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();


            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;


            //循环添加
            double circRadius = 60;//小区900生成的半径大小
            double every      = 1;

            foreach (CELL gsm900Cell in GSM900CellData)
            {
                if ((!gsm900Cell.x.HasValue) || (!gsm900Cell.y.HasValue) || (!gsm900Cell.AntHeight.HasValue) || (!gsm900Cell.Azimuth.HasValue) || (!gsm900Cell.Tilt.HasValue))
                {
                    continue;
                }
                int    lac         = gsm900Cell.eNodeB.Value;
                int    ci          = gsm900Cell.CI.Value;
                string cellName    = gsm900Cell.CellName;
                string cellNameChs = gsm900Cell.CellNameChs;
                double longitude   = Convert.ToDouble(gsm900Cell.Longitude.Value);
                double latitude    = Convert.ToDouble(gsm900Cell.Latitude.Value);
                double antHeight   = Convert.ToDouble(gsm900Cell.AntHeight.Value);
                double azimuth     = gsm900Cell.Azimuth.Value;
                double tilt        = gsm900Cell.Tilt.Value;
                int    EARFCN      = gsm900Cell.EARFCN.Value;
                double EIRP        = gsm900Cell.EIRP.Value;
                double radius      = gsm900Cell.CoverageRadius.Value;
                tilt = tilt > 0 ? tilt : 7;

                pFeatureBuffer = pFeatureClass.CreateFeatureBuffer();//创建图元缓冲

                double Direction = (450 - azimuth) % 360;

                double x          = Convert.ToDouble(gsm900Cell.x.Value);
                double y          = Convert.ToDouble(gsm900Cell.y.Value);
                IPoint startPoint = GeometryUtilities.ConstructPoint3D(x, y, antHeight);
                IPoint leftPoint  = GeometryUtilities.ConstructPoint3D(circRadius * Math.Cos((Direction - 18 * every) * Math.PI / 180) + x, y + circRadius * Math.Sin((Direction - 18 * every) * Math.PI / 180), antHeight);
                IPoint rightPoint = GeometryUtilities.ConstructPoint3D(circRadius * Math.Cos((Direction + 18 * every) * Math.PI / 180) + x, y + circRadius * Math.Sin((Direction + 9 * every) * Math.PI / 180), antHeight);

                IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { startPoint, leftPoint, rightPoint });
                GeometryUtilities.MakeZAware(pGeometryColl as IGeometry);

                pFeatureBuffer.Shape = pGeometryColl as IGeometry;
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("eNodeB"), lac);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("CI"), ci);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("CellName"), cellName);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("CellNameCN"), cellNameChs);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("Longitude"), longitude);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("Latitude"), latitude);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("AntHeight"), antHeight);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("Azimuth"), azimuth);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("EARFCN"), EARFCN);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("EIRP"), EIRP);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("Tilt"), tilt);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("Radius"), radius);
                pFeatureCursor.InsertFeature(pFeatureBuffer);
            }

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            //GISMapApplication.Instance.RefreshLayer(pFeatureLayer);
            //GISMapApplication.Instance.FullExtent(pFeatureLayer.AreaOfInterest);
            return(true);
        }
Пример #10
0
        /// <summary>
        /// 刷新GSM1800小区图层
        /// </summary>
        public void RefreshGSM1800Cell()
        {
            IList <CELL> GSM1800CellData = IbatisHelper.ExecuteQueryForList <CELL>("GetGSM1800CellLayerData", null);

            IFeatureLayer pFeatureLayer = GISMapApplication.Instance.GetLayer(LayerNames.GSM1800Cell) as IFeatureLayer;

            FeatureUtilities.DeleteFeatureLayerFeatrues(pFeatureLayer);

            IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;


            IDataset   dataset   = (IDataset)pFeatureClass;
            IWorkspace workspace = dataset.Workspace;
            //Cast for an IWorkspaceEdit
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            //start an edit session and operation
            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;

            //循环添加
            double circRadius = 0.00025;//小区1800生成的半径大小
            double every      = 1;


            foreach (CELL gsm1800Cell in GSM1800CellData)
            {
                if ((!gsm1800Cell.Longitude.HasValue) || (!gsm1800Cell.Latitude.HasValue) || (!gsm1800Cell.AntHeight.HasValue) || (!gsm1800Cell.Azimuth.HasValue) || (!gsm1800Cell.Tilt.HasValue))
                {
                    continue;
                }

                int    lac         = gsm1800Cell.eNodeB.Value;
                int    ci          = gsm1800Cell.CI.Value;
                string cellName    = gsm1800Cell.CellName;
                string cellNameChs = gsm1800Cell.CellNameChs;
                double longitude   = Convert.ToDouble(gsm1800Cell.Longitude.Value);
                double latitude    = Convert.ToDouble(gsm1800Cell.Latitude.Value);
                double antHeight   = Convert.ToDouble(gsm1800Cell.AntHeight.Value);
                double azimuth     = gsm1800Cell.Azimuth.Value;
                double tilt        = gsm1800Cell.Tilt.Value;
                tilt = tilt > 0 ? tilt : 7;

                pFeatureBuffer = pFeatureClass.CreateFeatureBuffer();//创建图元缓冲

                double Direction = (450 - azimuth) % 360;

                IPoint startPoint = GeometryUtilities.ConstructPoint3D(longitude, latitude, antHeight);
                IPoint leftPoint  = GeometryUtilities.ConstructPoint3D(circRadius * Math.Cos((Direction - 18 * every) * Math.PI / 180) + longitude, latitude + circRadius * Math.Sin((Direction - 18 * every) * Math.PI / 180), antHeight);
                IPoint rightPoint = GeometryUtilities.ConstructPoint3D(circRadius * Math.Cos((Direction + 18 * every) * Math.PI / 180) + longitude, latitude + circRadius * Math.Sin((Direction + 9 * every) * Math.PI / 180), antHeight);

                //startPoint = PointConvert.Instance.GetProjectPoint(startPoint);
                //startPoint = GeometryUtilities.ConstructPoint3D(startPoint, antHeight);//增加高度
                //leftPoint = PointConvert.Instance.GetProjectPoint(leftPoint);
                //leftPoint = GeometryUtilities.ConstructPoint3D(leftPoint, antHeight);//增加高度
                //rightPoint = PointConvert.Instance.GetProjectPoint(rightPoint);
                //rightPoint = GeometryUtilities.ConstructPoint3D(rightPoint, antHeight);//增加高度

                IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { startPoint, leftPoint, rightPoint });
                GeometryUtilities.MakeZAware(pGeometryColl as IGeometry);

                pFeatureBuffer.Shape = pGeometryColl as IGeometry;
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("eNodeB"), lac);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("CI"), ci);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("CellName"), cellName);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("CellNameCN"), cellNameChs);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("Longitude"), longitude);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("Latitude"), latitude);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("AntHeight"), antHeight);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("Azimuth"), azimuth);
                pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("Tilt"), tilt);
                pFeatureCursor.InsertFeature(pFeatureBuffer);
            }

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            IFeatureClassManage pFeatureClassManage = (IFeatureClassManage)pFeatureClass;

            pFeatureClassManage.UpdateExtent();
            //GISMapApplication.Instance.RefreshLayer(pFeatureLayer);
        }
        /// <summary>
        /// 刷新虚拟干扰源图层
        /// </summary>
        public bool ConstuctSelectPoints(string fromname)
        {
            Hashtable ht = new Hashtable();

            ht["fromName"] = fromname;
            DataTable virTable = IbatisHelper.ExecuteQueryForDataTable("GetSelectedPoint", ht);

            if (virTable.Rows.Count < 2)
            {
                return(false);
            }
            IDataset   dataset   = (IDataset)pFeatureClass;
            IWorkspace workspace = dataset.Workspace;
            //Cast for an IWorkspaceEdit
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            //start an edit session and operation
            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;


            //循环添加
            double circRadius = 60;//扇区生成的半径大小
            double every      = 1;


            foreach (DataRow vir in virTable.Rows)
            {
                int    ci        = Convert.ToInt32(vir["CI"]);
                string fromName  = Convert.ToString(vir["fromName"]);
                double ReceivePW = Convert.ToDouble(vir["ReceivePW"]);
                double azimuth   = Convert.ToDouble(vir["Azimuth"]);



                pFeatureBuffer = pFeatureClass.CreateFeatureBuffer();//创建图元缓冲


                double x = Convert.ToDouble(vir["x"]);
                double y = Convert.ToDouble(vir["y"]);

                IPoint startPoint = GeometryUtilities.ConstructPoint3D(x, y, 0);

                LTE.Geometric.Point p = new Geometric.Point(x, y, 0);
                PointConvertByProj.Instance.GetGeoPoint(p);

                double Direction = (450 - azimuth) % 360;

                IPoint leftPoint  = GeometryUtilities.ConstructPoint3D(circRadius * Math.Cos((Direction - 18 * every) * Math.PI / 180) + x, y + circRadius * Math.Sin((Direction - 18 * every) * Math.PI / 180), 0);
                IPoint rightPoint = GeometryUtilities.ConstructPoint3D(circRadius * Math.Cos((Direction + 18 * every) * Math.PI / 180) + x, y + circRadius * Math.Sin((Direction + 9 * every) * Math.PI / 180), 0);

                IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { startPoint, leftPoint, rightPoint });
                GeometryUtilities.MakeZAware(pGeometryColl as IGeometry);

                ///暂时没添加经纬度

                pFeatureBuffer.Shape = pGeometryColl as IGeometry;
                pFeatureBuffer.set_Value(CIIndex, ci);
                pFeatureBuffer.set_Value(FromIndex, fromName);
                pFeatureBuffer.set_Value(AziIndex, azimuth);
                pFeatureBuffer.set_Value(LonIndex, p.X);
                pFeatureBuffer.set_Value(LatIndex, p.Y);
                pFeatureBuffer.set_Value(RecPwIndex, 10 * (Math.Log10(ReceivePW) + 3));
                pFeatureCursor.InsertFeature(pFeatureBuffer);
            }

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            GISMapApplication.Instance.RefreshLayer(pFeatureLayer);
            return(true);
            //GISMapApplication.Instance.FullExtent(pFeatureLayer.AreaOfInterest);
        }
        /// <summary>
        /// 建筑物  高度+海拔
        /// </summary>
        public bool constuctBuilding()
        {
            DataTable gridTable = IbatisHelper.ExecuteQueryForDataTable("getBuildingInfo", null);

            if (gridTable.Rows.Count < 1)
            {
                return(false);
            }

            IDataset       dataset       = (IDataset)pFeatureLayer.FeatureClass;
            IWorkspace     workspace     = dataset.Workspace;
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;

            List <IPoint> pts = new List <IPoint>();

            int    id       = Convert.ToInt32(gridTable.Rows[0]["BuildingID"]);
            double x        = Convert.ToDouble(gridTable.Rows[0]["VertexX"]);
            double y        = Convert.ToDouble(gridTable.Rows[0]["VertexY"]);
            double height   = Convert.ToDouble(gridTable.Rows[0]["BHeight"]);
            double altitude = Convert.ToDouble(gridTable.Rows[0]["BAltitude"]);
            IPoint pointA   = GeometryUtilities.ConstructPoint3D(x, y, 0);

            pts.Add(pointA);

            int lastid = id;

            //循环添加
            for (int i = 1; i < gridTable.Rows.Count; i++)
            {
                DataRow dataRow = gridTable.Rows[i];

                id = Convert.ToInt32(gridTable.Rows[i]["BuildingID"]);

                if (i == gridTable.Rows.Count - 1 || id != lastid)
                {
                    IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(pts);
                    GeometryUtilities.MakeZAware(pGeometryColl as IGeometry);
                    pFeatureBuffer       = pFeatureClass.CreateFeatureBuffer();
                    pFeatureBuffer.Shape = pGeometryColl as IGeometry;
                    pFeatureBuffer.set_Value(this.bidIndex, lastid);
                    pFeatureBuffer.set_Value(this.heightIndex, height + altitude);
                    pFeatureCursor.InsertFeature(pFeatureBuffer);

                    lastid = id;
                    pts.Clear();
                }

                x        = Convert.ToDouble(gridTable.Rows[i]["VertexX"]);
                y        = Convert.ToDouble(gridTable.Rows[i]["VertexY"]);
                height   = Convert.ToDouble(gridTable.Rows[i]["BHeight"]);
                altitude = Convert.ToDouble(gridTable.Rows[i]["BAltitude"]);
                pointA   = GeometryUtilities.ConstructPoint3D(x, y, 0);
                pts.Add(pointA);
            }

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            IFeatureClassManage pFeatureClassManage = (IFeatureClassManage)pFeatureClass;

            pFeatureClassManage.UpdateExtent();
            //GISMapApplication.Instance.RefreshLayer(pFeatureLayer);

            return(true);
        }
        public bool constuctGrid3Ds()
        {
            DataTable gridTable = IbatisHelper.ExecuteQueryForDataTable("GetInfSource", null);

            if (gridTable.Rows.Count < 1)
            {
                return(false);
            }

            IDataset   dataset   = (IDataset)pFeatureLayer.FeatureClass;
            IWorkspace workspace = dataset.Workspace;
            //Cast for an IWorkspaceEdit
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            //start an edit session and operation
            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();

            IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
            IFeatureBuffer pFeatureBuffer;

            int    gxid = 0, gyid = 0;
            double x, y, r = 10, x1, y1, x2, y2, z;

            //循环添加
            foreach (DataRow dataRow in gridTable.Rows)
            {
                x = double.Parse(dataRow["x"].ToString());
                y = double.Parse(dataRow["y"].ToString());
                z = double.Parse(dataRow["z"].ToString());

                GridHelper.getInstance().XYToGGrid(x, y, ref gxid, ref gyid);

                x1 = x - r;
                x2 = x + r;
                y1 = y - r;
                y2 = y + r;

                IPoint pointA = GeometryUtilities.ConstructPoint3D(x1, y1, z);
                IPoint pointB = GeometryUtilities.ConstructPoint3D(x2, y1, z);
                IPoint pointC = GeometryUtilities.ConstructPoint3D(x2, y2, z);
                IPoint pointD = GeometryUtilities.ConstructPoint3D(x1, y2, z);

                IGeometryCollection pGeometryColl = GeometryUtilities.ConstructPolygon(new IPoint[] { pointA, pointB, pointC, pointD });
                GeometryUtilities.MakeZAware(pGeometryColl as IGeometry);

                pFeatureBuffer       = pFeatureClass.CreateFeatureBuffer();
                pFeatureBuffer.Shape = pGeometryColl as IGeometry;
                pFeatureBuffer.set_Value(this.GXIDIndex, gxid);
                pFeatureBuffer.set_Value(this.GYIDIndex, gyid);
                pFeatureBuffer.set_Value(this.LevelIndex, z);

                pFeatureBuffer.set_Value(this.RecePowerIndex, -41);
                pFeatureCursor.InsertFeature(pFeatureBuffer);
            }

            //一次性提交
            pFeatureCursor.Flush();

            //stop editing
            workspaceEdit.StopEditOperation();
            workspaceEdit.StopEditing(true);

            IFeatureClassManage pFeatureClassManage = (IFeatureClassManage)pFeatureClass;

            pFeatureClassManage.UpdateExtent();

            //GISMapApplication.Instance.RefreshLayer(pFeatureLayer);
            return(true);
        }