Esempio n. 1
0
        /// <summary>
        /// Evaluates if tree is valid.
        /// More restrictive evaluation is optional.
        /// pCathegorize => assign invalid tree to InvalidTrees and remove from Trees
        /// pFinal => trees at array buffer positions will be invalid
        /// </summary>
        public static void ValidateTrees(bool pCathegorize, bool pRestrictive, bool pFinal = false)
        {
            CDebug.WriteLine("Detect invalid trees", true);

            for (int i = Trees.Count - 1; i >= 0; i--)
            {
                CTree tree = Trees[i];

                bool isValid = tree.Validate(pRestrictive, pFinal);

                if (!isValid)
                {
                    if (pCathegorize)
                    {
                        InvalidTrees.Add(tree);
                        Trees.RemoveAt(i);
                    }
                }
            }
        }
Esempio n. 2
0
 public static int GetInvalidTreesAtBorderCount()
 {
     return(InvalidTrees.Count(tree => tree.IsAtBorder()));
 }
Esempio n. 3
0
 private void GenerateAreaTreeIndex()
 {
     // For legality purpose only the tree index is needed, group the trees data by their index, trees with the same index are indistinguishable
     ValidTreeIndex   = ValidTrees.Select(t => t.Index).Distinct().OrderBy(i => i).ToArray();
     InvalidTreeIndex = InvalidTrees.Select(t => t.Index).Distinct().OrderBy(i => i).Except(ValidTreeIndex).ToArray();
 }