コード例 #1
0
        public object getSelectedGrid(string layerName)
        {
            IFeatureLayer     pFeatureLayer;
            IFeatureSelection pFestureSelection;
            ISelectionSet     pSelection;
            IEnumIDs          pEnumIDs;
            IFeature          pFeature;

            pFeatureLayer     = GISMapApplication.Instance.GetLayer(layerName) as IFeatureLayer;
            pFestureSelection = pFeatureLayer as IFeatureSelection;
            pSelection        = pFestureSelection.SelectionSet;
            pEnumIDs          = pSelection.IDs;
            int ID = pEnumIDs.Next();

            if (ID == -1)
            {
                return(null);
            }

            int eNodeBIndex = pFeatureLayer.FeatureClass.Fields.FindField("eNodeB");
            int CIIndex     = pFeatureLayer.FeatureClass.Fields.FindField("CI");
            int GXIDIndex   = pFeatureLayer.FeatureClass.Fields.FindField("GXID");
            int GYIDIndex   = pFeatureLayer.FeatureClass.Fields.FindField("GYID");
            int LevelIndex  = pFeatureLayer.FeatureClass.Fields.FindField("Level");

            pFeature = pFeatureLayer.FeatureClass.GetFeature(ID);
            int eNodeB = int.Parse(pFeature.get_Value(eNodeBIndex).ToString());
            int CI     = int.Parse(pFeature.get_Value(CIIndex).ToString());
            int GXID   = int.Parse(pFeature.get_Value(GXIDIndex).ToString());
            int GYID   = int.Parse(pFeature.get_Value(GYIDIndex).ToString());
            int Level  = int.Parse(pFeature.get_Value(LevelIndex).ToString());

            Hashtable ht = new Hashtable();

            ht["eNodeB"] = eNodeB;
            ht["CI"]     = CI;
            ht["GXID"]   = GXID;
            ht["GYID"]   = GYID;
            ht["Level"]  = Level;

            PropertyGrid pg = IbatisHelper.ExecuteQueryForObject <PropertyGrid>("GETGrid3DProperties", ht);

            pg.Height = (pg.Level - 1) * GridHelper.getInstance().getGHeight() + GridHelper.getInstance().getGBaseHeight();

            return((object)pg);
        }
コード例 #2
0
        /// <summary>
        /// 获取对象
        /// </summary>
        /// <param name="pLayerName">要素图层名称</param>
        /// <param name="cellName">小区名称</param>
        /// <returns></returns>
        public static object GetCellInfo(string pLayerName, string cellName)
        {
            object obj       = null;
            string layerName = pLayerName;

            switch (layerName)
            {
            case "GSM900小区":
            case "GSM1800小区":
            {
                PropertyCELL pc = IbatisHelper.ExecuteQueryForObject <PropertyCELL>("GETPropertyCELL", cellName);
                //pc.Tilt = pc.Tilt > 0 ? pc.Tilt : 7;
                obj = pc;
                break;
            }
            }

            return(obj);
        }
コード例 #3
0
        public Result getShpByCellName([FromBody] shpLayer ob)
        {
            Result res    = new Result();
            object shpobj = IbatisHelper.ExecuteQueryForObject("getShpByIndexName", ob.IndexName);

            if (shpobj != null)
            {
                res.ok   = true;
                res.obj  = shpobj;
                res.code = "1";
            }
            else
            {
                res.ok   = false;
                res.msg  = "资源不存在,请联系管理员";
                res.code = "3";
            }
            return(res);
        }
コード例 #4
0
        /// <summary>
        /// 对统计栅格按照训练特征进行统计并入库
        /// </summary>
        /// <param name="togrid"></param>
        /// <param name="inf_name"></param>
        public void Tarj2GridFeature(Dictionary <string, List <GridInfo> > togrid, string inf_name)
        {
            System.Data.DataTable tb = new System.Data.DataTable();
            tb.Columns.Add("GXID");
            tb.Columns.Add("GYID");
            tb.Columns.Add("GZID");
            tb.Columns.Add("InfName");         //此版本数据对应的干扰源名称

            tb.Columns.Add("DtRatio");         //路测点占比
            tb.Columns.Add("Recp");            //信号接收强度
            tb.Columns.Add("RecVar");          //信号接收总方差
            tb.Columns.Add("Dis");             //距离干扰源的距离的平方
            tb.Columns.Add("DireVar");         //信号接收直射方差
            tb.Columns.Add("RefVar");          //信号接收反射方差
            tb.Columns.Add("DifVar");          //信号接收绕射方差
            tb.Columns.Add("BuildRatio600");   //600m栅格建筑物面积占比
            tb.Columns.Add("BuildRatio300");   //300m栅格建筑物面积占比
            tb.Columns.Add("Scene");           //场景

            tb.Columns.Add("UniDireRatio");    //直射占比(不同路测点发出的)
            tb.Columns.Add("UniNotDireRatio"); //非直射占比(不同路测点发出的)

            tb.Columns.Add("DireRatio");       //直射占比(不区分路测点)
            tb.Columns.Add("RefRatio");        //反射占比(不区分路测点)
            tb.Columns.Add("DifRatio");        //绕射占比(不区分路测点)


            string[] tmp1 = inf_name.Split('_');
            //获取干扰源的位置
            int       id = int.Parse(tmp1[tmp1.Length - 1]);
            Hashtable ht = new Hashtable();

            ht["id"] = id;
            int       dtSum   = (int)IbatisHelper.ExecuteQueryForObject("countDt", inf_name);
            DataTable dt      = IbatisHelper.ExecuteQueryForDataTable("queryCellPosById", ht);
            double    x       = double.Parse(dt.Rows[0]["x"].ToString());
            double    y       = double.Parse(dt.Rows[0]["y"].ToString());
            double    h       = double.Parse(dt.Rows[0]["h"].ToString());
            Grid3D    tarGrid = new Grid3D();

            GridHelper.getInstance().PointXYZToAccGrid(new Point(x, y, h), ref tarGrid);

            foreach (var item in togrid)
            {
                System.Data.DataRow thisrow = tb.NewRow();
                thisrow["InfName"] = inf_name;
                string[] strs = item.Key.Split(',');

                int gxId = int.Parse(strs[0]);
                int gyId = int.Parse(strs[1]);
                int gzId = int.Parse(strs[2]);

                thisrow["GXID"] = gxId;
                thisrow["GYID"] = gyId;
                thisrow["GZID"] = gzId;

                //获取建筑物面积占比  len==600
                Point  cen    = GridHelper.getInstance().Grid2CenterXY(new Grid3D(gxId, gyId, 0), 30);
                Grid3D brGrid = new Grid3D();
                GridHelper.getInstance().PointXYZGrid(cen, ref brGrid, 600, 0);
                string keyPos     = String.Format("{0}_{1}", brGrid.gxid, brGrid.gyid);
                var    tmp        = RedisHelper.get(prefix, keyPos);
                double buildRatio = Convert.ToDouble(tmp);
                thisrow["BuildRatio600"] = buildRatio;

                //获取建筑物面积占比  len==300
                cen = GridHelper.getInstance().Grid2CenterXY(new Grid3D(gxId, gyId, 0), 30);
                GridHelper.getInstance().PointXYZGrid(cen, ref brGrid, 300, 0);
                keyPos     = String.Format("{0}_{1}", brGrid.gxid, brGrid.gyid);
                tmp        = RedisHelper.get(prefix + "_" + 300, keyPos);
                buildRatio = Convert.ToDouble(tmp);
                thisrow["BuildRatio300"] = buildRatio;


                //获取场景
                ht["gxid"] = gxId;
                ht["gyid"] = gyId;
                int scene = Convert.ToInt16(IbatisHelper.ExecuteQueryForObject("getScene", ht));
                thisrow["Scene"] = scene;

                int dx = int.Parse(strs[0]) - tarGrid.gxid;
                int dy = int.Parse(strs[1]) - tarGrid.gyid;
                int dz = int.Parse(strs[2]) - tarGrid.gzid;
                thisrow["Dis"] = Math.Pow(dx, 2) + Math.Pow(dy, 2) + Math.Pow(dz, 2);

                //某一个栅格的统计信息
                Dictionary <string, List <GridInfo> > dic = new Dictionary <string, List <GridInfo> >();

                HashSet <string> uniDirectRay    = new HashSet <string>();
                HashSet <string> uniNotDirectRay = new HashSet <string>();

                double directNum   = 0;
                double reflectNUm  = 0;
                double difractNum  = 0;
                double recp        = int.MinValue;
                double recpVar     = 0;
                double directVar   = 0;
                double reflectVar  = 0;
                double diffractVar = 0;

                List <double> recpLs       = new List <double>();
                List <double> directRecp   = new List <double>();
                List <double> reflectRecp  = new List <double>();
                List <double> diffractRecp = new List <double>();

                foreach (GridInfo gr in item.Value)
                {
                    //只统计不同路测点的直射数目
                    if (gr.rayType == 0)
                    {
                        directNum++;
                        uniDirectRay.Add(gr.cellid);
                    }
                    if (gr.rayType == 1 || gr.rayType == 2)
                    {
                        reflectNUm++;
                        uniNotDirectRay.Add(gr.cellid);
                    }
                    if (gr.rayType == 3 || gr.rayType == 4)
                    {
                        difractNum++;
                        uniNotDirectRay.Add(gr.cellid);
                    }
                    if (!dic.ContainsKey(gr.cellid))
                    {
                        dic[gr.cellid] = new List <GridInfo>();
                    }
                    dic[gr.cellid].Add(gr);
                }

                thisrow["DireRatio"] = directNum / item.Value.Count;
                thisrow["RefRatio"]  = reflectNUm / item.Value.Count;
                thisrow["DifRatio"]  = difractNum / item.Value.Count;

                thisrow["UniDireRatio"]    = (double)uniDirectRay.Count / (double)(uniDirectRay.Count + uniNotDirectRay.Count);
                thisrow["UniNotDireRatio"] = (double)uniNotDirectRay.Count / (double)(uniDirectRay.Count + uniNotDirectRay.Count);

                //thisrow["reflect_num"] = reflectNUm;
                //thisrow["difract_num"] = difractNum;
                //thisrow["rp_num"] = dic.Keys.Count;

                thisrow["DtRatio"] = (double)dic.Keys.Count / (double)dtSum;

                double distinctdirectNum = 0;
                double distinctRefNum    = 0;
                double distinctDiffraNum = 0;

                foreach (var grs in dic)
                {
                    grs.Value.Sort((ox, oy) =>
                    {
                        if (ox is null)
                        {
                            throw new ArgumentNullException(nameof(ox));
                        }
                        if (oy is null)
                        {
                            throw new ArgumentNullException(nameof(oy));
                        }
                        if (double.IsNaN(ox.recP) || double.IsNaN(oy.recP))
                        {
                            throw new ArgumentException(nameof(ox) + " can't contain NaNs.");
                        }
                        int p1      = ox.rayType - oy.rayType;
                        int p2      = ox.raylevel - oy.raylevel;
                        double temp = oy.recP - ox.recP;
                        int p3      = 0;
                        if (temp < 0)
                        {
                            p3 = -1;
                        }
                        if (temp > 0)
                        {
                            p3 = 1;
                        }
                        return(p1 != 0 ? p1 : (p2 != 0 ? p2 : p3));
                    });

                    double recpTemp = grs.Value[0].recP;
                    recpLs.Add(recpTemp);
                    recpVar += recpTemp;

                    recp = Math.Max(recpTemp, recp);
                    int type = grs.Value[0].rayType;
                    if (type == 0)
                    {
                        distinctdirectNum++;
                        directVar += recpTemp;
                        directRecp.Add(recpTemp);
                    }
                    if (type == 1 || type == 2)
                    {
                        distinctRefNum++;
                        reflectVar += recpTemp;
                        reflectRecp.Add(recpTemp);
                    }
                    if (type == 3 || type == 4)
                    {
                        distinctDiffraNum++;
                        diffractVar += recpTemp;
                        diffractRecp.Add(recpTemp);
                    }
                }
                double aveRecp         = recpVar / dic.Keys.Count;
                double aveDirectRecp   = distinctdirectNum == 0 ? 0 : directVar / distinctdirectNum;
                double aveReflectRecp  = distinctRefNum == 0 ? 0 : reflectVar / distinctRefNum;
                double aveDiffractRecp = distinctDiffraNum == 0 ? 0 : diffractVar / distinctDiffraNum;

                recpVar     = 0;
                reflectVar  = 0;
                diffractVar = 0;
                foreach (var rtRecp in recpLs)
                {
                    recpVar += Math.Pow(rtRecp - aveRecp, 2);
                }
                foreach (var rtRecp in directRecp)
                {
                    directVar += Math.Pow(rtRecp - aveDirectRecp, 2);
                }
                foreach (var rtRecp in reflectRecp)
                {
                    reflectVar += Math.Pow(rtRecp - aveReflectRecp, 2);
                }
                foreach (var rtRecp in diffractRecp)
                {
                    diffractVar += Math.Pow(rtRecp - aveDiffractRecp, 2);
                }
                //优先使用直射线的平均信号强度,若没有则使用所以射线的平均信号强度
                thisrow["Recp"]    = aveDirectRecp == 0? aveRecp: aveDirectRecp;
                thisrow["RecVar"]  = recpVar;
                thisrow["DireVar"] = directVar;
                thisrow["RefVar"]  = reflectVar;
                thisrow["DifVar"]  = diffractVar;
                tb.Rows.Add(thisrow);
            }
            string desTbName = "tbGridFeature";

            //WriteDataToBase(tb, 100, desTbName);
            DataUtil.BCPDataTableImport(tb, desTbName);
        }