public IActionResult UpdateMap( [FromQuery] string dataSetNames, [FromQuery] Period period, [FromQuery] string jsonMapViewModel) { MapViewModel mapViewModel = JsonConvert.DeserializeObject <MapViewModel>(jsonMapViewModel); DateTime to = DateTime.UtcNow; DateTime from; switch (period) { case Period.Week: from = to.AddDays(-7).Date; break; case Period.Month: from = to.AddMonths(-1).Date; break; case Period.Year: default: from = to.AddYears(-1).Date; break; } string time = $"{from.ToString("yyyy-MM-dd")}/{to.ToString("yyyy-MM-dd")}"; Dictionary <string, string> customParameters = new Dictionary <string, string> { { "TIME", time } }; mapViewModel.Services.Clear(); if (dataSetNames != null) { foreach (string name in dataSetNames.Split(',')) { mapViewModel.AddService(_ServiceType, _url, _dataSetToLayerMap[name], customParameters); } } string sld = _transactionDataService.GetAdministrativeUnitSld(); customParameters = new Dictionary <string, string> { { "SLD_BODY", sld } }; mapViewModel.AddService(_ServiceType, _urlAdminUnits, _CountyAdminUnitLayer, customParameters); mapViewModel.AddService(_ServiceType, _urlAdminUnits, _MunicipalityAdminUnitLayer, customParameters); return(PartialView("Views/Common/Map.cshtml", mapViewModel)); }
private void AddAdminUnitsToServices(MapViewModel mapViewModel) { string sld = _dataQualityDistributionService.GetAdministrativeUnitSld(); Dictionary <string, string> customParameters = new Dictionary <string, string> { { "SLD_BODY", sld } }; mapViewModel.AddService(_ServiceType, _urlAdminUnits, _CountyAdminUnitLayer, customParameters); mapViewModel.AddService(_ServiceType, _urlAdminUnits, _MunicipalityAdminUnitLayer, customParameters); }
public IActionResult County([FromQuery] int id) { ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, true)); ICounty county = _countyService.Get(id); MapViewModel mapViewModel = new MapViewModel(county); string sld = _dataQualityClassificationService.GetSld(); Dictionary <string, string> customParameters = new Dictionary <string, string> { { "SLD_BODY", sld } }; mapViewModel.AddService(_ServiceType, _url, _Layer, customParameters); AddAdminUnitsToServices(mapViewModel); DataQualityClassificationViewModel model = new DataQualityClassificationViewModel { Classifications = _dataQualityClassificationService.GetByCounty(id), AdministrativeUnitName = county.Name, Type = AdministrativeUnitType.County, LegendItemStyles = _dataQualityClassificationService.GetLegendItemStyles(), MetadataUrl = _metadataUrl, MapViewModel = mapViewModel }; return(View("Views/FkbData/DataContent/Aspects/DataQualityClassification.cshtml", model)); }
public IActionResult UpdateMap( [FromQuery] string layerName, [FromQuery] string jsonMapViewModel) { MapViewModel mapViewModel = JsonConvert.DeserializeObject <MapViewModel>(jsonMapViewModel); mapViewModel.Services.Clear(); mapViewModel.AddService(_ServiceType, _dataQualityDistributionService.GetWmsUrl(), layerName); AddAdminUnitsToServices(mapViewModel); return(PartialView("Views/Common/Map.cshtml", mapViewModel)); }
public IActionResult Country() { string url = $"{_applicationSettings.UrlThematicGeoJson}/{_geoJsonService.GetFileName()}"; MapViewModel mapViewModel = new MapViewModel(); mapViewModel.AddService(_serviceType, url, _layer); CountiesViewModel model = new CountiesViewModel() { Counties = _countyService.Get(), MapViewModel = mapViewModel }; model.DirectUpdateCount = model.Counties.Sum(c => c.DirectUpdateCount); ViewBag.ContextViewModel = _contextViewModelHelper.Create(); return(View("Views/FkbData/Management/Aspects/DirectUpdateInfo/Country.cshtml", model)); }
public IActionResult Country() { ViewBag.ContextViewModel = _contextViewModelHelper.Create(); MapViewModel mapViewModel = new MapViewModel(); List <ITransactionData> transactionData = _transactionDataService.Get(); mapViewModel.AddService(_ServiceType, _url, _Layer); TransactionDataViewModel model = new TransactionDataViewModel { TransactionData = transactionData, AdministrativeUnitName = "Norge", LegendItemStyles = _transactionDataService.GetLayerStyles(transactionData), MapViewModel = mapViewModel, MetadataUrl = _metadataUrl }; return(View("Views/FkbData/Management/Aspects/TransactionData/Country.cshtml", model)); }
public IActionResult Municipality([FromQuery] int id) { ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, false)); IMunicipality municipality = _municipalityService.Get(id); MapViewModel mapViewModel = new MapViewModel(municipality); List <ITransactionData> transactionData = _transactionDataService.GetByMunicipality(id); mapViewModel.AddService(_ServiceType, _url, _Layer); TransactionDataViewModel model = new TransactionDataViewModel { TransactionData = transactionData, AdministrativeUnitName = municipality.Name, LegendItemStyles = _transactionDataService.GetLayerStyles(transactionData), MapViewModel = mapViewModel, MetadataUrl = _metadataUrl }; return(View("Views/FkbData/Management/Aspects/TransactionData/Municipality.cshtml", model)); }
public IActionResult County([FromQuery] int id) { string url = $"{_applicationSettings.UrlThematicGeoJson}/{_geoJsonService.GetFileNameCounty(id)}"; ICounty county = _countyService.Get(id); MapViewModel mapViewModel = new MapViewModel(county); mapViewModel.AddService(_serviceType, url, _layer); MunicipalitiesViewModel model = new MunicipalitiesViewModel() { Municipalities = _municipalityService.GetByCounty(id), CountyName = county.Name, MapViewModel = mapViewModel }; model.DirectUpdateCount = model.Municipalities.Where(m => m.IntroductionState == IntroductionState.Introduced).Count(); ViewBag.ContextViewModel = _contextViewModelHelper.Create(_contextViewModelHelper.Id2Key(id, true)); return(View("Views/FkbData/Management/Aspects/DirectUpdateInfo/County.cshtml", model)); }