Ejemplo n.º 1
0
        //---------------------------------------------------------------------------------
        public void ShowInfo(TaxonTreeNode _taxon)
        {
            if (_taxon == null)
            {
                textBox1.Text = "";
                return;
            }

            //---------------------------------------------------------------------
            // nom du père
            TaxonTreeNode DirectParentList = _taxon.Father;

            string text = "";

            //crée une string avec le text du parent
            string DirectParent = "pas de parent direct, c'est le root de l'arbre";

            if (DirectParentList != null)
            {
                DirectParent = "le parent direct est: " + DirectParentList.Desc.RefAllNames;
            }
            text += DirectParent + "\r\n\r\n";

            //---------------------------------------------------------------------
            // génération :
            text += "Generation = " + _taxon.GetGeneration().ToString() + "\r\n";
            text += "    Max level descendant = " + _taxon.GetMaxDescendentGeneration().ToString() + "\r\n";
            text += "    Last All visible generation= " + GetLastFullVisibleGeneration(_taxon).ToString() + "\r\n\r\n";

            //---------------------------------------------------------------------
            // nom de tous les enfants
            // un peu trop long maintenant

            /*
             * List<Taxon> AllChildList = new List<Taxon>();
             * _taxon.getAllChildrenRecursively(AllChildList);
             * string AllChildListAllElements;
             * if (AllChildList.Count == 0)
             *  AllChildListAllElements = "pas d'enfants.";
             * else
             * {
             *  AllChildListAllElements = "La liste de tous les enfants est : \r\n" + AllChildList[0].Name;
             *  for (int i = 1; i < AllChildList.Count; i++)
             *      AllChildListAllElements += ", " + AllChildList[i].Name;
             * }
             * text += AllChildListAllElements + "\r\n\r\n";
             */
            //---------------------------------------------------------------------
            List <TaxonTreeNode> DirectChildList = _taxon.Children;
            string DirectChildListAllElements;

            //crée une string avec le text de tous les labels de la liste
            if (DirectChildList.Count == 0)
            {
                DirectChildListAllElements = "pas d'enfants directs";
            }
            else
            {
                DirectChildListAllElements = "les enfants directs sont : \r\n" + DirectChildList[0].Desc.RefMainName;
                for (int i = 1; i < DirectChildList.Count; i++)
                {
                    DirectChildListAllElements += ", " + DirectChildList[i].Desc.RefMainName;
                }
            }
            text += DirectChildListAllElements + "\r\n\r\n";

            //---------------------------------------------------------------------
            List <TaxonTreeNode> AllParentList = new List <TaxonTreeNode>();

            _taxon.GetAllParents(AllParentList);
            string AllParentListAllElements = "les ascendants sont : \r\n";

            //crée une string avec le text de tous les labels de la liste
            for (int i = 0; i < AllParentList.Count; i++)
            {
                AllParentListAllElements += AllParentList[i].Desc.RefMainName + ", ";
            }
            text += AllParentListAllElements + "\r\n\r\n";

            //-----------------------------------------------------------------------
            List <TaxonTreeNode> genList = new List <TaxonTreeNode>();

            _taxon.GetDescendentLevel(4, genList);
            string GivenGenerationChildListAllElements = "les enfants de génération 4 de ce label sont : \r\n";

            //crée une string avec le text de tous les labels de la liste
            for (int i = 0; i < genList.Count; i++)
            {
                GivenGenerationChildListAllElements += genList[i].Desc.RefMainName + ", ";
            }
            text += GivenGenerationChildListAllElements;

            textBox1.Text = text;
        }