Пример #1
0
 void SortPlantsByCoords()
 {
     mPlants.Sort(delegate(Plant FirstPlant, Plant SecondPlant)
     {
         double eps = 0.001;
         if (Math.Abs(FirstPlant.GetCenter().X - SecondPlant.GetCenter().X) < eps)
         {
             return(FirstPlant.GetCenter().Y < SecondPlant.GetCenter().Y ? -1 : 1);
         }
         return(FirstPlant.GetCenter().X < SecondPlant.GetCenter().X ? -1 : 1);
     });
 }
Пример #2
0
        List <Plant> SortPlantsForDraw()
        {
            List <Plant> SortedPlants = new List <Plant>(mPlants);

            SortedPlants.Sort(delegate(Plant FirstPlant, Plant SecondPlant)
            {
                if (FirstPlant.CalcArea() > SecondPlant.CalcArea())
                {
                    return(-1);
                }
                return(1);
            });

            return(SortedPlants);
        }