/// <summary>
        /// Create calculation features based on the provided <see cref="MapCalculationData"/>.
        /// </summary>
        /// <param name="calculationData">The collection of <see cref="MapCalculationData"/> to create the
        /// calculation features for.</param>
        /// <returns>A collection of features or an empty collection when <paramref name="calculationData"/> is <c>null</c>
        /// or empty.</returns>
        public static IEnumerable <MapFeature> CreateCalculationFeatures(IEnumerable <MapCalculationData> calculationData)
        {
            if (calculationData != null && calculationData.Any())
            {
                var features = new MapFeature[calculationData.Count()];

                for (var i = 0; i < calculationData.Count(); i++)
                {
                    MapCalculationData calculationItem = calculationData.ElementAt(i);
                    MapFeature         feature         = CreateSingleLineMapFeature(new[]
                    {
                        calculationItem.CalculationLocation,
                        calculationItem.HydraulicBoundaryLocation.Location
                    });

                    feature.MetaData[RiskeerCommonUtilResources.MetaData_Name] = calculationItem.Name;
                    feature.MetaData[Resources.MetaData_Couple_distance]       =
                        calculationItem.CalculationLocation.GetEuclideanDistanceTo(
                            calculationItem.HydraulicBoundaryLocation.Location);

                    features[i] = feature;
                }

                return(features);
            }

            return(new MapFeature[0]);
        }
Пример #2
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            const string calculationName           = "name";
            var          calculationLocation       = new Point2D(0.0, 2.3);
            var          hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 0.1, 2.3);

            // Call
            var mapCalculationData = new MapCalculationData(calculationName,
                                                            calculationLocation,
                                                            hydraulicBoundaryLocation);

            // Assert
            Assert.AreEqual(calculationName, mapCalculationData.Name);
            Assert.AreSame(calculationLocation, mapCalculationData.CalculationLocation);
            Assert.AreSame(hydraulicBoundaryLocation, mapCalculationData.HydraulicBoundaryLocation);
        }