本文整理汇总了C#中Stand类的典型用法代码示例。如果您正苦于以下问题:C# Stand类的具体用法?C# Stand怎么用?C# Stand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Stand类属于命名空间,在下文中一共展示了Stand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddUnharvestedNeighbors
//---------------------------------------------------------------------
/// <summary>
/// Adds a stand's unharvested neighbors and their rankings to a
/// sorted list of stand rankings.
/// </summary>
/// <remarks>
/// The stand rankings are in highest to lowest order. A neighbor is
/// only added to the list if its rank is > 0 and it isn't already in
/// the list.
/// </remarks>
public void AddUnharvestedNeighbors(Stand stand,
List<StandRanking> neighborRankings)
{
foreach (Stand neighbor in stand.Neighbors) {
if (! neighbor.Harvested) {
bool inList = false;
foreach (StandRanking ranking in neighborRankings) {
if (ranking.Stand == neighbor) {
inList = true;
break;
}
}
if (inList)
continue;
StandRanking neighborRanking = GetRanking(neighbor);
if (neighborRanking.Rank <= 0)
continue;
int i;
for (i = 0; i < neighborRankings.Count; i++) {
if (neighborRankings[i].Rank < neighborRanking.Rank)
break;
}
neighborRankings.Insert(i, neighborRanking);
}
}
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:39,代码来源:StandSpreading.cs
示例2:
//---------------------------------------------------------------------
//require that the stand wait a certain minimum time before being
//eligible for harvesting again.
bool IRequirement.MetBy(Stand stand)
{
//Model.Core.UI.WriteLine("stand {0} TimeLastHarvested = {1}", stand.MapCode, stand.TimeLastHarvested);
int time_since = Model.Core.CurrentTime - stand.TimeLastHarvested;
//Model.Core.UI.WriteLine("time_since stand {0} was harvested = {1}\n", stand.MapCode, time_since);
return time_since >= minTime;
}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:11,代码来源:MinTimeSinceLastHarvest.cs
示例3: AssignSiteToStand
//---------------------------------------------------------------------
/// <summary>
/// Assigns an active site to a particular stand.
/// </summary>
/// <param name="activeSite">
/// The active site that is being assigned to a stand.
/// </param>
/// <param name="mapCode">
/// The map code of the stand that the site is being assigned to.
/// </param>
public static void AssignSiteToStand(ActiveSite activeSite,
ushort mapCode)
{
double blockArea = (activeSite.SharesData ? Model.BlockArea : Model.Core.CellArea)
// Skip the site if its management area is not active.
if (SiteVars.ManagementArea[activeSite] == null)
return;
Stand stand;
//check if this stand is already in the dictionary
if (stands.TryGetValue(mapCode, out stand)) {
//if the stand is already in the dictionary, check if it is in the same management area.
//if it's not in the same MA, throw exception.
if (SiteVars.ManagementArea[activeSite] != stand.ManagementArea) {
throw new PixelException(activeSite.Location,
"Stand {0} is in management areas {1} and {2}",
stand.MapCode,
stand.ManagementArea.MapCode,
SiteVars.ManagementArea[activeSite].MapCode);
}
}
//valid site location which has not been keyed by the dictionary.
else {
//assign stand (trygetvalue set it to null when it wasn't found in the dictionary)
stand = new Stand(mapCode, blockArea);
//add this stand to the correct management area (pointed to by the site)
SiteVars.ManagementArea[activeSite].Add(stand);
stands[mapCode] = stand;
}
//add this site to this stand
stand.Add(activeSite);
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Disturbance,代码行数:46,代码来源:Stands.cs
示例4: ComputeRank
//---------------------------------------------------------------------
/// <summary>
/// Computes the rank for a stand.
/// </summary>
protected override double ComputeRank(Stand stand, int i)
{
SiteVars.ReInitialize();
//if (SiteVars.CFSFuelType == null)
// throw new System.ApplicationException("Error: CFS Fuel Type NOT Initialized. Fuel extension MUST be active.");
double standFireRisk = 0.0;
//Model.Core.UI.WriteLine("Base Harvest: EconomicRank.cs: ComputeRank: there are {0} sites in this stand.", stand.SiteCount);
foreach (ActiveSite site in stand) {
//double siteFireRisk = 0.0;
int fuelType = SiteVars.CFSFuelType[site];
//Model.Core.UI.WriteLine("Base Harvest: ComputeRank: FuelType = {0}.", fuelType);
FireRiskParameters rankingParameters = rankTable[fuelType];
standFireRisk = (double)rankingParameters.Rank;
//foreach (ISpeciesCohorts speciesCohorts in SiteVars.Cohorts[site])
//{
// FireRiskParameters rankingParameters = rankTable[speciesCohorts.Species];
// foreach (ICohort cohort in speciesCohorts) {
// if (rankingParameters.MinimumAge > 0 &&
// rankingParameters.MinimumAge <= cohort.Age)
// siteEconImportance += (double) rankingParameters.Rank / rankingParameters.MinimumAge * cohort.Age;
// }
//}
//standEconImportance += siteEconImportance;
}
standFireRisk /= stand.SiteCount;
return standFireRisk;
}
开发者ID:LANDIS-II-Foundation,项目名称:Library-Harvest-Mgmt,代码行数:35,代码来源:FireRiskRank.cs
示例5: ReadMap
/// <summary>
/// Reads the input map of stands.
/// </summary>
/// <param name="path">
/// Path to the map.
/// </param>
public static void ReadMap(string path)
{
Dictionary<ushort, Stand> stands = new Dictionary<ushort, Stand>();
IInputRaster<MapCodePixel> map = Model.Core.OpenRaster<MapCodePixel>(path);
using (map) {
// TODO: make sure its dimensions match landscape's dimensions
foreach (Site site in Model.Core.Landscape.AllSites) {
MapCodePixel pixel = map.ReadPixel();
// Process the pixel only if the site is active and it's
// in an active management area.
if (site.IsActive && SiteVars.ManagementArea[site] != null) {
ushort mapCode = pixel.Band0;
Stand stand;
if (stands.TryGetValue(mapCode, out stand)) {
if (SiteVars.ManagementArea[site] != stand.ManagementArea)
throw new PixelException(site.Location,
"Stand {0} is in management areas {1} and {2}",
stand.MapCode,
stand.ManagementArea.MapCode,
SiteVars.ManagementArea[site].MapCode);
}
else {
stand = new Stand(mapCode);
SiteVars.ManagementArea[site].Add(stand);
stands[mapCode] = stand;
}
stand.Add((ActiveSite) site);
}
}
}
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:38,代码来源:Stands.cs
示例6: foreach
//---------------------------------------------------------------------
bool IRequirement.MetBy(Stand stand)
{
//PlugIn.ModelCore.UI.WriteLine("checking stand {0}", stand.MapCode);
//get list of neighboring stands (must cast from enum)
List<Stand> neighbor_stands = new List<Stand>();
neighbor_stands = (List<Stand>) stand.Neighbors;
//add ma_neighbors to this list as well, to check with all the neighboring stands that are in a different management area
foreach (Stand n_stand in stand.MaNeighbors) {
neighbor_stands.Add(n_stand);
}
//loop through neighbor stands (including ma_neighbors), if one is too young then return false
foreach (Stand n_stand in neighbor_stands) {
//if n_stand is too young, return false (breaking out of loop as soon as one neighbor fails)
if (type == "StandAge") {
if (n_stand.Age < time) {
return false;
}
}
//if type was mintimesincelastharvest
else {
if (n_stand.TimeSinceLastHarvested < time) {
//PlugIn.ModelCore.UI.WriteLine("stand {0} NOT ranked.", stand.MapCode);
return false;
}
}
}
return true;
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Disturbance,代码行数:30,代码来源:StandAdjacency.cs
示例7: ReadMap
/// <summary>
/// Reads the input map of stands.
/// </summary>
/// <param name="path">
/// Path to the map.
/// </param>
public static void ReadMap(string path)
{
Stand stand;
Dictionary<uint, Stand> stands = new Dictionary<uint, Stand>();
IInputRaster<UIntPixel> map;
try
{
map = Model.Core.OpenRaster<UIntPixel>(path);
}
catch (FileNotFoundException)
{
string mesg = string.Format("Error: The file {0} does not exist", path);
throw new System.ApplicationException(mesg);
}
if (map.Dimensions != Model.Core.Landscape.Dimensions)
{
string mesg = string.Format("Error: The input map {0} does not have the same dimension (row, column) as the ecoregions map", path);
throw new System.ApplicationException(mesg);
}
using (map) {
UIntPixel pixel = map.BufferPixel;
foreach (Site site in Model.Core.Landscape.AllSites)
{
map.ReadBufferPixel();
uint mapCode = pixel.MapCode.Value;
if (site.IsActive && SiteVars.ManagementArea[site] != null)
{
if (stands.TryGetValue(mapCode, out stand)) {
//if the stand is already in the dictionary, check if it is in the same management area.
//if it's not in the same MA, throw exception.
if (SiteVars.ManagementArea[site] != stand.ManagementArea) {
string mesg = string.Format("Stand {0} is in management areas {1} and {2}",
stand.MapCode,
stand.ManagementArea.MapCode,
SiteVars.ManagementArea[site].MapCode);
throw new System.ApplicationException(mesg);
}
}
//valid site location which has not been keyed by the dictionary.
else {
//assign stand (trygetvalue set it to null when it wasn't found in the dictionary)
stand = new Stand(mapCode);
//add this stand to the correct management area (pointed to by the site)
SiteVars.ManagementArea[site].Add(stand);
stands[mapCode] = stand;
}
//add this site to this stand
stand.Add((ActiveSite) site);
}
}
}
}
开发者ID:LANDIS-II-Foundation,项目名称:Library-Harvest-Mgmt,代码行数:65,代码来源:Stands.cs
示例8:
//---------------------------------------------------------------------
//mark the whole area selected as harvested
IEnumerable<ActiveSite> ISiteSelector.SelectSites(Stand stand)
{
areaSelected = stand.ActiveArea;
stand.MarkAsHarvested();
//mark this stand's event id
stand.EventId = EventId.MakeNewId();
return stand;
}
开发者ID:LANDIS-II-Foundation,项目名称:Library-Harvest-Mgmt,代码行数:11,代码来源:CompleteStand.cs
示例9: GetRanking
//---------------------------------------------------------------------
/// <summary>
/// Gets the ranking for an unharvested stand from among the whole set
/// of stand rankings.
/// </summary>
public StandRanking GetRanking(Stand stand)
{
// Search backward through the stand rankings because unharvested
// stands are at the end of the list.
for (int i = rankings.Length - 1; i >= 0; i--) {
if (rankings[i].Stand == stand)
return rankings[i];
}
throw new System.ApplicationException("ERROR: Stand not found in rankings");
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:16,代码来源:StandSpreading.cs
示例10: Harvest
//---------------------------------------------------------------------
/// <summary>
/// Harvests a stand (and possibly its neighbors) according to the
/// repeat-harvest's site-selection method.
/// </summary>
/// <returns>
/// The area that was harvested (units: hectares).
/// </returns>
public override double Harvest(Stand stand)
{
double areaHarvested = base.Harvest(stand);
harvestedStands.Clear();
harvestedStands.Add(stand);
if (spreadingSiteSelector != null)
harvestedStands.AddRange(spreadingSiteSelector.HarvestedNeighbors);
return areaHarvested;
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:20,代码来源:RepeatHarvest.cs
示例11: SelectSites
//---------------------------------------------------------------------
public IEnumerable<ActiveSite> SelectSites(Stand stand)
{
foreach (ActiveSite activeSite in originalSelector.SelectSites(stand)) {
yield return activeSite;
// At this point, a prescription is done harvesting the
// site with age-only cohort selectors. See if any
// specific-age cohort selectors have flagged some cohorts
// for partial thinning.
PartialHarvestDisturbance.ReduceCohortBiomass(activeSite);
}
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:14,代码来源:SiteSelectorWrapper.cs
示例12:
//---------------------------------------------------------------------
//mark the whole area selected as harvested
IEnumerable<ActiveSite> ISiteSelector.SelectSites(Stand stand)
{
areaSelected = stand.ActiveArea;
stand.MarkAsHarvested();
//mark this stand's event id
stand.EventId = PlugIn.EventId;
//increment global event id number
PlugIn.EventId++;
return stand;
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:14,代码来源:CompleteStand.cs
示例13: Harvest
//---------------------------------------------------------------------
/// <summary>
/// Harvests a stand (and possibly its neighbors) according to the
/// repeat-harvest's site-selection method.
/// </summary>
/// <returns>
/// The area that was harvested (units: hectares).
/// </returns>
public override double Harvest(Stand stand)
{
if (stand.IsSetAside) {
CohortSelector = additionalCohortSelector;
SpeciesToPlant = additionalSpeciesToPlant;
}
else {
CohortSelector = initialCohortSelector;
SpeciesToPlant = initialSpeciesToPlant;
}
return base.Harvest(stand);
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:21,代码来源:SingleRepeatHarvest.cs
示例14: foreach
//---------------------------------------------------------------------
IEnumerable<ActiveSite> ISiteSelector.SelectSites(Stand stand)
{
IEnumerable<ActiveSite> selectedSites = (IEnumerable<ActiveSite>) baseClassSelectSites.Invoke(this, new object[] {stand});
foreach (ActiveSite activeSite in selectedSites) {
yield return activeSite;
// At this point, a prescription is done harvesting the
// site with age-only cohort selectors. See if any
// specific-age cohort selectors have flagged some cohorts
// for partial thinning.
PartialHarvestDisturbance.ReduceCohortBiomass(activeSite, stand);
}
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Disturbance,代码行数:15,代码来源:PartialStandSpreading.cs
示例15: SelectSites
//---------------------------------------------------------------------
public IEnumerable<ActiveSite> SelectSites(Stand stand)
{
//PlugIn.ModelCore.Log.WriteLine("Site Selector Wrapper");
foreach (ActiveSite activeSite in originalSelector.SelectSites(stand)) {
// At this point, a prescription is done harvesting the
// site with age-only cohort selectors. See if any
// specific-age cohort selectors have flagged some cohorts
// for partial thinning.
PartialHarvestDisturbance.ReduceCohortBiomass(activeSite, stand);
yield return activeSite;
}
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:18,代码来源:SiteSelectorWrapper.cs
示例16: WriteLogEntry
//---------------------------------------------------------------------
public void WriteLogEntry(Stand stand)
{
int totalSites = 0;
int damagedSites = 0;
int cohortsKilled = 0;
foreach (ActiveSite site in stand) {
totalSites++;
int cohortsKilledAtSite = SiteVars.CohortsKilled[site];
cohortsKilled += cohortsKilledAtSite;
if (cohortsKilledAtSite > 0)
damagedSites++;
}
log.WriteLine("{0},{1},{2},{3},{4}",
Model.Core.CurrentTime, stand.MapCode,
totalSites, damagedSites, cohortsKilled);
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:19,代码来源:PlugIn.cs
示例17: ComputeRank
//---------------------------------------------------------------------
/// <summary>
/// Computes the rank for a stand.
/// </summary>
/// <remarks>
/// Stands are ranked by age class so that over time harvesting will
/// result in an even distribution of sites by age classes.
/// </remarks>
protected override double ComputeRank(Stand stand, int i)
{
double freq = 0.0;
//find where the stands of this age are in the array
//and return that frequency from the freq_array
int k = 0;
for (k = 0; k < age_count; k++) {
if (stand.Age == age_array[k]) {
freq = freq_array[k];
//Model.Core.UI.WriteLine("stand {0}.\nreturning age = {1} and freq = {2}", stand.MapCode, age_array[k], freq);
//break loop when freq for this stand has been found
break;
}
}
//rank = freq * e^(age / 10) <-- using age / 10 to get a smaller number
return freq * (System.Math.Exp(stand.Age / 10));
}
开发者ID:LANDIS-II-Foundation,项目名称:Library-Harvest-Mgmt,代码行数:25,代码来源:RegulateAgesRank.cs
示例18: ComputeRank
//---------------------------------------------------------------------
/// <summary>
/// Computes the rank for a stand.
/// </summary>
protected override double ComputeRank(Stand stand)
{
double standEconImportance = 0.0;
foreach (ActiveSite site in stand) {
double siteEconImportance = 0.0;
foreach (ICohort cohort in Model.LandscapeCohorts[site]) {
EconomicRankParameters rankingParameters = rankTable[cohort.Species];
if (rankingParameters.MinimumAge > 0 &&
rankingParameters.MinimumAge <= cohort.Age)
siteEconImportance += (double) rankingParameters.Rank / rankingParameters.MinimumAge * cohort.Age;
}
standEconImportance += siteEconImportance;
}
standEconImportance /= stand.SiteCount;
return standEconImportance;
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:23,代码来源:EconomicRank.cs
示例19: SelectSites
//---------------------------------------------------------------------
public IEnumerable<ActiveSite> SelectSites(Stand stand)
{
foreach (ActiveSite activeSite in originalSelector.SelectSites(stand)) {
// At this point, a prescription is done harvesting the
// site with age-only cohort selectors. See if any
// specific-age cohort selectors have flagged some cohorts
// for partial thinning.
PartialHarvestDisturbance.ReduceCohortBiomass(activeSite, stand);
//if(BaseHarvest.SiteVars.CohortsDamaged[currentSite] <= 0) // don't double count
//Landis.Harvest.SiteVars.Stand[activeSite].LastAreaHarvested += Model.Core.CellArea;
yield return activeSite;
}
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Disturbance,代码行数:20,代码来源:SiteSelectorWrapper.cs
示例20: Harvest
//---------------------------------------------------------------------
/// <summary>
/// Harvests a stand (and possibly its neighbors) according to the
/// repeat-harvest's site-selection method.
/// </summary>
/// <returns>
/// The area that was harvested (units: hectares).
/// </returns>
public override void Harvest(Stand stand)
{
if (stand.IsSetAside) {
CohortCutter = additionalCohortCutter;
SpeciesToPlant = additionalSpeciesToPlant;
SiteSelector = additionalSiteSelector; // new CompleteStand();
//
//if(this.SiteSelectionMethod.GetType() == Landis.Extension.BiomassHarvest.PartialStandSpreading)
// SiteSelector = BiomassHarvest.WrapSiteSelector(SiteSelector);
}
else {
CohortCutter = initialCohortSelector;
SpeciesToPlant = initialSpeciesToPlant;
}
base.Harvest(stand);
return;
}
开发者ID:LANDIS-II-Foundation,项目名称:Library-Harvest-Mgmt,代码行数:27,代码来源:SingleRepeatHarvest.cs
注:本文中的Stand类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论