Exemple #1
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Runs the component for a particular timestep.
        /// </summary>
        /// <param name="currentTime">
        /// The current model timestep.
        /// </param>
        public override void Run()
        {
            foreach (IMapDefinition map in mapDefs)
            {
                IForestType[] forestTypes         = map.ForestTypes;
                IOutputRaster <ClassPixel> newmap = CreateMap(map.Name);
                string path = newmap.Path;
                using (newmap) {
                    ClassPixel pixel = new ClassPixel();
                    foreach (Site site in modelCore.Landscape.AllSites)
                    {
                        if (site.IsActive)
                        {
                            pixel.Band0 = CalcForestType(site, forestTypes);
                        }
                        else
                        {
                            pixel.Band0 = 0;
                        }
                        newmap.WritePixel(pixel);
                    }
                }

                //Erdas74TrailerFile.Write(path, map.ForestTypes);
            }
        }
Exemple #2
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Runs the component for a particular timestep.
        /// </summary>
        /// <param name="currentTime">
        /// The current model timestep.
        /// </param>
        public void Run(int currentTime)
        {
            foreach (IMapDefinition map in mapDefs)
            {
                IForestType[] forestTypes         = map.ForestTypes;
                IOutputRaster <ClassPixel> newmap = CreateMap(map.Name, currentTime);
                string path = newmap.Path;
                using (newmap) {
                    ClassPixel pixel = new ClassPixel();
                    foreach (Site site in Model.Landscape.AllSites)
                    {
                        if (site.IsActive)
                        {
                            pixel.Band0 = CalcForestType(cohorts[site],
                                                         forestTypes);
                        }
                        else
                        {
                            pixel.Band0 = 0;
                        }
                        newmap.WritePixel(pixel);
                    }
                }

                //Erdas74TrailerFile.Write(path, map.ForestTypes);
            }

            nextTimeToRun += timestep;
        }