Пример #1
0
        public DetailViewData(Person currentPerson, Models.RegionalSubbasin regionalSubbasin, HRUCharacteristicsViewData hruCharacteristicsViewData, StormwaterMapInitJson mapInitJson, bool hasAnyHRUCharacteristics) : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            HasAnyHRUCharacteristics = hasAnyHRUCharacteristics;
            EntityName = "Regional Subbasin";
            EntityUrl  = SitkaRoute <RegionalSubbasinController> .BuildUrlFromExpression(x => x.Index());

            PageTitle = $"{regionalSubbasin.Watershed} {regionalSubbasin.DrainID}: {regionalSubbasin.RegionalSubbasinID}";

            RegionalSubbasin           = regionalSubbasin;
            HRUCharacteristicsViewData = hruCharacteristicsViewData;
            MapInitJson = mapInitJson;
        }
Пример #2
0
        public DelineationMapViewData(Person currentPerson, Models.NeptunePage neptunePage, StormwaterMapInitJson mapInitJson, Models.TreatmentBMP initialTreatmentBMP, string bulkUploadTreatmentBMPDelineationsUrl) : base(currentPerson, neptunePage, NeptuneArea.OCStormwaterTools)
        {
            MapInitJson = mapInitJson;
            IsInitialTreatmentBMPProvided = initialTreatmentBMP != null;
            InitialTreatmentBMPID         = initialTreatmentBMP?.TreatmentBMPID;
            EntityName   = FieldDefinitionType.Delineation.FieldDefinitionTypeDisplayName;
            PageTitle    = "Delineation Map";
            GeoServerUrl = NeptuneWebConfiguration.ParcelMapServiceUrl;

            DelineationMapConfig = new DelineationMapConfig(currentPerson.GetStormwaterJurisdictionCqlFilter());
            BulkUploadTreatmentBMPDelineationsUrl = bulkUploadTreatmentBMPDelineationsUrl;
            HasManagePermission = new JurisdictionManageFeature().HasPermissionByPerson(currentPerson);
        }
Пример #3
0
        public ViewResult Index()
        {
            var stormwaterJurisdictionsPersonCanView = CurrentPerson.GetStormwaterJurisdictionsPersonCanView().ToList();

            if (!stormwaterJurisdictionsPersonCanView.Any())
            {
                throw new SitkaRecordNotAuthorizedException(
                          "You are not assigned to any Jurisdictions. Please log out and log in as a different user or request additional permissions");
            }

            var stormwaterJurisdictionIDsPersonCanView = stormwaterJurisdictionsPersonCanView.Select(x => x.StormwaterJurisdictionID);
            var treatmentBmps            = CurrentPerson.GetTreatmentBmpsPersonCanView();
            var treatmentBMPLayerGeoJson = new LayerGeoJson("Treatment BMPs", treatmentBmps.ToGeoJsonFeatureCollectionForTrashMap(), "blue", 1, LayerInitialVisibility.Show)
            {
                EnablePopups = false
            };

            var parcels = HttpRequestStorage.DatabaseEntities.Parcels.Include(x => x.WaterQualityManagementPlanParcels).Include(x => x.WaterQualityManagementPlanParcels.Select(y => y.WaterQualityManagementPlan)).Where(x => x.WaterQualityManagementPlanParcels.Any()).ToList();

            var parcelLayerGeoJson = new LayerGeoJson("Parcels", parcels.ToGeoJsonFeatureCollectionForTrashMap(), "blue", 1, LayerInitialVisibility.Show)
            {
                EnablePopups = false
            };

            var boundingBox = BoundingBox.GetBoundingBox(stormwaterJurisdictionsPersonCanView);
            var geoJsonForJurisdictions = StormwaterJurisdiction.ToGeoJsonFeatureCollection(stormwaterJurisdictionsPersonCanView);
            var jurisdictionLayersGeoJson = new List <LayerGeoJson> {
                new LayerGeoJson(MapInitJsonHelpers.CountyCityLayerName, geoJsonForJurisdictions, "#FF6C2D", 0m, LayerInitialVisibility.Hide)
            }.ToList(); var ovtaBasedMapInitJson = new TrashModuleMapInitJson("ovtaBasedResultsMap", treatmentBMPLayerGeoJson, parcelLayerGeoJson, boundingBox, jurisdictionLayersGeoJson)

            {
                LayerControlClass = "ovta-based-map-layer-control"
            };
            var areaBasedMapInitJson = new StormwaterMapInitJson("areaBasedResultsMap", boundingBox, jurisdictionLayersGeoJson)
            {
                LayerControlClass = "area-based-map-layer-control"
            };
            var loadBasedMapInitJson = new StormwaterMapInitJson("loadBasedResultsMap", boundingBox, jurisdictionLayersGeoJson)
            {
                LayerControlClass = "load-based-map-layer-control"
            };
            var neptunePage = NeptunePage.GetNeptunePageByPageType(NeptunePageType.TrashHomePage);
            var viewData    = new IndexViewData(CurrentPerson, neptunePage, ovtaBasedMapInitJson, areaBasedMapInitJson,
                                                loadBasedMapInitJson, treatmentBmps, TrashCaptureStatusType.All, parcels, stormwaterJurisdictionsPersonCanView, geoJsonForJurisdictions);

            return(RazorView <Index, IndexViewData>(viewData));
        }
Пример #4
0
        public ViewResult Detail(RegionalSubbasinPrimaryKey regionalSubbasinPrimaryKey)
        {
            var regionalSubbasin = regionalSubbasinPrimaryKey.EntityObject;
            var regionalSubbasinCatchmentGeometry4326 = regionalSubbasin.CatchmentGeometry4326;

            var geoJson = DbGeometryToGeoJsonHelper.FromDbGeometryWithNoReproject(regionalSubbasinCatchmentGeometry4326);
            var geoJsonFeatureCollection = new FeatureCollection(new List <Feature> {
                geoJson
            });
            var layerGeoJson          = new LayerGeoJson("Catchment Boundary", geoJsonFeatureCollection, "#000000", 1, LayerInitialVisibility.Show, false);
            var stormwaterMapInitJson = new StormwaterMapInitJson("map", MapInitJson.DefaultZoomLevel, new List <LayerGeoJson> {
                layerGeoJson
            }, new BoundingBox(regionalSubbasinCatchmentGeometry4326));


            var hruCharacteristics = regionalSubbasin.GetHRUCharacteristics().ToList();

            return(RazorView <Detail, DetailViewData>(new DetailViewData(CurrentPerson,
                                                                         regionalSubbasin,
                                                                         new HRUCharacteristicsViewData(regionalSubbasin, hruCharacteristics),
                                                                         stormwaterMapInitJson, hruCharacteristics.Any())));
        }
        public ViewResult Detail(WaterQualityManagementPlanPrimaryKey waterQualityManagementPlanPrimaryKey)
        {
            var waterQualityManagementPlan = waterQualityManagementPlanPrimaryKey.EntityObject;

            var parcels = waterQualityManagementPlan.WaterQualityManagementPlanParcels
                          .Select(x => x.Parcel).ToList();
            var parcelGeoJsonFeatureCollection = parcels.ToGeoJsonFeatureCollection();
            var treatmentBMPs = CurrentPerson.GetInventoriedBMPsForWQMP(waterQualityManagementPlanPrimaryKey);
            var treatmentBmpGeoJsonFeatureCollection =
                treatmentBMPs.ToGeoJsonFeatureCollection();

            treatmentBmpGeoJsonFeatureCollection.Features.ForEach(x =>
            {
                var treatmentBmpID = x.Properties.ContainsKey("TreatmentBMPID")
                    ? int.Parse(x.Properties["TreatmentBMPID"].ToString())
                    : (int?)null;
                if (treatmentBmpID != null)
                {
                    x.Properties.Add("PopupUrl", SitkaRoute <TreatmentBMPController> .BuildUrlFromExpression(c => c.MapPopup(treatmentBmpID)));
                }
            });

            //var boundingBoxGeometries = new List<DbGeometry>();
            //boundingBoxGeometries.AddRange(treatmentBMPs.Select(x=>x.LocationPoint4326));
            //boundingBoxGeometries.AddRange(parcels.Select(x=>x.ParcelGeometry4326));

            var layerGeoJsons = new List <LayerGeoJson>
            {
                new LayerGeoJson(FieldDefinitionType.Parcel.GetFieldDefinitionLabelPluralized(),
                                 parcelGeoJsonFeatureCollection,
                                 ParcelModelExtensions.ParcelColor,
                                 1,
                                 LayerInitialVisibility.Show),
                new LayerGeoJson(FieldDefinitionType.TreatmentBMP.GetFieldDefinitionLabelPluralized(),
                                 treatmentBmpGeoJsonFeatureCollection,
                                 "#935f59",
                                 1,
                                 LayerInitialVisibility.Show)
            };
            //var mapInitJson = new MapInitJson("waterQualityManagementPlanMap", 0, layerGeoJsons,
            //    new BoundingBox(boundingBoxGeometries));

            var mapInitJson = new MapInitJson("waterQualityManagementPlanMap", 0, layerGeoJsons,
                                              BoundingBox.MakeBoundingBoxFromLayerGeoJsonList(layerGeoJsons));

            if (treatmentBMPs.Any(x => x.Delineation != null))
            {
                mapInitJson.Layers.Add(StormwaterMapInitJson.MakeDelineationLayerGeoJson(
                                           treatmentBMPs.Where(x => x.Delineation != null).Select(x => x.Delineation)));
            }

            var waterQualityManagementPlanVerifies = HttpRequestStorage.DatabaseEntities.WaterQualityManagementPlanVerifies.Where(x =>
                                                                                                                                  x.WaterQualityManagementPlanID == waterQualityManagementPlan.PrimaryKey).OrderByDescending(x => x.VerificationDate).ToList();
            var waterQualityManagementPlanVerifyDraft = waterQualityManagementPlanVerifies.SingleOrDefault(x => x.IsDraft);

            var waterQualityManagementPlanVerifyQuickBMP =
                HttpRequestStorage.DatabaseEntities.WaterQualityManagementPlanVerifyQuickBMPs.Where(x =>
                                                                                                    x.WaterQualityManagementPlanVerify.WaterQualityManagementPlanID ==
                                                                                                    waterQualityManagementPlan.WaterQualityManagementPlanID).ToList();
            var waterQualityManagementPlanVerifyTreatmentBMP =
                HttpRequestStorage.DatabaseEntities.WaterQualityManagementPlanVerifyTreatmentBMPs.Where(x =>
                                                                                                        x.WaterQualityManagementPlanVerify.WaterQualityManagementPlanID ==
                                                                                                        waterQualityManagementPlan.WaterQualityManagementPlanID).ToList();

            var anyLspcBasins = waterQualityManagementPlan.WaterQualityManagementPlanBoundary != null && HttpRequestStorage.DatabaseEntities.LSPCBasins.Any(x =>
                                                                                                                                                            x.LSPCBasinGeometry.Intersects(waterQualityManagementPlan.WaterQualityManagementPlanBoundary));

            var dryWeatherFlowOverrides = DryWeatherFlowOverride.All;
            var waterQualityManagementPlanModelingApproaches = WaterQualityManagementPlanModelingApproach.All;

            var viewData = new DetailViewData(CurrentPerson, waterQualityManagementPlan,
                                              waterQualityManagementPlanVerifyDraft, mapInitJson, treatmentBMPs, new ParcelGridSpec(),
                                              waterQualityManagementPlanVerifies, waterQualityManagementPlanVerifyQuickBMP,
                                              waterQualityManagementPlanVerifyTreatmentBMP,
                                              new HRUCharacteristicsViewData(waterQualityManagementPlan,
                                                                             ((IHaveHRUCharacteristics)waterQualityManagementPlan).GetHRUCharacteristics().ToList()),
                                              anyLspcBasins, dryWeatherFlowOverrides, waterQualityManagementPlanModelingApproaches, new ModeledPerformanceViewData(waterQualityManagementPlan, CurrentPerson));

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