public HRUCharacteristicsViewData(IHaveHRUCharacteristics entityWithHRUCharacteristics, List <HRUCharacteristic> hruCharacteristics)
        {
            EntityWithHRUCharacteristics = entityWithHRUCharacteristics;

            HRUCharacteristicsSummaries = hruCharacteristics
                                          .GroupBy(x => x.HRUCharacteristicLandUseCode).Select(x => new HRUCharacteristicsSummarySimple()
            {
                Area = x.Sum(y => y.Area).ToString("N2"), ImperviousCover = x.Sum(y => y.ImperviousAcres).ToString("N2"), LandUse = x.Key.HRUCharacteristicLandUseCodeDisplayName
            })
                                          .ToList();

            HRUCharacteristicsTotal = new HRUCharacteristicsSummarySimple
            {
                LandUse         = "Total",
                Area            = hruCharacteristics.Sum(x => x.Area).ToString("N2"),
                ImperviousCover = hruCharacteristics.Sum(x => x.ImperviousAcres).ToString("N2"),
            };
        }
예제 #2
0
        // ReSharper disable once UnusedMember.Global
        public static IEnumerable <HRURequestFeature> GetHRURequestFeatures(this IHaveHRUCharacteristics iHaveHRUCharacteristics)
        {
            var baseAttributes = new HRURequestFeatureAttributes
            {
                ObjectID = iHaveHRUCharacteristics.PrimaryKey,
                Area     = iHaveHRUCharacteristics.GetCatchmentGeometry().Area.GetValueOrDefault(),
                Length   = iHaveHRUCharacteristics.GetCatchmentGeometry().Length.GetValueOrDefault(),
            };

            var catchmentGeometry =
                CoordinateSystemHelper.Project2771To2230(iHaveHRUCharacteristics.GetCatchmentGeometry());

            for (var i = 1; i <= catchmentGeometry.ElementCount; i++)
            {
                if (catchmentGeometry.ElementAt(i).SpatialTypeName.ToUpper() == "POLYGON")
                {
                    yield return(new HRURequestFeature(catchmentGeometry.ElementAt(i), baseAttributes, i));
                }
            }
        }