private PartialViewResult ViewEditProjectBoundingBox(Project project, EditProjectBoundingBoxViewModel viewModel) { var userCanViewPrivateLocations = CurrentFirmaSession.UserCanViewPrivateLocations(project); var layerGeoJsons = new List <LayerGeoJson> { project.HasProjectLocationPoint(userCanViewPrivateLocations) ? new LayerGeoJson("Simple Location", project.SimpleLocationToGeoJsonFeatureCollection(userCanViewPrivateLocations, true), FirmaHelpers.DefaultColorRange[1], 0.8m, LayerInitialVisibility.LayerInitialVisibilityEnum.Show) : null, project.HasProjectLocationDetailed(userCanViewPrivateLocations) ? new LayerGeoJson("Detailed Location", project.DetailedLocationToGeoJsonFeatureCollection(userCanViewPrivateLocations), FirmaHelpers.DefaultColorRange[1], 0.8m, LayerInitialVisibility.LayerInitialVisibilityEnum.Show) : null } .Where(x => x != null) .ToList(); foreach (var geospatialAreaType in HttpRequestStorage.DatabaseEntities.GeospatialAreaTypes.ToList().OrderBy(x => x.GeospatialAreaTypeName).ToList()) { layerGeoJsons.Add(geospatialAreaType.GetGeospatialAreaWmsLayerGeoJson("#90C3D4", 0.1m, LayerInitialVisibility.LayerInitialVisibilityEnum.Hide)); } var boundingBox = BoundingBox.MakeBoundingBoxFromProject(project, userCanViewPrivateLocations); var mapInitJson = new MapInitJson("EditProjectBoundingBoxMap", 10, layerGeoJsons, MapInitJson.GetExternalMapLayers(), boundingBox) { AllowFullScreen = false, DisablePopups = true }; var editProjectBoundingBoxUrl = SitkaRoute <ProjectLocationController> .BuildUrlFromExpression(c => c.EditProjectBoundingBox(project)); var viewData = new EditProjectBoundingBoxViewData(mapInitJson, editProjectBoundingBoxUrl, EditProjectBoundingBoxFormID); return(RazorPartialView <EditProjectBoundingBox, EditProjectBoundingBoxViewData, EditProjectBoundingBoxViewModel>(viewData, viewModel)); }
private PartialViewResult ViewEditProjectLocationDetailed(Project project, ProjectLocationDetailViewModel viewModel) { var mapDivID = $"project_{project.GetEntityID()}_EditDetailedMap"; var detailedLocationGeoJsonFeatureCollection = project.DetailedLocationToGeoJsonFeatureCollection(true); var editableLayerGeoJson = new LayerGeoJson($"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabel()} Detail", detailedLocationGeoJsonFeatureCollection, "red", 1, LayerInitialVisibility.LayerInitialVisibilityEnum.Show); var layers = MapInitJson.GetConfiguredGeospatialAreaMapLayers(); var userCanViewPrivateLocations = CurrentFirmaSession.UserCanViewPrivateLocations(project); layers.AddRange(MapInitJson.GetProjectLocationSimpleMapLayer(project, userCanViewPrivateLocations)); var boundingBox = ProjectLocationSummaryMapInitJson.GetProjectBoundingBox(project, userCanViewPrivateLocations); var mapInitJson = new MapInitJson(mapDivID, 10, layers, MapInitJson.GetExternalMapLayers(), boundingBox) { AllowFullScreen = false, DisablePopups = true }; var mapFormID = GenerateEditProjectLocationFormID(project.GetEntityID()); var uploadGisFileUrl = SitkaRoute <ProjectLocationController> .BuildUrlFromExpression(c => c.ImportGdbFile(project.GetEntityID())); var saveFeatureCollectionUrl = SitkaRoute <ProjectLocationController> .BuildUrlFromExpression(x => x.EditProjectLocationDetailed(project.GetEntityID(), null)); var hasSimpleLocationPoint = project.HasProjectLocationPoint(userCanViewPrivateLocations); var viewData = new ProjectLocationDetailViewData(project.GetEntityID(), mapInitJson, editableLayerGeoJson, uploadGisFileUrl, mapFormID, saveFeatureCollectionUrl, ProjectLocation.FieldLengths.Annotation, hasSimpleLocationPoint, project.LocationIsPrivate); return(RazorPartialView <ProjectLocationDetail, ProjectLocationDetailViewData, ProjectLocationDetailViewModel>(viewData, viewModel)); }
private PartialViewResult ViewEditProjectGeospatialAreas(EditProjectGeospatialAreasViewModel viewModel, Project project, GeospatialAreaType geospatialAreaType) { var userCanViewPrivateLocations = CurrentFirmaSession.UserCanViewPrivateLocations(project); var boundingBox = ProjectLocationSummaryMapInitJson.GetProjectBoundingBox(project, userCanViewPrivateLocations); var layers = MapInitJson.GetGeospatialAreaMapLayersForGeospatialAreaType(geospatialAreaType); layers.AddRange(MapInitJson.GetProjectLocationSimpleAndDetailedMapLayers(project, CurrentFirmaSession)); var mapInitJson = new MapInitJson("projectGeospatialAreaMap", 0, layers, MapInitJson.GetExternalMapLayers(), boundingBox) { AllowFullScreen = false, DisablePopups = true }; var geospatialAreaIDs = viewModel.GeospatialAreaIDs ?? new List <int>(); var geospatialAreasInViewModel = HttpRequestStorage.DatabaseEntities.GeospatialAreas.Where(x => geospatialAreaIDs.Contains(x.GeospatialAreaID)).ToList(); var editProjectGeospatialAreasPostUrl = SitkaRoute <ProjectGeospatialAreaController> .BuildUrlFromExpression(c => c.EditProjectGeospatialAreas(project, geospatialAreaType, null)); var editProjectGeospatialAreasFormID = GetEditProjectGeospatialAreasFormID(); var geospatialAreasContainingProjectSimpleLocation = GeospatialAreaModelExtensions.GetGeospatialAreasContainingProjectLocation(project, geospatialAreaType.GeospatialAreaTypeID).ToList(); var viewData = new EditProjectGeospatialAreasViewData(CurrentFirmaSession, mapInitJson, geospatialAreasInViewModel, editProjectGeospatialAreasPostUrl, editProjectGeospatialAreasFormID, project.HasProjectLocationPoint(userCanViewPrivateLocations), project.HasProjectLocationDetailed(userCanViewPrivateLocations), geospatialAreaType, geospatialAreasContainingProjectSimpleLocation, null); return(RazorPartialView <EditProjectGeospatialAreas, EditProjectGeospatialAreasViewData, EditProjectGeospatialAreasViewModel>(viewData, viewModel)); }