//--------------------------------------------------------------------- public override void Run() { if (SiteLog.Enabled) { SiteLog.TimestepSetUp(); } ProcessInputMap( delegate(Site site, LandUse newLandUse) { LandUse currentLandUse = SiteVars.LandUse[site]; if (newLandUse != currentLandUse) { SiteVars.LandUse[site] = newLandUse; string transition = string.Format("{0} --> {1}", currentLandUse.Name, newLandUse.Name); if (!currentLandUse.AllowEstablishment && newLandUse.AllowEstablishment) { string message = string.Format("Error: The land-use change ({0}) at pixel {1} requires re-enabling establishment, but that's not currently supported", transition, site.Location); throw new System.ApplicationException(message); } else if (currentLandUse.AllowEstablishment && !newLandUse.AllowEstablishment) { Reproduction.PreventEstablishment((ActiveSite)site); } if (isDebugEnabled) { log.DebugFormat(" LU at {0}: {1}", site.Location, transition); } newLandUse.LandCoverChange.ApplyTo((ActiveSite)site); if (SiteLog.Enabled) { SiteLog.WriteTotalsFor((ActiveSite)site); } return(transition); } else { return(null); } }); if (SiteLog.Enabled) { SiteLog.TimestepTearDown(); } }
//--------------------------------------------------------------------- public override void Run() { if (SiteLog.Enabled) { SiteLog.TimestepSetUp(); } if (pauseFunction != null) { pauseFunction.PauseTimestep(); } ProcessInputMap( delegate(Site site, LandUse newLandUse) { LandUse currentLandUse = SiteVars.LandUse[site]; string siteKey = null; if (newLandUse != currentLandUse) { SiteVars.LandUse[site] = newLandUse; siteKey = string.Format("{0} --> {1}", currentLandUse.Name, newLandUse.Name); if (!currentLandUse.AllowEstablishment && newLandUse.AllowEstablishment) { Reproduction.EnableEstablishment((ActiveSite)site); } else if (currentLandUse.AllowEstablishment && !newLandUse.AllowEstablishment) { Reproduction.PreventEstablishment((ActiveSite)site); } if (isDebugEnabled) { log.DebugFormat(" LU at {0}: {1}", site.Location, siteKey); } for (int i = 0; i < newLandUse.LandCoverChanges.Length; i++) { LandCover.IChange LandCoverChange = newLandUse.LandCoverChanges[i]; LandCoverChange.ApplyTo((ActiveSite)site, true); } } else { /*if (!currentLandUse.AllowEstablishment) * { * Reproduction.PreventEstablishment((ActiveSite)site); * } * else * { * Reproduction.EnableEstablishment((ActiveSite)site); * }*/ for (int i = 0; i < currentLandUse.LandCoverChanges.Length; i++) { LandCover.IChange LandCoverChange = newLandUse.LandCoverChanges[i]; LandCoverChange.ApplyTo((ActiveSite)site, false); } } if (SiteLog.Enabled) { SiteLog.WriteTotalsFor((ActiveSite)site); } return(siteKey); }); if (SiteLog.Enabled) { SiteLog.TimestepTearDown(); } }