예제 #1
0
        //---------------------------------------------------------------------
        protected override void InitializeSite(ActiveSite site)//,ICommunity initialCommunity)
        {
            lock (threadLock)
            {
                if (m == null)
                {
                    m = new MyClock(PlugIn.ModelCore.Landscape.ActiveSiteCount);
                }

                m.Next();
                m.WriteUpdate();
            }

            uint key = 0;

            allKeys.TryGetValue(site, out key);
            ICommunity initialCommunity = null;

            if (!sitesAndCommunities.TryGetValue(site, out initialCommunity))
            {
                throw new ApplicationException(string.Format("Unable to retrieve initialCommunity for site: {0}", site.Location.Row + "," + site.Location.Column));
            }

            if (!SiteCohorts.InitialSitesContainsKey(key))
            {
                // Create new sitecohorts from scratch
                SiteVars.SiteCohorts[site] = new SiteCohorts(StartDate, site, initialCommunity, UsingClimateLibrary, PlugIn.InitialCommunitiesSpinup, SiteOutputNames.ContainsKey(site) ? SiteOutputNames[site] : null);
            }
            else
            {
                // Create new sitecohorts using initialcommunities data
                SiteVars.SiteCohorts[site] = new SiteCohorts(StartDate, site, initialCommunity, SiteOutputNames.ContainsKey(site) ? SiteOutputNames[site] : null);
            }
        }