Пример #1
0
        public ActionResult ExportSectors(StatComplexFieldRepository repository)
        {
            if (RutraceStatContainer.MrsStats == null || RutraceStatContainer.MrsStats.Count == 0)
            {
                TempData["warning"] = "小区统计数据为空!请先导入并统计数据。";
                return(RedirectToAction("Import"));
            }

            for (int i = 0; i < StatRuChoiceQueries.Choices.Count(); i++)
            {
                StatValueField field = repository.FieldList[i + StatRuChoiceQueries.Choices.Count()];
                if (field.IntervalList.Count == 0)
                {
                    TempData["warning"] = "显示区间:" + StatRuChoiceQueries.Choices.ElementAt(0)
                                          + "设置为空!请先设置区间。";
                    return(RedirectToAction("DisplayDef"));
                }
            }

            return(View(new StatFieldsSelectionViewModel
            {
                RuFieldName = StatRuChoiceQueries.Choices.ElementAt(0),
                ValueFieldName = StatValueChoiceQueries.Choices.ElementAt(0),
                Longtitute = outdoorCellList.Where(x => x.Height > 1).Select(x => x.Longtitute).Distinct().Average(),
                Lattitute = outdoorCellList.Where(x => x.Height > 1).Select(x => x.Lattitute).Distinct().Average()
            }));
        }
        public void TestInitializeKmlDocument()
        {
            Assert.AreEqual(KmlTestInfrastructure.StatValueField.IntervalList[0].Color.ColorStringForKml,
                            "800A0C80", "begin");
            KmlTestInfrastructure.StatValueField.FieldName = "同模干扰电平";
            Assert.AreEqual(KmlTestInfrastructure.StatValueField.FieldName, "同模干扰电平");
            XmlDocument doc = new XmlDocument();

            doc.Load(reader);

            StatValueField field = KmlTestInfrastructure.StatValueField;

            doc.InitializeKmlDocument(field.IntervalList.Select(x => x.Color.ColorStringForKml));
            Assert.AreEqual(KmlTestInfrastructure.StatValueField.IntervalList[0].Color.ColorStringForKml,
                            "800A0C80", "end");
            Assert.AreEqual(doc.InnerXml,
                            @"<?xml version=""1.0"" encoding=""utf-16""?>"
                            + @"<kml xmlns=""http://earth.google.com/kml/2.1"">"
                            + @"<Document><name>KML地图</name>"
                            + @"<Style id=""Color-800A0C80"" xmlns=""""><LineStyle><width>1</width>"
                            + @"<color>FFFF8080</color></LineStyle><PolyStyle><color>800A0C80</color></PolyStyle></Style>"
                            + @"<Style id=""Color-80670C0C"" xmlns=""""><LineStyle><width>1</width>"
                            + @"<color>FFFF8080</color></LineStyle><PolyStyle><color>80670C0C</color></PolyStyle></Style>"
                            + @"<Style id=""Color-800A7B0C"" xmlns=""""><LineStyle><width>1</width>"
                            + @"<color>FFFF8080</color></LineStyle><PolyStyle><color>800A7B0C</color></PolyStyle></Style>"
                            + @"<Folder xmlns=""""><name>测试点序列</name></Folder>"
                            + @"</Document></kml>");
        }
Пример #3
0
        public JsonResult ImportCellsWithRange(EvaluationInfrastructure infrastructure,
                                               StatComplexFieldRepository repository,
                                               string fieldName, double southWestLon, double southWestLat,
                                               double northEastLon, double northEastLat)
        {
            infrastructure.ImportCellList(
                eNodebRepository,
                cellRepository,
                new GeoPoint(southWestLon - GeoMath.BaiduLongtituteOffset, southWestLat - GeoMath.BaiduLattituteOffset),
                new GeoPoint(northEastLon - GeoMath.BaiduLongtituteOffset, northEastLat - GeoMath.BaiduLattituteOffset));
            if (string.IsNullOrEmpty(fieldName))
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            infrastructure.Region.CalculatePerformance(EvaluationSettings.TrafficLoad);
            StatValueField field = repository.FieldList[(int)fieldName.GetStatValueIndex()];

            List <MeasurePointInfo> infoList
                = infrastructure.Region.GetMeasureMergedList(field, EvaluationSettings.DistanceInMeter);

            return(Json(infoList.Select(x =>
                                        new
            {
                X1 = x.X1 + GeoMath.BaiduLongtituteOffset,
                Y1 = x.Y1 + GeoMath.BaiduLattituteOffset,
                X2 = x.X2 + GeoMath.BaiduLongtituteOffset,
                Y2 = x.Y2 + GeoMath.BaiduLattituteOffset,
                C = x.ColorString
            }).ToArray(),
                        JsonRequestBehavior.AllowGet));
        }
Пример #4
0
        public List <MeasurePointInfo> GetMeasureMergedList(StatValueField field, double distanceInMeter)
        {
            MergeMeasurePointListService service = new MergeMeasurePointListService(
                ValidPointList.Select(validPoint => new MeasurePointInfo(validPoint, field,
                                                                         distanceInMeter.GetDegreeInterval())));

            return(service.Merge());
        }
Пример #5
0
        public void GenerateKmlFile(string kmlFileName,
                                    List <MeasurePointInfo> measurePointList, StatValueField field)
        {
            TextReader  reader = new StreamReader(Framework.KmlFileName);
            XmlDocument doc    = GenerateKmlDoc(measurePointList, field, reader);

            XmlTextWriter tr = new XmlTextWriter(kmlFileName, null);

            tr.Formatting = Formatting.Indented;
            doc.WriteContentTo(tr);
            tr.Close();
        }
Пример #6
0
        public JsonResult GetCoveragePoints(string fieldName,
                                            StatValueFieldRepository repository, CoverageStatChart chart)
        {
            StatValueField field = repository.GenerateDefaultField(fieldName);

            return(Json(chart.StatList.Select(x => new
            {
                X = x.Longtitute + GeoMath.BaiduLongtituteOffset,
                Y = x.Lattitute + GeoMath.BaiduLattituteOffset,
                C = field.GetColor(fieldName == "信号RSRP" ? x.Rsrp : x.Sinr, "FFFFFF")
            }), JsonRequestBehavior.AllowGet));
        }
Пример #7
0
        public JsonResult CoverageIntervalPercentage(string fieldName, CoverageStatChart chart)
        {
            StatValueField field = new StatValueField {
                FieldName = fieldName
            };

            field.AutoGenerateIntervals(8);
            IEnumerable <double> values = (fieldName == "信号RSRP") ?
                                          chart.StatList.Select(x => x.Rsrp) : chart.StatList.Select(x => x.Sinr);
            Dictionary <string, double> result = field.GetPercentageStat(values);

            return(Json(result.Select(x => new { N = x.Key, V = 100 * x.Value }), JsonRequestBehavior.AllowGet));
        }
Пример #8
0
        public ActionResult ExportPoints(string fieldName, StatValueFieldRepository repository,
                                         CoverageStatChart chart)
        {
            if (chart.StatList.Count == 0)
            {
                TempData["warning"] = "覆盖数据为空,请先导入数据分析。";
                return(RedirectToAction("CoverageImport"));
            }
            StatValueField field = repository.GenerateDefaultField(fieldName);

            TempData["centerX"] = chart.StatList.Average(x => x.BaiduLongtitute);
            TempData["centerY"] = chart.StatList.Average(x => x.BaiduLattitute);
            return(View(field));
        }
Пример #9
0
        public JsonResult GetStatValueField(StatValueFieldRepository repository,
                                            string fieldName)
        {
            StatValueField field = repository.FieldList[(int)fieldName.GetStatValueIndex()];

            return(Json(field.IntervalList.Select(x => new
            {
                L = x.IntervalLowLevel,
                H = x.IntervalUpLevel,
                C = x.Color.ColorStringForHtml,
                K = x.Color.ColorStringForKml
            }).ToArray(),
                        JsonRequestBehavior.AllowGet));
        }
Пример #10
0
        protected override List <SectorTriangle> SectorTriangles(StatValueField field,
                                                                 IEnumerable <Tuple <SectorTriangle, RuInterferenceStat> > filterSectors)
        {
            Func <RuInterferenceStat, InterferenceService <RuInterferenceStat> > generator
                = field.FieldName.GetGenerator();

            return((generator == null)
                ? new List <SectorTriangle>()
                : filterSectors.Select(x =>
            {
                x.Item1.ColorString = (generator(x.Item2)).GetColor(field);
                x.Item1.Info += x.Item2.StatInfo;
                return x.Item1;
            }).ToList());
        }
Пример #11
0
 public StatFieldViewModel(StatValueField field, IEnumerable <double> values)
     : this(field)
 {
     IntervalSettingList = new List <StatValueIntervalSetting>();
     for (int i = 0; i < IntervalList.Count; i++)
     {
         IntervalSettingList.Add(new StatValueIntervalSetting
         {
             IntervalLowLevel = IntervalList[i].IntervalLowLevel,
             IntervalUpLevel  = IntervalList[i].IntervalUpLevel,
             SuggestUpLevel   = IntervalList[i].IntervalUpLevel,
             RecordsCount     = values.Count(x => x >= IntervalList[i].IntervalLowLevel &&
                                             x < IntervalList[i].IntervalUpLevel)
         });
     }
 }
Пример #12
0
        public JsonResult GetPoints(string fieldName,
                                    EvaluationInfrastructure infrastructure,
                                    StatValueFieldRepository repository)
        {
            StatValueField          field = repository.FieldList[(int)fieldName.GetStatValueIndex()];
            List <MeasurePointInfo> infoList
                = infrastructure.Region.GetMeasureMergedList(field, EvaluationSettings.DistanceInMeter);

            return(Json(infoList.Select(x =>
                                        new {
                X1 = x.X1 + GeoMath.BaiduLongtituteOffset,
                Y1 = x.Y1 + GeoMath.BaiduLattituteOffset,
                X2 = x.X2 + GeoMath.BaiduLongtituteOffset,
                Y2 = x.Y2 + GeoMath.BaiduLattituteOffset,
                C = x.ColorString
            }).ToArray(),
                        JsonRequestBehavior.AllowGet));
        }
Пример #13
0
        public JsonResult GetStatField(StatComplexFieldRepository repository,
                                       string fieldName)
        {
            StatValueChoice valueChoice = fieldName.GetStatValueIndex();
            StatRuChoice    ruChoice    = fieldName.GetStatRuIndex();
            int             index       = (valueChoice == StatValueChoice.Undefined) ?
                                          (int)ruChoice + StatValueChoiceQueries.Choices.Count() :
                                          (int)valueChoice;
            StatValueField field = repository.FieldList[index];

            return(Json(field.IntervalList.Select(x => new
            {
                L = x.IntervalLowLevel,
                H = x.IntervalUpLevel,
                C = x.Color.ColorStringForHtml,
                K = x.Color.ColorStringForKml
            }).ToArray(),
                        JsonRequestBehavior.AllowGet));
        }
Пример #14
0
 public void TestInitialize()
 {
     _fieldElement = new XElement("Field", new XAttribute("ID", "myFieldName"));
     _fieldElement.Add(new XElement("Interval",
                                    new XElement("LowLevel", "11"),
                                    new XElement("UpLevel", "15"),
                                    new XElement("A", "98"),
                                    new XElement("B", "114"),
                                    new XElement("R", "198"),
                                    new XElement("G", "221")));
     _fieldElement.Add(new XElement("Interval",
                                    new XElement("LowLevel", "15"),
                                    new XElement("UpLevel", "17"),
                                    new XElement("A", "6"),
                                    new XElement("B", "14"),
                                    new XElement("R", "108"),
                                    new XElement("G", "171")));
     _field = new StatValueField(_fieldElement);
 }
Пример #15
0
        public static XmlDocument GenerateKmlDoc(List <MeasurePointInfo> measurePointList,
                                                 StatValueField field, TextReader reader)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(reader);
            doc.InitializeKmlDocument(field.IntervalList.Select(x => x.Color.ColorStringForKml));

            for (int i = 0; i < measurePointList.Count(); i++)
            {
                PlacemarkKmlElement placemarkKmlElement = new PlacemarkKmlElement(doc, "测试点")
                {
                    StyleUrl        = "Color-" + measurePointList[i].ColorStringForKml,
                    CoordinatesInfo = measurePointList[i].CoordinatesInfo
                };
                XmlElement placemarkElement = placemarkKmlElement.CreateElement();
                doc.AddPlacemarkElement(placemarkElement);
            }
            return(doc);
        }
Пример #16
0
        public ActionResult ExportPoints(string fieldName,
                                         EvaluationInfrastructure infrastructure,
                                         StatValueFieldRepository repository)
        {
            if (infrastructure.Region == null || infrastructure.Region.Length == 0 ||
                infrastructure.CellList.Count == 0)
            {
                TempData["warning"] = "仿真区域设置为空!请先设置仿真区域。";
                return(RedirectToAction("RegionDef"));
            }
            StatValueField field = repository.FieldList[(int)fieldName.GetStatValueIndex()];

            if (field.IntervalList.Count == 0)
            {
                TempData["warning"] = "显示区间设置为空!请先设置区间。";
                return(RedirectToAction("PointsAnalysis"));
            }

            TempData["centerX"] = infrastructure.CellList.Average(x => x.BaiduLongtitute);
            TempData["centerY"] = infrastructure.CellList.Average(x => x.BaiduLattitute);
            return(View(field));
        }
Пример #17
0
        public ActionResult ExportKml(string fieldName,
                                      EvaluationInfrastructure infrastructure,
                                      StatValueFieldRepository repository)
        {
            StatValueField field = repository.FieldList[(int)fieldName.GetStatValueIndex()];

            if (field.IntervalList.Count == 0)
            {
                TempData["warning"] = "显示区间设置为空!请先设置区间。";
                return(RedirectToAction("PointsAnalysis"));
            }

            GoogleKml kml = new GoogleKml("framework.xml");
            string    absoluFilePath
                = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "uploads\\",
                               "Kmlresults-" + field.FieldName + DateTime.Today.ToString("yyyyMMdd"));

            kml.GenerateKmlFile(absoluFilePath,
                                infrastructure.Region.GetMeasureInfoList(field, EvaluationSettings.DistanceInMeter), field);
            return(File(new FileStream(absoluFilePath, FileMode.Open),
                        "application/octet-stream", Server.UrlEncode(
                            "Kmlresults-" + field.FieldName + DateTime.Today.ToString("yyyyMMdd") + ".kml")));
        }
Пример #18
0
 public void TestInitialize()
 {
     _statValueField = new StatValueField
     {
         IntervalList = new List <StatValueInterval>
         {
             new StatValueInterval
             {
                 IntervalLowLevel = 0,
                 IntervalUpLevel  = 1
             },
             new StatValueInterval
             {
                 IntervalLowLevel = 1,
                 IntervalUpLevel  = 2
             },
             new StatValueInterval
             {
                 IntervalLowLevel = 2,
                 IntervalUpLevel  = 3
             }
         }
     };
 }
Пример #19
0
 public StatFieldViewModel(StatValueField field)
 {
     FieldName    = field.FieldName;
     IntervalList = field.IntervalList;
 }
 public void TestInitialize()
 {
     _stat  = new RuInterferenceStat();
     _field = new StatValueField();
 }
Пример #21
0
 protected abstract List <SectorTriangle> SectorTriangles(StatValueField field,
                                                          IEnumerable <Tuple <SectorTriangle, T> > filterSectors);
Пример #22
0
        public List <SectorTriangle> Generate(StatValueField field)
        {
            IEnumerable <Tuple <SectorTriangle, T> > filterSectors = FilterSectors();

            return(SectorTriangles(field, filterSectors));
        }
Пример #23
0
 public List <MeasurePointInfo> GetMeasureInfoList(StatValueField field, double distanceInMeter)
 {
     return(ValidPointList.Select(x => new MeasurePointInfo(
                                      x, field, distanceInMeter.GetDegreeInterval())).ToList());
 }