Exemple #1
0
        /// <summary>
        /// Models the different land types
        /// </summary>
        /// <param name="parent"></param>
        public IEnumerable <LandType> GetLandTypes(Land parent)
        {
            List <LandType> types = new List <LandType>();

            // Iterate over the rows in the table
            int row = -1;

            foreach (string item in LandSpecs.RowNames)
            {
                row++;

                // Skip empty land types
                if (LandSpecs.GetData <string>(row, 0) == "0")
                {
                    continue;
                }

                double area = LandSpecs.GetData <double>(row, 0);

                // Create a new type model based on the current row
                types.Add(new LandType(parent)
                {
                    Name                  = LandSpecs.RowNames[row],
                    LandArea              = area,
                    PortionBuildings      = LandSpecs.GetData <double>(row, 1),
                    ProportionOfTotalArea = area / TotalArea,
                    SoilType              = LandSpecs.GetData <int>(row, 3)
                });
            }
            return(types);
        }
Exemple #2
0
        /// <summary>
        /// Builds the 'Land' subsection
        /// </summary>
        /// <param name="nab">Source NABSA</param>
        public IEnumerable <LandType> GetLandTypes(Land land)
        {
            List <LandType> types = new List <LandType>();

            var items = LandSpecs.Elements().ToArray();

            for (int i = 2; i < items.Length; i++)
            {
                var data = items[i].Elements().ToArray();
                if (data[0].Value != "0")
                {
                    LandType type = new LandType(land)
                    {
                        Name     = items[i].Name.LocalName,
                        LandArea = Convert.ToDouble(data[0].Value),
                        SoilType = Convert.ToInt32(data[3].Value)
                    };

                    types.Add(type);
                }
            }
            return(types);
        }