Example #1
0
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            //string taskName = typeof(TaskType).GetEnumName(type);
            string taskName1 = taskName;

            taskName1 += "_";
            switch (type)
            {
            case TaskType.CellCoverLayer:
                var obj = (RefreshCellCoverLayerModel)actionContext.ActionArguments["layer"];
                taskName1 += obj.cellName;
                break;

            case TaskType.AreaCoverLayer:
                var obj1 = (RefreshAreaCoverLayerModel)actionContext.ActionArguments["layer"];
                taskName1 += String.Format("{0}_{1}_{2}_{3}", obj1.minLongitude, obj1.minLatitude, obj1.maxLongitude, obj1.maxLatitude);
                break;

            case TaskType.AreaGSMLayer:
                taskName1 += "南京";
                break;

            case TaskType.CellCoverCompu:
                var obj2 = (CellRayTracingModel)actionContext.ActionArguments["rt"];
                taskName1 += obj2.cellName;
                layer      = false;
                break;

            case TaskType.AreaCoverCompu:
                var obj3 = (Area)actionContext.ActionArguments["area"];
                layer      = false;
                taskName1 += String.Format("{0}_{1}_{2}_{3}", obj3.minLongitude, obj3.minLatitude, obj3.maxLongitude, obj3.maxLatitude);
                break;

            case TaskType.AreaInterference:
                var obj4 = (AreaCoverDefectModel)actionContext.ActionArguments["defect"];
                layer      = false;
                taskName1 += String.Format("{0}_{1}_{2}_{3}", obj4.minLongitude, obj4.minLatitude, obj4.maxLongitude, obj4.maxLatitude);
                break;

            case TaskType.AreaInterferenceLayer:
                var obj7 = (RefreshAreaCoverDefectLayerModel)actionContext.ActionArguments["layer"];
                taskName1 += String.Format("{0}_{1}_{2}_{3}", obj7.minLongitude, obj7.minLatitude, obj7.maxLongitude, obj7.maxLatitude);
                break;

            case TaskType.RayRecordAdj:
                var obj5 = (RayRecordAdjModel)actionContext.ActionArguments["ray"];
                layer      = false;
                taskName1 += obj5.cellName;
                break;

            case TaskType.RayRecordLoc:
                var obj6 = (RayLocRecordModel)actionContext.ActionArguments["ray"];
                layer      = false;
                taskName1 += obj6.virsource;
                break;

            case TaskType.RayRecordAdjBatchMode:
                layer      = false;
                taskName1 += "系数校正射线记录";
                break;

            case TaskType.Calibration:
                layer      = false;
                taskName1 += "系数校正";
                break;

            case TaskType.SelectedPointsLayer:
                var obj9 = (RefreshSPLayerModel)actionContext.ActionArguments["layer"];
                taskName1 += obj9.version;
                break;

            case TaskType.ComputeInfRSRP:
                layer = false;
                var obj10 = (PreHandleDTForLoc)actionContext.ActionArguments["rt"];
                taskName1 += obj10.infname;
                break;

            case TaskType.DataMock:
                layer = false;
                var obj11 = (DataRange)actionContext.ActionArguments["dataRange"];
                taskName1 += obj11.infAreaId;
                break;

            default:
                break;
            }
            LoadInfo.taskName.Value = taskName1;
            //提前通知远程系统的初始化进度信息
            if (layer)
            {
                Monitor.Enter(gisLock);
                //if(Monitor.TryEnter(gisLock)){
                GisClient.ServiceApi.gisApi.Value = new GisClient.ServiceApi();
                GisClient.Result res = GisClient.ServiceApi.getGisLayerService().setLoadInfo(LoadInfo.UserId.Value, taskName1);
                GisClient.ServiceApi.CloseConn();
                //}
                //GisClient.ServiceApi.gisApi.Value = new GisClient.ServiceApi();
                //GisClient.Result res = GisClient.ServiceApi.getGisLayerService().setLoadInfo(LoadInfo.UserId.Value, taskName1);
                //GisClient.ServiceApi.CloseConn();
            }
            loadInfo.loadCreate();
        }
        public Result BuildAreaRadio([FromBody] AreaSplitRange dataRange)
        {
            brGridGap = (int)dataRange.tarGridL;
            Point pMin = new Point();

            pMin.X = dataRange.minLongitude;
            pMin.Y = dataRange.minLatitude;
            pMin.Z = 0;
            LTE.Utils.PointConvertByProj.Instance.GetProjectPoint(pMin);

            Point pMax = new Point();

            pMax.X = dataRange.maxLongitude;
            pMax.Y = dataRange.maxLatitude;
            pMax.Z = 0;
            LTE.Utils.PointConvertByProj.Instance.GetProjectPoint(pMax);

            Grid3D minGrid = new Grid3D();
            Grid3D maxGrid = new Grid3D();

            GridHelper.getInstance().PointXYZGrid(pMin, ref minGrid, (int)dataRange.tarGridL, 0);
            GridHelper.getInstance().PointXYZGrid(pMax, ref maxGrid, (int)dataRange.tarGridL, 0);

            DataTable dtable = new DataTable();

            dtable.Columns.Add("gmxId");
            dtable.Columns.Add("gmyId");
            dtable.Columns.Add("buildRatio");
            dtable.Columns.Add("gridSize");

            for (int xId = minGrid.gxid; xId < maxGrid.gxid; xId++)
            {
                for (int yId = minGrid.gyid; yId < maxGrid.gyid; yId++)
                {
                    var       len = (int)dataRange.tarGridL;
                    Point     cen = GridHelper.getInstance().Grid2CenterXY(new Grid3D(xId, yId, 0), len);
                    Hashtable ht  = new Hashtable();
                    ht["minX"] = cen.X - dataRange.tarGridL / 2;
                    ht["maxX"] = cen.X + dataRange.tarGridL / 2;
                    ht["minY"] = cen.Y - dataRange.tarGridL / 2;
                    ht["maxY"] = cen.Y + dataRange.tarGridL / 2;
                    DataTable dt = IbatisHelper.ExecuteQueryForDataTable("queryBuildingVertex", ht);

                    Dictionary <int, List <Point> > dics = new Dictionary <int, List <Point> >();
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        var    row = dt.Rows[i];
                        int    id  = (int)row["BuildingID"];
                        double vx  = double.Parse(row["VertexX"].ToString());
                        double vy  = double.Parse(row["VertexY"].ToString());
                        if (!dics.ContainsKey(id))
                        {
                            List <Point> points = new List <Point>();
                            points.Add(new Point(vx, vy, 0));
                            dics.Add(id, points);
                        }
                        dics[id].Add(new Point(vx, vy, 0));
                    }
                    double area = 0;
                    foreach (var key in dics.Keys)
                    {
                        area += CalculateArea(dics[key]);
                    }

                    string keyPos = String.Format("{0}_{1}", xId, yId);

                    double buildRatio = area / (dataRange.tarGridL * dataRange.tarGridL);
                    RedisHelper.putDouble(prefix + "_" + len, keyPos, buildRatio);

                    DataRow thisrow = dtable.NewRow();
                    thisrow["gmxId"]      = xId;
                    thisrow["gmyId"]      = yId;
                    thisrow["buildRatio"] = buildRatio;
                    thisrow["gridSize"]   = len;
                    dtable.Rows.Add(thisrow);
                }
            }

            DataUtil.BCPDataTableImport(dtable, "tbMockGrid");
            GisClient.ServiceApi.gisApi.Value = new GisClient.ServiceApi();
            GisClient.Result res = GisClient.ServiceApi.getGisLayerService().
                                   refreshMockGridLayer(minGrid.gxid, minGrid.gyid, maxGrid.gxid, maxGrid.gyid);

            return(new Result(true, "仿真区域建筑物面积占比计算成功"));
        }