// 列名
        public OperateCoverGirdLayer(string layerName)
        {
            IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();

            string path = System.Configuration.ConfigurationSettings.AppSettings["GisPath"].ToString();

            //若不存在shp文件,则创建
            if (!DefineLayer.findLayer(path, layerName))
            {
                //new CreateLayer(path, layerName).Test();
                new CreateLayer(path, layerName).CreateCoverLayer();
            }

            pFeatureClass = featureWorkspace.OpenFeatureClass(layerName);

            pFeatureLayer = new FeatureLayer();
            pFeatureLayer.FeatureClass = pFeatureClass;
            //int n = pFeatureClass.FeatureCount(new QueryFilterClass());

            //pFeatureLayer = GISMapApplication.Instance.GetLayer(LayerNames.CoverGrids) as IFeatureLayer;
            //pFeatureClass = pFeatureLayer.FeatureClass;
            this.RecePowerIndex = pFeatureClass.FindField("RecePower");
            this.PathLossIndex  = pFeatureClass.FindField("PathLoss");
            this.GXIDIndex      = pFeatureClass.FindField("GXID");
            this.GYIDIndex      = pFeatureClass.FindField("GYID");
            this.cellNameIndex  = pFeatureClass.FindField("CellName");
            this.eNodeBIndex    = pFeatureClass.FindField("eNodeB");
            this.CIIndex        = pFeatureClass.FindField("CI");
            this.LongitudeIndex = pFeatureClass.FindField("Longitude");
            this.LatitudeIndex  = pFeatureClass.FindField("Latitude");
            this.LevelIndex     = pFeatureClass.FindField("Level");
        }
Esempio n. 2
0
        public OperateDTLayer(string layerName)
        {
            IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();
            string            path             = System.Configuration.ConfigurationSettings.AppSettings["GisPath"].ToString();

            //若不存在shp文件,则创建
            if (!DefineLayer.findLayer(path, layerName))
            {
                new CreateLayer(path, layerName).CreateDTLayer();//目前有问题,但是理论上不需要新建
            }
            pFeatureClass = featureWorkspace.OpenFeatureClass(layerName);
            pFeatureLayer = new FeatureLayer();
            pFeatureLayer.FeatureClass = pFeatureClass;


            this.IdIndex     = pFeatureClass.FindField("Id");
            this.RSRPIndex   = pFeatureClass.FindField("RSRP");
            this.SINRIndex   = pFeatureClass.FindField("SINR");
            this.xIndex      = pFeatureClass.FindField("x");
            this.yIndex      = pFeatureClass.FindField("y");
            this.DeviceIndex = pFeatureClass.FindField("Device");
            //this.BtsnameIndex = pFeatureClass.FindField("Btsname");
            //this.eNodeBIndex = pFeatureClass.FindField("eNodeBID");
            //this.PCIIndex = pFeatureClass.FindField("PCI");
        }
        // 列名
        public OperateTINLayer(string layerName)
        {
            //IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();
            //IFeatureClass fclass = featureWorkspace.OpenFeatureClass(layerName);
            //IFeatureLayer flayer = new FeatureLayer();
            //pFeatureLayer.FeatureClass = pFeatureClass;

            IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();
            string            path             = System.Configuration.ConfigurationSettings.AppSettings["GisPath"].ToString();

            //若不存在shp文件,则创建
            if (!DefineLayer.findLayer(path, layerName))
            {
                new CreateLayer(path, layerName).CreateTinLayer();
            }
            pFeatureClass = featureWorkspace.OpenFeatureClass(layerName);
            pFeatureLayer = new FeatureLayer();
            pFeatureLayer.FeatureClass = pFeatureClass;
            this.point1Index           = pFeatureClass.FindField("point1");
            this.point2Index           = pFeatureClass.FindField("point2");
            this.point3Index           = pFeatureClass.FindField("point3");

            //pFeatureLayer = GISMapApplication.Instance.GetLayer(LayerNames.TIN) as IFeatureLayer;
            //pFeatureClass = pFeatureLayer.FeatureClass;
        }
Esempio n. 4
0
        public OperateDefectLayer(string name)
        {
            IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();

            string path = System.Configuration.ConfigurationSettings.AppSettings["GisPath"].ToString();

            //若不存在shp文件,则创建
            if (!DefineLayer.findLayer(path, name))
            {
                new CreateLayer(path, name).CreateDefectLayer();
            }

            //IFeatureClass pFeatureClass = featureWorkspace.OpenFeatureClass(name);
            //IFeatureLayer flayer = new FeatureLayer();
            //pFeatureLayer.FeatureClass = pFeatureClass;

            pFeatureClass = featureWorkspace.OpenFeatureClass(name);
            pFeatureLayer = new FeatureLayer();
            pFeatureLayer.FeatureClass = pFeatureClass;

            //pFeatureLayer = GISMapApplication.Instance.GetLayer(name) as IFeatureLayer;
            //pFeatureClass = pFeatureLayer.FeatureClass;
            this.GXIDIndex      = pFeatureClass.FindField("GXID");
            this.GYIDIndex      = pFeatureClass.FindField("GYID");
            this.LevelIndex     = pFeatureClass.FindField("Level");
            this.RecePowerIndex = pFeatureClass.FindField("RecePower");
        }
Esempio n. 5
0
 /// <summary>
 /// 加载三维地图的地图空间
 /// </summary>
 /// <param name="sceneControl"></param>
 public void LoadUserMapWorkSpace()
 {
     if (SceneControl != null)
     {
         MapWorkSpace workSpace = new MapWorkSpace();
         workSpace.LoadDefaultWorkSpace(SceneControl);
     }
 }
        // 列名
        public OperateSmoothBuildingLayer()
        {
            IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();
            IFeatureClass     fclass           = featureWorkspace.OpenFeatureClass(LayerNames.SmoothBuildingVertex);
            IFeatureLayer     flayer           = new FeatureLayer();

            pFeatureLayer.FeatureClass = pFeatureClass;

            //pFeatureLayer = GISMapApplication.Instance.GetLayer(LayerNames.SmoothBuildingVertex) as IFeatureLayer;
            //pFeatureClass = pFeatureLayer.FeatureClass;
        }
        // 列名
        public OperateBuildingLayer(string layerName)
        {
            IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();

            pFeatureClass = featureWorkspace.OpenFeatureClass(layerName);
            pFeatureLayer = new FeatureLayer();
            pFeatureLayer.FeatureClass = pFeatureClass;

            //pFeatureLayer = GISMapApplication.Instance.GetLayer(layerName) as IFeatureLayer;
            //pFeatureClass = pFeatureLayer.FeatureClass;
            this.bidIndex    = pFeatureClass.FindField("BID");
            this.heightIndex = pFeatureClass.FindField("Height");
        }
        public OperateInterferenceLocLayer()
        {
            IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();
            IFeatureClass     fclass           = featureWorkspace.OpenFeatureClass(LayerNames.InfSource);
            IFeatureLayer     flayer           = new FeatureLayer();

            pFeatureLayer.FeatureClass = pFeatureClass;

            //pFeatureLayer = GISMapApplication.Instance.GetLayer(LayerNames.InfSource) as IFeatureLayer;
            //pFeatureClass = pFeatureLayer.FeatureClass;
            this.GXIDIndex      = pFeatureClass.FindField("GXID");
            this.GYIDIndex      = pFeatureClass.FindField("GYID");
            this.LevelIndex     = pFeatureClass.FindField("Level");
            this.RecePowerIndex = pFeatureClass.FindField("RecePower");
        }
        /// <summary>
        /// 刷新GSM图层(包含900,1800及基站图层)
        /// </summary>
        public bool RefreshCellLayer(string layerName)
        {
            IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();

            string path = System.Configuration.ConfigurationSettings.AppSettings["GisPath"].ToString();

            //若不存在shp文件,则创建
            if (!DefineLayer.findLayer(path, layerName))
            {
                //new CreateLayer(path, layerName).Test();
                new CreateLayer(path, layerName).CreateCellLayer();
            }
            //RefreshGSM900BTS();
            return(RefreshGSM900Cell());
            //RefreshGSM1800BTS();
            //RefreshGSM1800Cell();\
        }
        public OperateSelectPointsLayer(string layername)
        {
            IFeatureWorkspace featureWorkspace = MapWorkSpace.getWorkSpace();
            string            path             = System.Configuration.ConfigurationSettings.AppSettings["GisPath"].ToString();

            //若不存在shp文件,则创建
            if (!DefineLayer.findLayer(path, layername))
            {
                new CreateLayer(path, layername).CreateSelectPointLayer();//目前有问题,但是理论上不需要新建
            }
            pFeatureClass = featureWorkspace.OpenFeatureClass(layername);
            pFeatureLayer = new FeatureLayer();
            pFeatureLayer.FeatureClass = pFeatureClass;

            CIIndex    = pFeatureClass.FindField("CI");
            FromIndex  = pFeatureClass.FindField("fromName");
            LonIndex   = pFeatureClass.FindField("Lontitude");
            LatIndex   = pFeatureClass.FindField("Latitude");
            AziIndex   = pFeatureClass.FindField("Azimuth");
            RecPwIndex = pFeatureClass.FindField("ReceivePW");
        }
        /// <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);
        }
Esempio n. 12
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);
        }