Ejemplo n.º 1
0
        //---------------------------------------------------------------------------------
        void ComputeInputOutput()
        {
            if (_Output == 0 || _Input == 0)
            {
                _TaxonInput  = new List <TaxonTreeNode>();
                _TaxonOutput = new List <TaxonTreeNode>();
                return;
            }

            List <TaxonTreeNode> Species = new List <TaxonTreeNode>();

            _TaxonRef.GetAllChildrenRecursively(Species, ClassicRankEnum.Espece);
            _TaxonRef.GetAllChildrenRecursively(Species, ClassicRankEnum.SousEspece);

            // new presentation:take only with images
            _TaxonOutput = new List <TaxonTreeNode>();
            foreach (TaxonTreeNode taxon in Species)
            {
                if (taxon.Desc.HasImage)
                {
                    _TaxonOutput.Add(taxon);
                }
            }
            Species = _TaxonOutput;



            if ((_Output & (int)DataEnum.Image) != 0)
            {
                _TaxonOutput = new List <TaxonTreeNode>();
                foreach (TaxonTreeNode taxon in Species)
                {
                    if (taxon.Desc.HasImage)
                    {
                        _TaxonOutput.Add(taxon);
                    }
                }
                Species = _TaxonOutput;
            }
            if ((_Output & (int)DataEnum.Sound) != 0 || (_Input & (int)DataEnum.Sound) != 0)
            {
                _TaxonOutput = new List <TaxonTreeNode>();
                foreach (TaxonTreeNode taxon in Species)
                {
                    if (taxon.Desc.HasSound)
                    {
                        _TaxonOutput.Add(taxon);
                    }
                }
                Species = _TaxonOutput;
            }
            if ((_Output & (int)DataEnum.French) != 0)
            {
                _TaxonOutput = new List <TaxonTreeNode>();
                foreach (TaxonTreeNode taxon in Species)
                {
                    if (taxon.Desc.HasFrenchName)
                    {
                        _TaxonOutput.Add(taxon);
                    }
                }
                Species = _TaxonOutput;
            }
            _TaxonOutput = Species;


            if ((_Input & (int)DataEnum.Image) != 0)
            {
                _TaxonInput = new List <TaxonTreeNode>();
                foreach (TaxonTreeNode taxon in Species)
                {
                    if (taxon.Desc.HasImage)
                    {
                        _TaxonInput.Add(taxon);
                    }
                }
                Species = _TaxonInput;
            }
            if ((_Input & (int)DataEnum.Sound) != 0)
            {
                _TaxonInput = new List <TaxonTreeNode>();
                foreach (TaxonTreeNode taxon in Species)
                {
                    if (taxon.Desc.HasSound)
                    {
                        _TaxonInput.Add(taxon);
                    }
                }
                Species = _TaxonInput;
                // temp : select only output in image with sound

                /*List<TaxonTreeNode> oldOutput = _TaxonOutput;
                 * _TaxonOutput = new List<TaxonTreeNode>();
                 * foreach (TaxonTreeNode node in oldOutput)
                 *  if (_TaxonInput.Contains(node))
                 *      _TaxonOutput.Add(node);*/
            }
            if ((_Input & (int)DataEnum.French) != 0)
            {
                _TaxonInput = new List <TaxonTreeNode>();
                foreach (TaxonTreeNode taxon in Species)
                {
                    if (taxon.Desc.HasFrenchName)
                    {
                        _TaxonInput.Add(taxon);
                    }
                }
                Species = _TaxonInput;
            }
            _TaxonInput = Species;
        }