Ejemplo n.º 1
0
 public DepartmentPoint(int coord, Department dep)
 {
     Coord = coord;
     Owner = null;
     GrowableCoords = new List<int>(4);
     Department = dep;
 }
Ejemplo n.º 2
0
        private DepartmentPoint[] GetBorderPointsFor(City city)
        {
            LinkedList<DepartmentPoint> borderpoints = new LinkedList<DepartmentPoint>();

            foreach (DepartmentPoint point in AssignedPoints)
            {
                int right = point.Coord + 1;
                int left = point.Coord - 1;
                int up = point.Coord - 2814;
                int down = point.Coord + 2814;
                //int rightup = point.Coord + 1 - 2814;
                //int leftup = point.Coord - 1 - 2814;
                //int rightdown = point.Coord + 1 + 2814;
                //int leftdown = point.Coord - 1 + 2814;

                if (AllPoints[right] != null && AllPoints[right].Department == this.Department && AllPoints[right].Owner == city)
                {
                    borderpoints.AddLast(AllPoints[right]);
                }
                if (AllPoints[left] != null && AllPoints[left].Department == this.Department && AllPoints[left].Owner == city)
                {
                    borderpoints.AddLast(AllPoints[left]);
                }
                if (AllPoints[up] != null && AllPoints[up].Department == this.Department && AllPoints[up].Owner == city)
                {
                    borderpoints.AddLast(AllPoints[up]);
                }
                if (AllPoints[down] != null && AllPoints[down].Department == this.Department && AllPoints[down].Owner == city)
                {
                    borderpoints.AddLast(AllPoints[down]);
                }

                //if (AllPoints[rightup] != null && AllPoints[rightup].Department == this.Department && AllPoints[rightup].Owner == city)
                //{
                //    borderpoints.AddLast(AllPoints[rightup]);
                //}
                //if (AllPoints[leftup] != null && AllPoints[leftup].Department == this.Department && AllPoints[leftup].Owner == city)
                //{
                //    borderpoints.AddLast(AllPoints[leftup]);
                //}
                //if (AllPoints[rightdown] != null && AllPoints[rightdown].Department == this.Department && AllPoints[rightdown].Owner == city)
                //{
                //    borderpoints.AddLast(AllPoints[rightdown]);
                //}
                //if (AllPoints[leftdown] != null && AllPoints[leftdown].Department == this.Department && AllPoints[leftdown].Owner == city)
                //{
                //    borderpoints.AddLast(AllPoints[leftdown]);
                //}
            }

            return borderpoints.ToArray();
        }