Пример #1
0
        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));
        }
Пример #2
0
        private PartialViewResult ViewApproveGisUpload(Project project, ProjectLocationDetailViewModel viewModel)
        {
            var projectLocationStagings = project.ProjectLocationStagings.ToList();
            var layerGeoJsons           =
                projectLocationStagings.Select(
                    (projectLocationStaging, i) =>
                    new LayerGeoJson(projectLocationStaging.FeatureClassName,
                                     projectLocationStaging.ToGeoJsonFeatureCollection(),
                                     FirmaHelpers.DefaultColorRange[i],
                                     1,
                                     LayerInitialVisibility.LayerInitialVisibilityEnum.Show)).ToList();

            var showFeatureClassColumn = projectLocationStagings.Any(x => x.FeatureClassName.Length > 0);

            var boundingBox = BoundingBox.MakeBoundingBoxFromLayerGeoJsonList(layerGeoJsons);

            var mapInitJson = new MapInitJson($"project_{project.ProjectID}_PreviewMap", 10, layerGeoJsons, MapInitJson.GetExternalMapLayers(), boundingBox, false)
            {
                AllowFullScreen = false, DisablePopups = true
            };
            var mapFormID           = GenerateEditProjectLocationFormID(((IProject)project).GetEntityID());
            var approveGisUploadUrl = SitkaRoute <ProjectLocationController> .BuildUrlFromExpression(x => x.ApproveGisUpload(project, null));

            var viewData = new ApproveGisUploadViewData(new List <IProjectLocationStaging>(projectLocationStagings), mapInitJson, mapFormID, approveGisUploadUrl, showFeatureClassColumn);

            return(RazorPartialView <ApproveGisUpload, ApproveGisUploadViewData, ProjectLocationDetailViewModel>(viewData, viewModel));
        }
Пример #3
0
        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));
        }
        public BulkSetProjectSpatialInformationViewDataForAngular(MapInitJson mapInitJson,
                                                                  List <GeospatialAreaType> geospatialAreaTypes,
                                                                  List <fGeoServerGeospatialAreaAreasContainingProjectLocation_Result> geospatialAreasContainingProjectSimpleLocation,
                                                                  bool hasProjectLocationPoint,
                                                                  List <ProjectFirmaModels.Models.GeospatialArea> selectedGeospatialAreas, bool canEdit)
        {
            var possibleGeospatialAreas = new List <fGeoServerGeospatialAreaAreasContainingProjectLocation_Result>();

            geospatialAreasContainingProjectSimpleLocation.CopyItemsTo(possibleGeospatialAreas);
            var possibleGeospatialAreaIDs = possibleGeospatialAreas.Select(y => y.GeospatialAreaID).ToList();
            var selectedGeospatialAreasNotInPossibleGeospatialAreas = selectedGeospatialAreas.Select(x => x.MakefGeoServerGeospatialAreaAreasContainingProjectLocation()).Where(x => !possibleGeospatialAreaIDs.Contains(x.GeospatialAreaID));

            possibleGeospatialAreas.AddRange(selectedGeospatialAreasNotInPossibleGeospatialAreas);
            GeospatialAreaTypes = geospatialAreaTypes.OrderBy(gat => gat.GeospatialAreaTypeName).Select(x =>
            {
                var geospatialAreaIDsContainingProjectSimpleLocation = geospatialAreasContainingProjectSimpleLocation.Where(gacpsl => gacpsl.GeospatialAreaTypeID == x.GeospatialAreaTypeID).Select(y => y.GeospatialAreaID).ToList();
                var geospatialAreaIDsInitiallySelected = selectedGeospatialAreas.Where(gacpsl => gacpsl.GeospatialAreaTypeID == x.GeospatialAreaTypeID).Select(y => y.GeospatialAreaID).ToList();
                return(new GeospatialAreaTypeSimple(x, geospatialAreaIDsContainingProjectSimpleLocation, geospatialAreaIDsInitiallySelected));
            }).ToList();
            GeospatialAreaNameByID = possibleGeospatialAreas.ToDictionary(x => x.GeospatialAreaID, y => y.GeospatialAreaShortName);
            GeospatialAreaIDsContainingProjectSimpleLocation = geospatialAreasContainingProjectSimpleLocation.Select(x => x.GeospatialAreaID).ToList();
            CanEdit                 = canEdit;
            MapInitJson             = mapInitJson;
            MapServiceUrl           = geospatialAreaTypes.FirstOrDefault().MapServiceUrl();
            HasProjectLocationPoint = hasProjectLocationPoint;
        }
Пример #6
0
        private PartialViewResult ViewEditProjectBoundingBox(Project project, EditProjectBoundingBoxViewModel viewModel)
        {
            var layerGeoJsons = new List <LayerGeoJson>
            {
                project.HasProjectLocationPoint
                        ? new LayerGeoJson("Simple Location", project.SimpleLocationToGeoJsonFeatureCollection(true),
                                           FirmaHelpers.DefaultColorRange[1], 0.8m, LayerInitialVisibility.Show)
                        : null,
                project.HasProjectLocationDetail
                        ? new LayerGeoJson("Detailed Location", project.AllDetailedLocationsToGeoJsonFeatureCollection(),
                                           FirmaHelpers.DefaultColorRange[1], 0.8m, LayerInitialVisibility.Show)
                        : null
            }
            .Where(x => x != null)
            .ToList();

            layerGeoJsons.Add(PriorityLandscape.GetPriorityLandscapeWmsLayerGeoJson("#90C3D4", 0.1m, LayerInitialVisibility.Hide));
            layerGeoJsons.Add(DNRUplandRegion.GetRegionWmsLayerGeoJson("#90C3D4", 0.1m, LayerInitialVisibility.Hide));
            var boundingBox = BoundingBox.MakeBoundingBoxFromProject(project);
            var mapInitJson = new MapInitJson("EditProjectBoundingBoxMap", 10, layerGeoJsons, 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));
        }
 public EditProjectBoundingBoxViewData(MapInitJson mapInitJson, string editProjectBoundingBoxUrl,
                                       string editProjectBoundingBoxFormID)
 {
     MapInitJson = mapInitJson;
     EditProjectBoundingBoxUrl    = editProjectBoundingBoxUrl;
     EditProjectBoundingBoxFormID = editProjectBoundingBoxFormID;
 }
        public InteractionEventDetailViewData(Person currentPerson, Models.InteractionEvent interactionEvent, string locationMapFormID, MapInitJson interactionEventLocationSummaryMapInitJson) : base(currentPerson)
        {
            IndexUrl = SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x => x.Index());

            EditInteractionEventBasicsUrl = SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x => x.EditInteractionEvent(interactionEvent.PrimaryKey));

            EditInteractionEventLocationSimpleUrl =
                SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x =>
                                                                                x.EditInteractionEventLocation(interactionEvent.PrimaryKey));

            UserHasInteractionEventManagePermissions = new InteractionEventManageFeature().HasPermissionByPerson(currentPerson);
            InteractionEvent         = interactionEvent;
            InteractionEventContacts = interactionEvent.InteractionEventContacts.ToList();
            InteractionEventProjects = interactionEvent.InteractionEventProjects.ToList();
            LocationMapFormID        = locationMapFormID;
            InteractionEventLocationSummaryMapInitJson = interactionEventLocationSummaryMapInitJson;
            PageTitle = interactionEvent.InteractionEventTitle;

            var canEditDocuments = new InteractionEventManageFeature().HasPermissionByPerson(CurrentPerson);

            InteractionEventDetailFileDetailsViewData = new FileDetailsViewData(
                EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(interactionEvent.InteractionEventFileResources)),
                SitkaRoute <InteractionEventController> .BuildUrlFromExpression(x => x.NewInteractionEventFiles(interactionEvent.PrimaryKey)),
                canEditDocuments,
                Models.FieldDefinition.InteractionEvent
                );
        }
Пример #9
0
 public DetailViewData(Person currentPerson, Models.GisFeature gisFeature, MapInitJson mapInitJson) : base(currentPerson)
 {
     GisFeature  = gisFeature;
     MapInitJson = mapInitJson;
     PageTitle   = gisFeature.GisFeatureID.ToString();
     EntityName  = "GisFeature";
 }
Пример #10
0
 public ApproveUploadGisViewData(Person currentPerson, Models.Organization organization,
                                 MapInitJson mapInitJson) : base(currentPerson)
 {
     MapInitJson           = mapInitJson;
     OrganizationDetailUrl =
         SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.Detail(organization));
 }
Пример #11
0
        public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.GeospatialArea geospatialArea,
                              MapInitJson mapInitJson, LayerGeoJson projectLocationsLayerGeoJson, ViewGoogleChartViewData viewGoogleChartViewData,
                              List <ProjectFirmaModels.Models.PerformanceMeasure> performanceMeasures,
                              List <ProjectCustomGridConfiguration> projectCustomDefaultGridConfigurations) : base(currentFirmaSession)
        {
            GeospatialArea = geospatialArea;
            MapInitJson    = mapInitJson;
            ProjectLocationsLayerGeoJson = projectLocationsLayerGeoJson;
            ViewGoogleChartViewData      = viewGoogleChartViewData;
            PageTitle = geospatialArea.GeospatialAreaName;
            GeospatialAreaTypeName           = geospatialArea.GeospatialAreaType.GeospatialAreaTypeName;
            GeospatialAreaTypeNamePluralized = geospatialArea.GeospatialAreaType.GeospatialAreaTypeNamePluralized;
            EntityName = $"{GeospatialAreaTypeName}";
            UserHasGeospatialAreaManagePermissions = new GeospatialAreaManageFeature().HasPermissionByFirmaSession(currentFirmaSession);
            IndexUrl = SitkaRoute <GeospatialAreaController> .BuildUrlFromExpression(x => x.Index(geospatialArea.GeospatialAreaType));

            var projectDetails = HttpRequestStorage.DatabaseEntities.vProjectDetails.ToDictionary(x => x.ProjectID);

            ProjectCustomDefaultGridSpec = new ProjectCustomGridSpec(currentFirmaSession, projectCustomDefaultGridConfigurations, ProjectCustomGridType.Default.ToEnum, projectDetails, currentFirmaSession.Tenant)
            {
                ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true
            };

            ProjectCustomDefaultGridName    = "geospatialAreaProjectListGrid";
            ProjectCustomDefaultGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.GeospatialAreaProjectsGridJsonData(geospatialArea));

            PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => geospatialArea.GetPerformanceMeasureChartViewData(x, currentFirmaSession)).ToList();

            GeospatialAreaDescriptionViewPageContentViewData = new ViewPageContentViewData(geospatialArea, currentFirmaSession);
        }
Пример #12
0
        public DetailViewData(Person currentPerson, Models.PriorityLandscape priorityLandscape, MapInitJson mapInitJson, ViewGoogleChartViewData viewGoogleChartViewData, List <Models.PerformanceMeasure> performanceMeasures) : base(currentPerson)
        {
            PriorityLandscape       = priorityLandscape;
            MapInitJson             = mapInitJson;
            ViewGoogleChartViewData = viewGoogleChartViewData;
            PageTitle  = priorityLandscape.PriorityLandscapeName;
            EntityName = "PriorityLandscape";
            UserHasPriorityLandscapeManagePermissions = new PriorityLandscapeManageFeature().HasPermissionByPerson(currentPerson);
            IndexUrl = SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(x => x.Index());

            BasicProjectInfoGridName = "priorityLandscapeProjectListGrid";
            BasicProjectInfoGridSpec = new ProjectIndexGridSpec(CurrentPerson, false, false, new Dictionary <int, vTotalTreatedAcresByProject>())
            {
                ObjectNameSingular  = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} in this {Models.FieldDefinition.PriorityLandscape.GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} in this {Models.FieldDefinition.PriorityLandscape.GetFieldDefinitionLabel()}",
                SaveFiltersInCookie = true
            };

            BasicProjectInfoGridDataUrl = SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(tc => tc.ProjectsGridJsonData(priorityLandscape));

            PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => priorityLandscape.GetPerformanceMeasureChartViewData(x, CurrentPerson)).ToList();

            EditPriorityLandscapeBasicsUrl = SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(plc => plc.EditPriorityLandscape(priorityLandscape));

            PriorityLandscapeFileDetailsViewData = new FileDetailsViewData(
                EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(priorityLandscape.PriorityLandscapeFileResources)),
                SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(x => x.NewPriorityLandscapeFiles(priorityLandscape.PrimaryKey)),
                UserHasPriorityLandscapeManagePermissions,
                Models.FieldDefinition.PriorityLandscape
                );
        }
Пример #13
0
 public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Tenant tenant, TenantAttribute tenantAttribute,
                       string editBasicsUrl, string editBoundingBoxUrl, string deleteTenantStyleSheetFileResourceUrl,
                       string deleteTenantSquareLogoFileResourceUrl, string deleteTenantBannerLogoFileResourceUrl,
                       string editBoundingBoxFormID, MapInitJson mapInitJson, DetailGridSpec gridSpec, string gridName,
                       string gridDataUrl, string editClassificationSystemsUrl, string editStylesheetUrl, string editTenantLogoUrl, string costTypes)
     : base(currentFirmaSession)
 {
     PageTitle                             = "Tenant Configuration";
     Tenant                                = tenant;
     TenantAttribute                       = tenantAttribute;
     EditBasicsUrl                         = editBasicsUrl;
     EditBoundingBoxUrl                    = editBoundingBoxUrl;
     EditClassificationSystemsUrl          = editClassificationSystemsUrl;
     EditStylesheetUrl                     = editStylesheetUrl;
     EditTenantLogoUrl                     = editTenantLogoUrl;
     PrimaryContactRoute                   = tenantAttribute.PrimaryContactPerson != null ? new SitkaRoute <UserController>(c => c.Detail(tenantAttribute.PrimaryContactPersonID)) : null;
     UserHasTenantManagePermissions        = new SitkaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);
     DeleteTenantStyleSheetFileResourceUrl = deleteTenantStyleSheetFileResourceUrl;
     DeleteTenantSquareLogoFileResourceUrl = deleteTenantSquareLogoFileResourceUrl;
     DeleteTenantBannerLogoFileResourceUrl = deleteTenantBannerLogoFileResourceUrl;
     IsCurrentTenant                       = HttpRequestStorage.Tenant == tenant;
     EditBoundingBoxFormID                 = editBoundingBoxFormID;
     MapInitJson                           = mapInitJson;
     GridSpec                              = gridSpec;
     GridName                              = gridName;
     GridDataUrl                           = gridDataUrl;
     UsesCostTypes                         = tenantAttribute.BudgetTypeID == BudgetType.AnnualBudgetByCostType.BudgetTypeID;
     CostTypes                             = costTypes;
 }
        public ViewResult InteractionEventDetail(InteractionEventPrimaryKey interactionEventPrimaryKey)
        {
            var interactionEvent = interactionEventPrimaryKey.EntityObject;

            var mapLocationFormID = GetMapLocationFormID(interactionEventPrimaryKey);

            //the following variables are plural because the MapInitJson constructor is expecting List<>s but InteractionEvents only have a single location point associated with them.
            var         layers           = new List <LayerGeoJson>();
            var         locationFeatures = new List <Feature>();
            BoundingBox boundingBox      = null;

            if (interactionEvent.InteractionEventLocationSimple != null)
            {
                locationFeatures.Add(DbGeometryToGeoJsonHelper.FromDbGeometry(interactionEvent.InteractionEventLocationSimple));
                boundingBox = new BoundingBox(new Point(interactionEvent.InteractionEventLocationSimple), 0.5m);
            }

            if (locationFeatures.Any())
            {
                layers.Add(new LayerGeoJson($"{FieldDefinition.InteractionEvent.FieldDefinitionDisplayName} Location",
                                            new FeatureCollection(locationFeatures), "yellow", 1,
                                            LayerInitialVisibility.Show));
            }

            var interactionEventLocationMapInitJson = new MapInitJson($"interactionEvent_{interactionEvent.InteractionEventID}_mapID", 10, layers, boundingBox);
            var viewData = new InteractionEventDetailViewData(CurrentPerson, interactionEvent, mapLocationFormID, interactionEventLocationMapInitJson);

            return(RazorView <InteractionEventDetail, InteractionEventDetailViewData>(viewData));
        }
        public ViewResult Detail(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey)
        {
            var priorityLandscape = priorityLandscapePrimaryKey.EntityObject;
            var mapDivID          = $"priorityLandscape_{priorityLandscape.PriorityLandscapeID}_Map";

            var associatedProjects = priorityLandscape.GetAssociatedProjectsVisibleToUser(CurrentPerson);
            var layers             = PriorityLandscape.GetPriorityLandscapeAndAssociatedProjectLayers(priorityLandscape, associatedProjects);
            var mapInitJson        = new MapInitJson(mapDivID, 10, layers, new BoundingBox(priorityLandscape.PriorityLandscapeLocation));

            var projectGrantAllocationExpenditures = associatedProjects.SelectMany(x => x.ProjectGrantAllocationExpenditures);
            var organizationTypes = HttpRequestStorage.DatabaseEntities.OrganizationTypes.ToList();

            const string chartTitle       = "Reported Expenditures By Organization Type";
            var          chartContainerID = chartTitle.Replace(" ", "");
            var          googleChart      = projectGrantAllocationExpenditures.ToGoogleChart(x => x.GrantAllocation.BottommostOrganization.OrganizationType.OrganizationTypeName,
                                                                                             organizationTypes.Select(x => x.OrganizationTypeName).ToList(),
                                                                                             x => x.GrantAllocation.BottommostOrganization.OrganizationType.OrganizationTypeName,
                                                                                             chartContainerID,
                                                                                             chartTitle);

            var viewGoogleChartViewData = new ViewGoogleChartViewData(googleChart, chartTitle, 405, true);

            var performanceMeasures = associatedProjects
                                      .SelectMany(x => x.PerformanceMeasureActuals)
                                      .Select(x => x.PerformanceMeasure).Distinct()
                                      .OrderBy(x => x.PerformanceMeasureDisplayName)
                                      .ToList();

            var viewData = new DetailViewData(CurrentPerson, priorityLandscape, mapInitJson, viewGoogleChartViewData, performanceMeasures);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
Пример #16
0
        public EditProjectGeospatialAreasViewDataForAngular(MapInitJson mapInitJson,
                                                            List <ProjectFirmaModels.Models.GeospatialArea> geospatialAreasInViewModel, GeospatialAreaType geospatialAreaType,
                                                            List <ProjectFirmaModels.Models.fGeoServerGeospatialAreaAreasContainingProjectLocation_Result> geospatialAreasContainingProjectSimpleLocation, bool hasProjectLocationPoint)
        {
            MapInitJson = mapInitJson;
            FindGeospatialAreaByNameUrl =
                SitkaRoute <ProjectGeospatialAreaController> .BuildUrlFromExpression(c =>
                                                                                     c.FindGeospatialAreaByName(geospatialAreaType, null));

            TypeAheadInputId = "geospatialAreaSearch";

            GeospatialAreaMapServiceLayerName = geospatialAreaType.GeospatialAreaLayerName;
            MapServiceUrl                    = geospatialAreaType.MapServiceUrl();
            GeospatialAreaTypeName           = geospatialAreaType.GeospatialAreaTypeName;
            GeospatialAreaTypeNamePluralized = geospatialAreaType.GeospatialAreaTypeNamePluralized;

            GeospatialAreaNameByID =
                geospatialAreasInViewModel.ToDictionary(x => x.GeospatialAreaID, x => x.GeospatialAreaShortName);

            GeospatialAreaNameByID.AddAll(
                geospatialAreasContainingProjectSimpleLocation
                .Where(x => !GeospatialAreaNameByID.ContainsKey(x.GeospatialAreaID)).ToDictionary(
                    x => x.GeospatialAreaID,
                    x => x.GeospatialAreaShortName));

            GeospatialAreaIDsContainingProjectSimpleLocation = geospatialAreasContainingProjectSimpleLocation
                                                               .Select(x => x.GeospatialAreaID).ToList();

            HasProjectLocationPoint = hasProjectLocationPoint;
        }
 public ApproveGisUploadViewData(List <IProjectLocationStaging> projectLocationStagings, MapInitJson mapInitJson, string mapFormID, string approveGisUploadUrl)
 {
     ProjectLocationStagings = projectLocationStagings;
     MapInitJson             = mapInitJson;
     MapFormID           = mapFormID;
     ApproveGisUploadUrl = approveGisUploadUrl;
 }
Пример #18
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));
        }
Пример #19
0
 public ProjectLocationSimpleViewData(Person currentPerson, MapInitJson mapInitJson, List <string> wmsLayerNames, Feature currentFeature, string mapPostUrl, string mapFormID, string mapServiceUrl)
     : base(currentPerson)
 {
     ViewDataForAngular = new ProjectLocationSimpleViewDataForAngular(mapInitJson, wmsLayerNames, currentFeature, mapServiceUrl);
     MapPostUrl         = mapPostUrl;
     MapFormID          = mapFormID;
 }
        public BulkSetProjectSpatialInformationViewData(FirmaSession currentFirmaSession,
                                                        IProject iProject,
                                                        List <ProjectFirmaModels.Models.GeospatialArea> geospatialAreasOnProject,
                                                        List <GeospatialAreaType> geospatialAreaTypes,
                                                        MapInitJson mapInitJson,
                                                        string editProjectGeospatialAreasUrl,
                                                        string editProjectGeospatialAreasFormID,
                                                        List <fGeoServerGeospatialAreaAreasContainingProjectLocation_Result> geospatialAreasContainingProjectSimpleLocation,
                                                        bool hasProjectLocationPoint,
                                                        bool hasProjectLocationDetail,
                                                        string editSimpleLocationUrl, bool canEdit) : base(currentFirmaSession)
        {
            var userCanViewPrivateLocations = currentFirmaSession.UserCanViewPrivateLocations(iProject.GetProject());

            ProjectSimpleLocation            = iProject.GetProjectLocationPoint(userCanViewPrivateLocations);
            GeospatialAreaTypes              = geospatialAreaTypes;
            EditProjectGeospatialAreasUrl    = editProjectGeospatialAreasUrl;
            EditProjectGeospatialAreasFormID = editProjectGeospatialAreasFormID;
            HasProjectLocationPoint          = hasProjectLocationPoint;
            HasProjectLocationDetail         = hasProjectLocationDetail;
            SimplePointMarkerImg             = "https://api.tiles.mapbox.com/v3/marker/pin-s-marker+838383.png";
            ViewDataForAngular = new BulkSetProjectSpatialInformationViewDataForAngular(mapInitJson, geospatialAreaTypes, geospatialAreasContainingProjectSimpleLocation, hasProjectLocationPoint, geospatialAreasOnProject, canEdit);

            EditSimpleLocationUrl = editSimpleLocationUrl;
        }
Пример #21
0
        public ViewResult Detail(DNRUplandRegionPrimaryKey dnrUplandRegionPrimaryKey)
        {
            var region   = dnrUplandRegionPrimaryKey.EntityObject;
            var mapDivID = $"region_{region.DNRUplandRegionID}_Map";

            var associatedProjects = region.GetAssociatedProjects(CurrentPerson);
            var layers             = DNRUplandRegion.GetRegionAndAssociatedProjectLayers(region, associatedProjects);
            var mapInitJson        = new MapInitJson(mapDivID, 10, layers, new BoundingBox(region.DNRUplandRegionLocation));

            var grantAllocationExpenditures = new List <GrantAllocationExpenditure>();

            region.GrantAllocations.ForEach(x => grantAllocationExpenditures.AddRange(x.GrantAllocationExpenditures));
            var costTypes = CostType.GetLineItemCostTypes();

            const string chartTitle       = "Grant Allocation Expenditures By Cost Type";
            var          chartContainerID = chartTitle.Replace(" ", "");
            var          googleChart      = grantAllocationExpenditures.ToGoogleChart(x => x.CostType?.CostTypeDisplayName,
                                                                                      costTypes.Select(ct => ct.CostTypeDisplayName).ToList(),
                                                                                      x => x.CostType?.CostTypeDisplayName,
                                                                                      chartContainerID,
                                                                                      chartTitle);

            var viewGoogleChartViewData = new ViewGoogleChartViewData(googleChart, chartTitle, 405, true);

            var performanceMeasures = associatedProjects
                                      .SelectMany(x => x.PerformanceMeasureActuals)
                                      .Select(x => x.PerformanceMeasure).Distinct()
                                      .OrderBy(x => x.PerformanceMeasureDisplayName)
                                      .ToList();

            var viewData = new DetailViewData(CurrentPerson, region, mapInitJson, viewGoogleChartViewData, performanceMeasures);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
Пример #22
0
 public ApproveUploadGisViewData(Person currentPerson, Models.FocusArea focusArea,
                                 MapInitJson mapInitJson) : base(currentPerson)
 {
     MapInitJson        = mapInitJson;
     FocusAreaDetailUrl =
         SitkaRoute <FocusAreaController> .BuildUrlFromExpression(c => c.Detail(focusArea));
 }
Пример #23
0
 public ApproveGisUploadViewData(List <IProjectLocationStaging> projectLocationStagings, MapInitJson mapInitJson, string mapFormID, string approveGisUploadUrl, bool showFeatureClassColumn)
 {
     ProjectLocationStagings = projectLocationStagings;
     MapInitJson             = mapInitJson;
     MapFormID              = mapFormID;
     ApproveGisUploadUrl    = approveGisUploadUrl;
     ShowFeatureClassColumn = showFeatureClassColumn;
 }
 public ProjectLocationSimpleViewDataForAngular(MapInitJson mapInitJson, List <GeospatialAreaType> geospatialAreaTypes, Feature currentFeature)
 {
     MapInitJson      = mapInitJson;
     TypeAheadInputId = "projectLocationSearch";
     GeospatialAreaMapServiceLayerNames = geospatialAreaTypes.Select(x => x.GeospatialAreaLayerName).ToList();
     MapServiceUrl  = geospatialAreaTypes.FirstOrDefault()?.MapServiceUrl();
     CurrentFeature = currentFeature;
 }
Пример #25
0
 public ViewDataForAngular(MapInitJson mapInitJson, List <Models.TreatmentBMP> treatmentBMPs,
                           string findTreatmentBMPByNameUrl, List <TreatmentBMPTypeSimple> treatmentBMPTypeSimples, List <StormwaterJurisdictionSimple> jurisdictions)
 {
     MapInitJson               = mapInitJson;
     TreatmentBMPs             = treatmentBMPs.Select(x => new TreatmentBMPSimple(x)).ToList();
     FindTreatmentBMPByNameUrl = findTreatmentBMPByNameUrl;
     TreatmentBMPTypes         = treatmentBMPTypeSimples;
     Jurisdictions             = jurisdictions;
 }
Пример #26
0
 public ProjectLocationSimpleViewDataForAngular(MapInitJson mapInitJson, List <string> wmsLayerNames, Feature currentFeature, string mapServiceUrl)
 {
     MapInitJson      = mapInitJson;
     TypeAheadInputId = "projectLocationSearch";
     ProjectLocationFieldDefinitionLabel = Models.FieldDefinition.ProjectLocation.GetFieldDefinitionLabel();
     GeospatialAreaMapServiceLayerNames  = wmsLayerNames;
     CurrentFeature = currentFeature;
     MapServiceUrl  = mapServiceUrl;
 }
Пример #27
0
            public ViewDataForAngularClass(MapInitJson ovtaBasedMapInitJson, MapInitJson areaBasedMapInitJson,
                                           MapInitJson loadBasedMapInitJson, IEnumerable <Models.TreatmentBMP> treatmentBMPs,
                                           List <TrashCaptureStatusType> trashCaptureStatusTypeSimples, List <Models.Parcel> parcels,
                                           string stormwaterJurisdictionCqlFilter, bool showDropdown,
                                           string negativeStormwaterJurisdictionCqlFilter, FeatureCollection jurisdictionsGeoJson,
                                           bool currentUserIsAnonymousOrUnassigned)
            {
                OVTABasedMapInitJson = ovtaBasedMapInitJson;
                AreaBasedMapInitJson = areaBasedMapInitJson;
                LoadBasedMapInitJson = loadBasedMapInitJson;
                // it's kind of weird that we need a "global" json that's just a copy of the OVTA-based json, but it works
                MapInitJson = OVTABasedMapInitJson;

                TreatmentBMPs                           = treatmentBMPs.Select(x => new TreatmentBMPSimple(x)).ToList();
                Parcels                                 = parcels.Select(x => new ParcelSimple(x)).ToList();
                TrashCaptureStatusTypes                 = trashCaptureStatusTypeSimples;
                StormwaterJurisdictionCqlFilter         = stormwaterJurisdictionCqlFilter;
                ShowDropdown                            = showDropdown;
                CurrentUserIsAnonymousOrUnassigned      = currentUserIsAnonymousOrUnassigned;
                NegativeStormwaterJurisdictionCqlFilter = negativeStormwaterJurisdictionCqlFilter;
                AreaBasedCalculationsUrlTemplate        =
                    new UrlTemplate <int>(SitkaRoute <TrashGeneratingUnitController> .BuildUrlFromExpression(x =>
                                                                                                             x.AcreBasedCalculations(UrlTemplate.Parameter1Int))).UrlTemplateString;

                JurisdictionsGeoJson = jurisdictionsGeoJson;

                OVTABasedResultsUrlTemplate = new UrlTemplate <int>(
                    SitkaRoute <TrashGeneratingUnitController> .BuildUrlFromExpression(x =>
                                                                                       x.OVTABasedResultsCalculations(UrlTemplate.Parameter1Int))).UrlTemplateString;

                LoadBasedResultsUrlTemplate =
                    new UrlTemplate <int>(SitkaRoute <TrashGeneratingUnitController> .BuildUrlFromExpression(x =>
                                                                                                             x.LoadBasedResultsCalculations(UrlTemplate.Parameter1Int))).UrlTemplateString;
                //LoadBasedCurrentOrNetChangeTemplate = new UrlTemplate<int>(SitkaRoute<TrashGeneratingUnitController>.BuildUrlFromExpression(x => x.LoadBasedCurrentOrNetChange(UrlTemplate.Parameter1Int))).UrlTemplateString;

                // Templates for links in detail pop-up
                OrganizationUrlTemplate =
                    new UrlTemplate <int>(
                        SitkaRoute <OrganizationController> .BuildUrlFromExpression(x =>
                                                                                    x.Detail(UrlTemplate.Parameter1Int))).UrlTemplateString;
                BMPUrlTemplate =
                    new UrlTemplate <int>(
                        SitkaRoute <TreatmentBMPController> .BuildUrlFromExpression(x =>
                                                                                    x.Detail(UrlTemplate.Parameter1Int))).UrlTemplateString;
                WQMPUrlTemplate =
                    new UrlTemplate <int>(
                        SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x =>
                                                                                                  x.Detail(UrlTemplate.Parameter1Int))).UrlTemplateString;
                OVTAAUrlTemplate =
                    new UrlTemplate <int>(
                        SitkaRoute <OnlandVisualTrashAssessmentAreaController> .BuildUrlFromExpression(x =>
                                                                                                       x.Detail(UrlTemplate.Parameter1Int))).UrlTemplateString;
                OVTAUrlTemplate =
                    new UrlTemplate <int>(
                        SitkaRoute <OnlandVisualTrashAssessmentController> .BuildUrlFromExpression(x =>
                                                                                                   x.Detail(UrlTemplate.Parameter1Int))).UrlTemplateString;
            }
 public ProjectLocationDetailViewDataForAngular(MapInitJson mapInitJson, LayerGeoJson editableLayerGeoJson, LayerGeoJson arcGisLayerGeoJson, int annotationMaxLength)
 {
     MapInitJson          = mapInitJson;
     EditableLayerGeoJson = editableLayerGeoJson;
     ArcGisLayerGeoJson   = arcGisLayerGeoJson;
     AnnotationMaxLength  = annotationMaxLength;
     GeospatialAreaMapServiceLayerNames = FirmaWebConfiguration.GetWmsLayerNames();
     ProjectLocationTypeJsons           = ProjectLocationType.GetAllProjectLocationTypeJsons();
 }
        private ViewResult ViewEditWqmpParcels(WaterQualityManagementPlan waterQualityManagementPlan, EditWqmpParcelsViewModel viewModel)
        {
            var wqmpParcelGeometries =
                waterQualityManagementPlan.WaterQualityManagementPlanParcels.Select(x => x.Parcel.ParcelGeometry4326);
            var mapInitJson = new MapInitJson("editWqmpParcelMap", 0, new List <LayerGeoJson>(), new BoundingBox(wqmpParcelGeometries));
            var viewData    = new EditWqmpParcelsViewData(CurrentPerson, waterQualityManagementPlan, mapInitJson);

            return(RazorView <EditWqmpParcels, EditWqmpParcelsViewData, EditWqmpParcelsViewModel>(viewData, viewModel));
        }
Пример #30
0
        public ViewResult Detail()
        {
            var tenant                                = HttpRequestStorage.Tenant;
            var tenantAttribute                       = MultiTenantHelpers.GetTenantAttributeFromCache();
            var editBasicsUrl                         = new SitkaRoute <TenantController>(c => c.EditBasics()).BuildUrlFromExpression();
            var editBoundingBoxUrl                    = new SitkaRoute <TenantController>(c => c.EditBoundingBox()).BuildUrlFromExpression();
            var editClassificationSystemsUrl          = new SitkaRoute <TenantController>(c => c.EditClassificationSystems()).BuildUrlFromExpression();
            var editStylesheetUrl                     = new SitkaRoute <TenantController>(c => c.EditStylesheet()).BuildUrlFromExpression();
            var editTenantLogoUrl                     = new SitkaRoute <TenantController>(c => c.EditTenantLogo()).BuildUrlFromExpression();
            var deleteTenantStyleSheetFileResourceUrl = new SitkaRoute <TenantController>(c => c.DeleteTenantStyleSheetFileResource()).BuildUrlFromExpression();
            var deleteTenantSquareLogoFileResourceUrl = new SitkaRoute <TenantController>(c => c.DeleteTenantSquareLogoFileResource()).BuildUrlFromExpression();
            var deleteTenantBannerLogoFileResourceUrl = new SitkaRoute <TenantController>(c => c.DeleteTenantBannerLogoFileResource()).BuildUrlFromExpression();
            var boundingBoxLayer                      = new LayerGeoJson("Bounding Box",
                                                                         new FeatureCollection(new List <TenantAttribute> {
                tenantAttribute
            }.Select(x => DbGeometryToGeoJsonHelper.FromDbGeometry(x.DefaultBoundingBox)).ToList()),
                                                                         FirmaHelpers.DefaultColorRange[0],
                                                                         0.8m,
                                                                         LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            var layers = MapInitJson.GetConfiguredGeospatialAreaMapLayers();

            layers.Add(boundingBoxLayer);
            var mapInitJson = new MapInitJson("TenantDetailBoundingBoxMap",
                                              10,
                                              layers,
                                              MapInitJson.GetExternalMapLayers(),
                                              BoundingBox.MakeBoundingBoxFromLayerGeoJsonList(new List <LayerGeoJson> {
                boundingBoxLayer
            }));
            var gridSpec = new DetailGridSpec {
                ObjectNameSingular = "Tenant", ObjectNamePlural = "Tenants", SaveFiltersInCookie = true
            };
            var gridName    = "Tenants";
            var gridDataUrl = new SitkaRoute <TenantController>(c => c.DetailGridJsonData()).BuildUrlFromExpression();
            var costTypes   = HttpRequestStorage.DatabaseEntities.CostTypes.ToList().Count > 0 ? string.Join(", ", HttpRequestStorage.DatabaseEntities.CostTypes.Select(x => x.CostTypeName).ToList()) : null;

            var viewData = new DetailViewData(CurrentFirmaSession,
                                              tenant,
                                              tenantAttribute,
                                              editBasicsUrl,
                                              editBoundingBoxUrl,
                                              deleteTenantStyleSheetFileResourceUrl,
                                              deleteTenantSquareLogoFileResourceUrl,
                                              deleteTenantBannerLogoFileResourceUrl,
                                              EditBoundingBoxFormID,
                                              mapInitJson,
                                              gridSpec,
                                              gridName,
                                              gridDataUrl,
                                              editClassificationSystemsUrl,
                                              editStylesheetUrl,
                                              editTenantLogoUrl,
                                              costTypes);

            return(RazorView <Detail, DetailViewData>(viewData));
        }