public void TestInitialize() { Initialize(); Repository = new StatValueFieldRepository { FieldList = statValueFieldList }; }
public void TestStatValueFieldRepository_InitializeByFieldList() { Repository = new StatValueFieldRepository { FieldList = statValueFieldList }; Assert.AreEqual(Repository.FieldDoc.ToString().Replace("\r\n", "\n"), resultString.Replace("\r\n", "\n")); }
public void TestStatValueFieldRepository_DefaultConstruction() { Repository = new StatValueFieldRepository(); Assert.IsNotNull(Repository); Assert.IsNotNull(Repository.FieldList); Assert.AreEqual(Repository.FieldList.Count, 5); Assert.AreEqual(Repository.FieldList[0].FieldName, "同模干扰电平"); Assert.IsNotNull(Repository.FieldList[1].IntervalList); Assert.AreEqual(Repository.FieldList[2].IntervalList.Count, 0); Assert.AreEqual(Repository.FieldList[4].FieldName, "信号RSRP"); }
public void TestStatValueFieldRepository_InitializeByFieldDoc() { Stream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(resultString)); XDocument document = XDocument.Load( new StreamReader(stream, System.Text.Encoding.UTF8)); Assert.AreEqual(document.ToString().Replace("\r\n", "\n"), resultString.Replace("\r\n", "\n")); Repository = new StatValueFieldRepository { FieldDoc = document }; Assert.IsNotNull(Repository.FieldList); Assert.AreEqual(Repository.FieldList.Count, 2); Assert.AreEqual(Repository.FieldList[0].FieldName, "field1"); Assert.AreEqual(Repository.FieldList[1].IntervalList.Count, 2); Assert.AreEqual(Repository.FieldList[0].IntervalList[2].IntervalLowLevel, 2); Assert.AreEqual(Repository.FieldList[1].IntervalList[0].Color.ColorA, 155); }
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); }
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")); }
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { StatValueFieldRepository repository = (StatValueFieldRepository)controllerContext.HttpContext.Session[sessionKey]; if (repository == null) { repository = new StatValueFieldRepository(); controllerContext.HttpContext.Session[sessionKey] = repository; } // return the cart return repository; }
public JsonResult GetStatValueField(StatValueFieldRepository repository, string fieldName) { StatValueField field = repository.GenerateDefaultField(fieldName); return Json(field.IntervalList.Select(x => new { L = x.IntervalLowLevel, H = x.IntervalUpLevel, C = x.Color.ColorStringForHtml, K = x.Color.ColorStringForKml }).ToArray(), JsonRequestBehavior.AllowGet); }
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); }
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); }
public ActionResult PointsAnalysis(StatFieldViewModel viewModel, StatValueFieldRepository repository) { for (int i = 0; i < repository.FieldList.Count; i++) { if (i == (int)viewModel.FieldName.GetStatValueIndex() || repository.FieldList[i].IntervalList.Count == 0) { repository.FieldList[i].AutoGenerateIntervals( viewModel.FieldLength, viewModel.ColorThemeDescription.GetColorThemeIndex()); } } return View(new StatFieldViewModel(repository.FieldList[(int)viewModel.FieldName.GetStatValueIndex()]) { FieldLength = viewModel.FieldLength, ColorThemeDescription = viewModel.ColorThemeDescription }); }
public ActionResult PointsAnalysis(StatValueFieldRepository repository) { return View(new StatFieldViewModel(repository.FieldList[0]) { FieldLength = 4, ColorThemeDescription = "春" }); }
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); }