Example #1
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Harvests a stand (and possibly its neighbors) according to the
        /// prescription's site-selection method.
        /// </summary>
        /// <returns>
        /// The area that was harvested (units: hectares).
        /// </returns>
        // This is called by AppliedPrescription
        public virtual void Harvest(Stand stand)
        {
            if (isDebugEnabled)
            {
                log.DebugFormat("  Harvesting stand {0} by {1} ...", stand.MapCode, Name);
            }

            //set prescription name for stand
            stand.PrescriptionName = this.Name;
            stand.HarvestedRank    = AppliedPrescription.CurrentRank;
            stand.LastPrescription = this;

            stand.MinTimeSinceDamage = this.minTimeSinceDamage;

            //set current stand
            currentStand = stand;
            currentStand.ClearDamageTable();

            // SelectSites(stand) is where either complete, complete stand spreading, or partial stand
            // spreading are activated.
            // tjs - This is what gets the sites that will be harvested

            if (isSingleRepeatStep)
            {
                foreach (ActiveSite site in stand)
                {
                    // Check if this was previously harvested in the last step
                    if (stand.IsSiteSetAside(site, this.Name))
                    {
                        HarvestSite(site, stand);
                    }
                }
            }
            else
            {
                foreach (ActiveSite site in SiteSelector.SelectSites(stand))
                {
                    HarvestSite(site, stand);

                    // Only queue up for a repeat harvest if cohorts were cut
                    if (this.isSingleRepeatPrescription && cohortCounts.AllSpecies > 0)
                    {
                        stand.SetSiteAside(site, this.Name);
                    }
                }
            }
            return;
        }