コード例 #1
0
        public static FactorList GetSomeFactors()
        {
            FactorList factors;

            factors = new FactorList();
            foreach (Factor factor in Data.ArtDatabankenService.FactorManager.GetFactors())
            {
                if (factor.Id == LANDSCAPE_AGRICULTURE_FACTOR_ID)
                {
                    factors.Add(factor);
                }
                if (factor.Id == LANDSCAPE_FOREST_FACTOR_ID)
                {
                    factors.Add(factor);
                }
                if (factor.Id == LANDSCAPE_MOUNTAIN_FACTOR_ID)
                {
                    factors.Add(factor);
                }
                if (factor.Id == LANDSCAPE_FRESH_WATER_FACTOR_ID)
                {
                    factors.Add(factor);
                }
            }
            return(factors);
        }
コード例 #2
0
        public void RemoveSelectionTaxon()
        {
            FactorList factors;
            IFactor    factor1, factor2;
            Int32      speciesFactCount;
            ITaxon     taxon1, taxon2;
            TaxonList  taxa;

            factor1 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.SwedishHistory);
            factor2 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.SwedishOccurrence);
            taxon1  = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.DrumGrasshopper);
            taxon2  = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.Wolverine);
            factors = new FactorList();
            factors.Add(factor1);
            factors.Add(factor2);
            taxa = new TaxonList();
            taxa.Add(taxon1);
            taxa.Add(taxon2);
            GetDataSet(true).AddSelection(GetUserContext(), factors);
            GetDataSet().AddSelectionTaxa(GetUserContext(), taxa);

            speciesFactCount = GetDataSet().SpeciesFacts.Count;
            Assert.IsFalse(GetDataSet().Taxa.IsEmpty());
            Assert.IsFalse(GetDataSet().SpeciesFacts.IsEmpty());
            GetDataSet().RemoveSelectionTaxon(GetUserContext(), taxon1);
            Assert.IsFalse(GetDataSet().Taxa.IsEmpty());
            Assert.IsFalse(GetDataSet().SpeciesFacts.IsEmpty());
            Assert.IsTrue(speciesFactCount > GetDataSet().SpeciesFacts.Count);
            taxon1 = null;
            GetDataSet().RemoveSelectionTaxon(GetUserContext(), taxon1);
        }
コード例 #3
0
        public void AddSelectionHost()
        {
            FactorList factors;
            IFactor    factor1, factor2;
            Int32      speciesFactCount;
            ITaxon     host, taxon1, taxon2;
            TaxonList  taxa;

            factor1 = CoreData.FactorManager.GetFactor(GetUserContext(), 1137); // Svampdelar (inkl lavar).
            factor2 = CoreData.FactorManager.GetFactor(GetUserContext(), 1138); // Mycel.
            taxon1  = CoreData.TaxonManager.GetTaxon(GetUserContext(), 100090); // Nötkråka.
            taxon2  = CoreData.TaxonManager.GetTaxon(GetUserContext(), 100381); //tvåfläckig barkskinnbagge
            factors = new FactorList();
            factors.Add(factor1);
            factors.Add(factor2);
            taxa = new TaxonList();
            taxa.Add(taxon1);
            taxa.Add(taxon2);

            GetDataSet(true).AddSelection(GetUserContext(), factors);
            GetDataSet().AddSelectionTaxa(GetUserContext(), taxa);

            speciesFactCount = GetDataSet().SpeciesFacts.Count;
            host             = CoreData.TaxonManager.GetTaxon(GetUserContext(), 230260); // skägglav.
            GetDataSet().AddSelectionHost(GetUserContext(), host);
            Assert.IsTrue(speciesFactCount > GetDataSet().SpeciesFacts.Count);
            host = null;
            GetDataSet().AddSelectionHost(GetUserContext(), host);
        }
コード例 #4
0
        public void RemoveSelectionSpeciesFactDataSetSelection()
        {
            FactorList factors;
            IFactor    factor1, factor2;
            Int32      speciesFactCount;
            ISpeciesFactDataSetSelection selection;
            ITaxon    taxon1, taxon2;
            TaxonList taxa;

            factor1 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.RedlistCategory);
            factor2 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.Redlist_OrganismLabel1);
            taxon1  = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.DrumGrasshopper);
            taxon2  = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.Wolverine);
            factors = new FactorList();
            factors.Add(factor1);
            factors.Add(factor2);
            taxa = new TaxonList();
            taxa.Add(taxon1);
            taxa.Add(taxon2);
            selection         = new SpeciesFactDataSetSelection();
            selection.Factors = factors;
            selection.Taxa    = taxa;
            GetDataSet(true).AddSelection(GetUserContext(), selection);
            Assert.IsFalse(GetDataSet().Factors.IsEmpty());
            Assert.IsFalse(GetDataSet().Taxa.IsEmpty());
            Assert.IsFalse(GetDataSet().SpeciesFacts.IsEmpty());
            speciesFactCount = GetDataSet().SpeciesFacts.Count;
            selection        = new SpeciesFactDataSetSelection();
            selection.Factors.Add(factor1);
            selection.Taxa.Add(taxon1);
            GetDataSet().RemoveSelection(GetUserContext(), selection);
            Assert.IsTrue(speciesFactCount > GetDataSet().SpeciesFacts.Count);
        }
コード例 #5
0
        public void RemoveSelectionPeriods()
        {
            FactorList factors;
            IFactor    factor1, factor2;
            Int32      speciesFactCount;
            ITaxon     taxon1, taxon2;
            PeriodList periods;
            TaxonList  taxa;

            factor1 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.RedlistCategory);
            factor2 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.Redlist_OrganismLabel1);
            taxon1  = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.DrumGrasshopper);
            taxon2  = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.Wolverine);
            factors = new FactorList();
            factors.Add(factor1);
            factors.Add(factor2);
            taxa = new TaxonList();
            taxa.Add(taxon1);
            taxa.Add(taxon2);
            GetDataSet(true).AddSelection(GetUserContext(), factors);
            GetDataSet().AddSelectionTaxa(GetUserContext(), taxa);

            GetDataSet().AddSelection(GetUserContext(), CoreData.FactorManager.GetPeriods(GetUserContext()));
            speciesFactCount = GetDataSet().SpeciesFacts.Count;
            periods          = new PeriodList();
            periods.Add(GetDataSet().Periods[0]);
            periods.Add(GetDataSet().Periods[1]);
            GetDataSet().RemoveSelection(GetUserContext(), periods);
            Assert.IsFalse(GetDataSet().Factors.IsEmpty());
            Assert.IsFalse(GetDataSet().SpeciesFacts.IsEmpty());
            Assert.IsTrue(speciesFactCount > GetDataSet().SpeciesFacts.Count);
            periods = null;
            GetDataSet().RemoveSelection(GetUserContext(), periods);
        }
コード例 #6
0
        public void AddSelectionIndividualCategory()
        {
            FactorList          factors;
            IFactor             factor1, factor2;
            IIndividualCategory individualCategory;
            Int32     speciesFactCount;
            ITaxon    taxon1, taxon2;
            TaxonList taxa;

            factor1 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.SwedishHistory);
            factor2 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.SwedishOccurrence);
            taxon1  = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.DrumGrasshopper);
            taxon2  = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.Wolverine);
            factors = new FactorList();
            factors.Add(factor1);
            factors.Add(factor2);
            taxa = new TaxonList();
            taxa.Add(taxon1);
            taxa.Add(taxon2);
            GetDataSet(true).AddSelection(GetUserContext(), factors);
            GetDataSet().AddSelectionTaxa(GetUserContext(), taxa);

            speciesFactCount   = GetDataSet().SpeciesFacts.Count;
            individualCategory = CoreData.FactorManager.GetDefaultIndividualCategory(GetUserContext());
            GetDataSet().AddSelection(GetUserContext(), individualCategory);
            Assert.IsFalse(GetDataSet().Factors.IsEmpty());
            Assert.IsFalse(GetDataSet().SpeciesFacts.IsEmpty());
            Assert.AreEqual(speciesFactCount, GetDataSet().SpeciesFacts.Count);
            GetDataSet().AddSelection(GetUserContext(), CoreData.FactorManager.GetIndividualCategories(GetUserContext())[3]);
            Assert.IsTrue(speciesFactCount < GetDataSet().SpeciesFacts.Count);
            individualCategory = null;
            GetDataSet().AddSelection(GetUserContext(), individualCategory);
        }
コード例 #7
0
        /// <summary>
        /// Constructor of a County occurrece map object.
        /// Make sure that the static methos InitializeMap is called before using this constructor.
        /// </summary>
        /// <param name="countyOccurrences">Information about county occurrence.</param>
        public CountyOccurrenceMap(SpeciesFactList countyOccurrences)
        {
            FontName           = TEXT_FONT;
            _countyInformation = countyOccurrences;
            _counties          = new FactorList();
            if (_countyInformation.IsNotEmpty())
            {
                foreach (SpeciesFact fact in _countyInformation)
                {
                    _counties.Add(fact.Factor);
                }
            }

            UpdateInformation = null;
        }
コード例 #8
0
        /// <summary>
        /// Read rows from the excel xml format.
        /// Overridden by each class that inherits this class.
        /// </summary>
        /// <param name="userContext">
        /// Information about the user that makes this method call.
        /// </param>
        /// <param name='xmlDoc'>The xml document that the row node will be read from.</param>
        /// <param name="nsmgr">Namespacemanager containing all namespaces used by the excel compatible xml format</param>
        protected override void ReadExcelXmlRows(IUserContext userContext,
                                                 XmlDocument xmlDoc,
                                                 XmlNamespaceManager nsmgr)
        {
            FactorList  factors;
            XmlNode     dataNode;
            XmlNodeList rowNodes;

            rowNodes = xmlDoc.SelectNodes("/ss:Workbook/ss:Worksheet/ss:Table/ss:Row", nsmgr);
            factors  = new FactorList();
            foreach (XmlNode rowNode in rowNodes)
            {
                dataNode = rowNode.SelectSingleNode("ss:Cell/ss:Data", nsmgr);
                factors.Add(CoreData.FactorManager.GetFactor(userContext, dataNode.InnerText.WebParseInt32()));
            }

            Factors = factors;
        }
コード例 #9
0
        /// <summary>
        /// Convert a list of WebFactor instances
        /// to a FactorList.
        /// </summary>
        /// <param name="userContext">
        /// Information about the user that makes this method call.
        /// </param>
        /// <param name="webFactors">List of WebFactor instances.</param>
        /// <returns>Factors.</returns>
        private FactorList GetFactors(IUserContext userContext, List <WebFactor> webFactors)
        {
            FactorList           factors;
            FactorDataTypeList   factorDataTypes   = CoreData.FactorManager.GetFactorDataTypes(userContext);
            FactorOriginList     factorOrigins     = CoreData.FactorManager.GetFactorOrigins(userContext);
            FactorUpdateModeList factorUpdateModes = CoreData.FactorManager.GetFactorUpdateModes(userContext);

            factors = null;
            if (webFactors.IsNotEmpty())
            {
                factors = new FactorList();
                foreach (WebFactor webFactor in webFactors)
                {
                    factors.Add(GetFactor(userContext, webFactor, factorDataTypes, factorOrigins, factorUpdateModes));
                }

                factors.Sort();
            }

            return(factors);
        }