コード例 #1
0
        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));
        }
コード例 #2
0
        private PartialViewResult ViewEditProjectLocationDetailed(Project project, ProjectLocationDetailViewModel viewModel)
        {
            var mapDivID = $"project_{project.EntityID}_EditDetailedMap";
            var detailedLocationGeoJsonFeatureCollection = project.ProjectLocations.Where(pl => !pl.ArcGisObjectID.HasValue).ToGeoJsonFeatureCollection();
            var editableLayerGeoJson = new LayerGeoJson($"{FieldDefinition.ProjectLocation.GetFieldDefinitionLabel()} Detail", detailedLocationGeoJsonFeatureCollection, "red", 1, LayerInitialVisibility.Show);

            var arcGisLocationGeoJsonFeatureCollection = project.ProjectLocations.Where(pl => pl.ArcGisObjectID.HasValue).ToGeoJsonFeatureCollection();
            var arcGisLayerGeoJson = new LayerGeoJson($"{FieldDefinition.ProjectLocation.GetFieldDefinitionLabel()} Detail", arcGisLocationGeoJsonFeatureCollection, "red", 1, LayerInitialVisibility.Show);

            var layers = MapInitJson.GetAllGeospatialAreaMapLayers(LayerInitialVisibility.Show);

            layers.AddRange(MapInitJson.GetProjectLocationSimpleMapLayer(project));
            var boundingBox = ProjectLocationSummaryMapInitJson.GetProjectBoundingBox(project);
            var mapInitJson = new MapInitJson(mapDivID, 10, layers, boundingBox)
            {
                AllowFullScreen = false,
                DisablePopups   = true
            };

            var mapFormID        = GenerateEditProjectLocationFormID(project.EntityID);
            var uploadGisFileUrl = SitkaRoute <ProjectLocationController> .BuildUrlFromExpression(c => c.ImportGdbFile(project.EntityID));

            var saveFeatureCollectionUrl = SitkaRoute <ProjectLocationController> .BuildUrlFromExpression(x => x.EditProjectLocationDetailed(project.EntityID, null));

            var hasSimpleLocationPoint = project.ProjectLocationPoint != null;

            var viewData = new ProjectLocationDetailViewData(project.EntityID, mapInitJson, editableLayerGeoJson, arcGisLayerGeoJson, uploadGisFileUrl, mapFormID, saveFeatureCollectionUrl, ProjectLocation.FieldLengths.ProjectLocationNotes, hasSimpleLocationPoint);

            return(RazorPartialView <ProjectLocationDetail, ProjectLocationDetailViewData, ProjectLocationDetailViewModel>(viewData, viewModel));
        }
コード例 #3
0
        private PartialViewResult ViewEditProjectPriorityLandscapes(EditProjectPriorityLandscapesViewModel viewModel, Project project)
        {
            var boundingBox = ProjectLocationSummaryMapInitJson.GetProjectBoundingBox(project);
            var layers      = MapInitJson.GetPriorityLandscapeMapLayers(LayerInitialVisibility.Show);

            layers.AddRange(MapInitJson.GetProjectLocationSimpleAndDetailedMapLayers(project));
            var mapInitJson = new MapInitJson("projectPriorityLandscapeMap", 0, layers, boundingBox)
            {
                AllowFullScreen = false, DisablePopups = true
            };
            var priorityLandscapeIDs                 = viewModel.PriorityLandscapeIDs ?? new List <int>();
            var priorityLandscapesInViewModel        = HttpRequestStorage.DatabaseEntities.PriorityLandscapes.Where(x => priorityLandscapeIDs.Contains(x.PriorityLandscapeID)).ToList();
            var editProjectPriorityLandscapesPostUrl = SitkaRoute <ProjectPriorityLandscapeController> .BuildUrlFromExpression(c => c.EditProjectPriorityLandscapes(project, null));

            var editProjectPriorityLandscapesFormID = GetEditProjectPriorityLandscapesFormID();

            var viewData = new EditProjectPriorityLandscapesViewData(CurrentPerson, mapInitJson, priorityLandscapesInViewModel, editProjectPriorityLandscapesPostUrl, editProjectPriorityLandscapesFormID, project.HasProjectLocationPoint, project.HasProjectLocationDetail);

            return(RazorPartialView <EditProjectPriorityLandscapes, EditProjectPriorityLandscapesViewData, EditProjectPriorityLandscapesViewModel>(viewData, viewModel));
        }