/// <summary>
        /// Get ids for taxa that matches search criteria.
        /// </summary>
        /// <param name="searchCriteria">Red list category search criteria.</param>
        /// <param name="taxonIds">If not null, limit search to these taxa.</param>
        /// <returns>Ids for taxa that matches search criteria.</returns>
        public TaxonIdList GetTaxonIds(List <int> searchCriteria, TaxonIdList taxonIds)
        {
            int         index;
            TaxonIdList categoryTaxonIds;

            if (searchCriteria.IsEmpty() ||
                (taxonIds.IsNotNull() && taxonIds.IsEmpty()))
            {
                // No taxa matches search critera and taxa limitations.
                return(new TaxonIdList());
            }

            // Get all taxon ids that matches search criteria.
            categoryTaxonIds = this.mCategories[(RedListCategory)searchCriteria[0]].Clone();
            for (index = 1; index < searchCriteria.Count; index++)
            {
                categoryTaxonIds.AddRange(this.mCategories[(RedListCategory)searchCriteria[index]]);
            }

            if (taxonIds.IsEmpty())
            {
                taxonIds = categoryTaxonIds;
            }
            else
            {
                // Limit returned taxa.
                taxonIds.Subset(categoryTaxonIds);
            }

            return(taxonIds);
        }
示例#2
0
        /// <summary>
        /// Get ids for taxa that matches search criteria.
        /// </summary>
        /// <param name="searchCriteria">Analysis search criteria.</param>
        /// <param name="taxonIds">
        /// Limit search to these taxon ids.
        /// This parameter is ignored if value is null.
        /// </param>
        /// <returns>Ids for taxa that matches search criteria.</returns>
        public TaxonIdList GetTaxonIds(AnalysisSearchCriteria searchCriteria, TaxonIdList taxonIds = null)
        {
            TaxonIdList tempTaxonIds;

            tempTaxonIds = null;
            if (taxonIds.IsNotNull())
            {
                tempTaxonIds = new TaxonIdList();
                tempTaxonIds.AddRange(taxonIds);
            }

            //if (searchCriteria.Biotopes.IsNotNull())
            //{
            //    tempTaxonIds = Biotope.GetTaxonIds(searchCriteria.Biotopes,
            //                                       tempTaxonIds);
            //}

            //if (searchCriteria.SwedishOccurrence.IsNotNull())
            //{
            //    tempTaxonIds = SwedishOccurrence.GetTaxonIds(searchCriteria.SwedishOccurrence,
            //                                                 tempTaxonIds);
            //}

            //if (searchCriteria.CountyOccurrence.IsNotNull())
            //{
            //    tempTaxonIds = CountyOccurrence.GetTaxonIds(searchCriteria.CountyOccurrence,
            //                                                tempTaxonIds);
            //}

            //if (searchCriteria.Host.IsNotNull())
            //{
            //    tempTaxonIds = Host.GetTaxonIds(searchCriteria.Host,
            //                                    tempTaxonIds);
            //}

            //if (searchCriteria.Impact.IsNotNull())
            //{
            //    tempTaxonIds = Impact.GetTaxonIds(searchCriteria.Impact,
            //                                      tempTaxonIds);
            //}

            //if (searchCriteria.LandscapeTypes.IsNotNull())
            //{
            //    tempTaxonIds = LandscapeType.GetTaxonIds(searchCriteria.LandscapeTypes,
            //                                             tempTaxonIds);
            //}

            //if (searchCriteria.LifeForms.IsNotNull())
            //{
            //    tempTaxonIds = LifeForm.GetTaxonIds(searchCriteria.LifeForms,
            //                                        tempTaxonIds);
            //}

            //if (searchCriteria.OrganismGroups.IsNotNull())
            //{
            //    tempTaxonIds = OrganismGroup.GetTaxonIds(searchCriteria.OrganismGroups,
            //                                             tempTaxonIds);
            //}

            if (searchCriteria.RedListCategories.IsNotNull())
            {
                tempTaxonIds = RedListCategory.GetTaxonIds(searchCriteria.RedListCategories, tempTaxonIds);
            }

            //if (searchCriteria.TaxonCategories.IsNotEmpty())
            //{
            //    tempTaxonIds = TaxonScope.GetTaxonIds(searchCriteria.TaxonCategories,
            //                                                    tempTaxonIds);
            //}
            //else if (searchCriteria.TaxonScope.IsNotNull())
            //{
            //    tempTaxonIds = TaxonScope.GetTaxonIds(searchCriteria.TaxonScope,
            //                                                    tempTaxonIds);
            //}

            //if (searchCriteria.Substrate.IsNotNull())
            //{
            //    tempTaxonIds = Substrate.GetTaxonIds(searchCriteria.Substrate,
            //                                         tempTaxonIds);
            //}

            //if (searchCriteria.ThematicLists.IsNotNull())
            //{
            //    tempTaxonIds = ThematicLists.GetTaxonIds(searchCriteria.ThematicLists,
            //                                             tempTaxonIds);
            //}

            return(tempTaxonIds);
        }