Code Search for Developers
 
 
  

InterfaceGrid.cs from MASE: Agile Software Engineering at Krugle


Show InterfaceGrid.cs syntax highlighted

using System;
using System.Drawing;
using System.Collections;
using Tao.Platform.Windows;
using Tao.OpenGl;

namespace New_Study_Project
{


	internal class GridNode {

		// The order of the objects/territories/lazy suzan in the list can be determined by
		// their index value in their respective ArrayLists.  The smallest indexed
		// object/territory/lazy suzan is on the bottom, and the largest indexed object/territory
		// is on the top, and the rest ordered accordingly.

		// variables for storing items in the interface grid
		private ArrayList storageInGrid = new ArrayList();
		private ArrayList objectsInGrid = new ArrayList();     // holds all of the objects currently in the workspace
		private ArrayList IOSELObjectInGrid = new ArrayList();
		private ArrayList controlPointsInGrid = new ArrayList();
		private ArrayList MoveSplinesInGrid = new ArrayList(); //holds all of the lazy suzan MoveSplines currently in the workspace
		private ArrayList objectButtonsInGrid = new ArrayList();
	
		public GridNode() {

		} // public GridNode()


		public void addStorageButton(StorageButton btn) 
		{
			storageInGrid.Add(btn);
		} 

		public void addObject(InterfaceObject obj) {
			objectsInGrid.Add(obj);
		} // public void addObject(...)

		public void addObjectFirst(InterfaceObject obj) 
		{
			objectsInGrid.Insert(0, obj);
		} 

		public void addIOSELObject(IOSelectObject IOSEL) 
		{
			IOSELObjectInGrid.Add(IOSEL);
		}

		public void addControlPoint(ControlPoint c_point)			//add a controlPoint to the controlPointList
		{
			controlPointsInGrid.Add(c_point);
		}

		
		public void addObjectButton(ObjectButton button)
		{
			objectButtonsInGrid.Add(button);
		}
		
		public void addMoveSpline(Spline suzan)
		{
			if(!MoveSplinesInGrid.Contains(suzan))
			{
				MoveSplinesInGrid.Add(suzan);
			}
		}

		public void removeStorageButton(StorageButton btn) 
		{
			storageInGrid.Remove(btn);
		}

		public void removeObject(InterfaceObject obj) 
		{

			objectsInGrid.Remove(obj);

		} // public void removeObject()

		public void removeIOSELObject(IOSelectObject IOSEL) 
		{
			IOSELObjectInGrid.Remove(IOSEL);
		}

		public void removeControlPoint(ControlPoint c_point) 
		{

			controlPointsInGrid.Remove(c_point);

		} 

		public void removeObjectButton(ObjectButton button) 
		{

			objectButtonsInGrid.Remove(button);

		} 

		public StorageButton getTopStorageButton()
		{
			if (storageInGrid.Count == 0) 
			{
				return null;
			} 
			else 
			{
				return (StorageButton) storageInGrid[storageInGrid.Count - 1];
			}												
		}

		public ObjectButton getTopObjectButton()
		{
			if(this.objectButtonsInGrid.Count == 0)
			{
				return null;
			}

			ObjectButton topObjectButton = null;

			foreach(ObjectButton button in objectButtonsInGrid)
			{
				topObjectButton = button;
			}
			return topObjectButton;
															
		}

		public void removeMoveSpline(Spline susan) 
		{
			
			if (MoveSplinesInGrid.Contains(susan)) 
			{
				MoveSplinesInGrid.Remove(susan);
			}

		} 
 
		public ArrayList getStorage() 
		{
			return ((storageInGrid.Count > 0)? storageInGrid : null);
		}

		public ArrayList getObjects() 
		{
			return ((objectsInGrid.Count > 0)? objectsInGrid : null);
		} 
		
		public ArrayList getIOSELObjects() 
		{
			return ((IOSELObjectInGrid.Count > 0)? IOSELObjectInGrid : null);
		}

		public ArrayList getControlPoints() 
		{		
			return ((controlPointsInGrid.Count > 0)? objectsInGrid : null);
//			return controlPointsInGrid;
		} // pub
		public ArrayList getMoveSplines()
		{
			return((MoveSplinesInGrid.Count > 0)? MoveSplinesInGrid : null);
//			return MoveSplinesInGrid;
		}
		
		public ArrayList getObjectButtons() 
		{
		
			return ((objectButtonsInGrid.Count > 0)? objectButtonsInGrid : null);

		}

		public InterfaceObject getTopObject() 
		{
		
			if (objectsInGrid.Count == 0) {
				return null;
			} else {
				return (InterfaceObject)objectsInGrid[objectsInGrid.Count - 1];
			}

		} // public InterfaceObject getTopObject()

		public IOSelectObject getTopIOSELObject() 
		{
		
			if (IOSELObjectInGrid.Count == 0) 
			{
				return null;
			} 
			else 
			{
				return (IOSelectObject)IOSELObjectInGrid[IOSELObjectInGrid.Count - 1];
			}
		}

		public InterfaceObject getAnotherObject() 
		{
		
			if (objectsInGrid.Count == 0) 
			{
				return null;
			} 
			if (objectsInGrid.Count == 1)
			{
				return null;
			}
			else 
			{
				return (InterfaceObject)objectsInGrid[0];
			}

		} // public InterfaceObject getTopObject()

		public ControlPoint getContolPoint() 
		{		
			if (controlPointsInGrid.Count == 0) 
			{
				return null;
			} 
			else 
			{
				return (ControlPoint)controlPointsInGrid[controlPointsInGrid.Count - 1];
			}

		} // public InterfaceObject getTopObject

		public Spline getTopMoveSpline()
		{
			if(this.MoveSplinesInGrid.Count == 0)
			{
				return null;
			}

			Spline topMoveSpline = null;

			foreach(Spline MoveSpline in MoveSplinesInGrid)
			{
				topMoveSpline = MoveSpline;
			}
			return topMoveSpline;
															
		}


	} // public class GridNode


	/// <summary>
	/// Summary description for InterfaceGrid.
	/// </summary>
	public class InterfaceGrid 
	{

		private double maxCols = 0.0;      // stores the maximum columns in the grid
		private double maxRows = 0.0;      // stores the maximum rows in the grid
		private static int GRID_SIZE = 5;
		private static int MAX_SUPPORTED_DEVICES = 8;

		private GridNode[,] theGrid; // This is the 2D grid that covers the workspace

		// variables for managing moving objects in the grid
		private ArrayList movingObjectsList = new ArrayList(MAX_SUPPORTED_DEVICES); // holds moving objects, indexed by deviceI
		private ArrayList lastMovingLocationList = new ArrayList(MAX_SUPPORTED_DEVICES); // holds last currently know location of moving object, indexed by deviceID
		private ArrayList movingControlPointList = new ArrayList(MAX_SUPPORTED_DEVICES);
		private ArrayList movingObjectGroupList = new ArrayList(MAX_SUPPORTED_DEVICES);
		private ArrayList movingToolGroupList = new ArrayList(MAX_SUPPORTED_DEVICES);
		private ArrayList movingSuzanToolGroupList = new ArrayList(MAX_SUPPORTED_DEVICES);
		private ArrayList movingMoveSplineList = new ArrayList(MAX_SUPPORTED_DEVICES);
		//private ArrayList movingMasterPointList = new ArrayList(MAX_SUPPORTED_DEVICES);


		private ArrayList storageButtonList = new ArrayList();
		private ArrayList interfaceObjectList = new ArrayList();    // holds all of the objects in the grid
		private ArrayList IOSelectObjectList = new ArrayList();
		private ArrayList MoveSplineList = new ArrayList();				// holds all of the MoveSplines in the grid
		private ArrayList controlPointList = new ArrayList();
		private ArrayList objectButtonsList = new ArrayList();

		private ArrayList drawObjectList = new ArrayList();
	
		public InterfaceGrid(int horizontalSize, int verticalSize) 
		{
		
			double tempX = (double)horizontalSize/(double)GRID_SIZE;
			double tempY = (double)verticalSize/(double)GRID_SIZE;

			this.maxCols = Math.Ceiling(tempX);
			this.maxRows = Math.Ceiling(tempY);
			theGrid = new GridNode[(int)this.maxRows, (int)this.maxCols];

			// initialize the grid
			for (int cols = 0; cols < this.maxCols; cols++) 
			{
				for (int rows = 0; rows < this.maxRows; rows++) 
				{
					theGrid[rows,cols] = new GridNode();
				} // for (int j...)
			} // for (int i ...)

			// initialize moving object arrays
			for (int i = 0; i <= MAX_SUPPORTED_DEVICES; i++) 
			{
				this.lastMovingLocationList.Add(new Point(-1,-1));
				this.movingObjectsList.Add(null);
				this.movingControlPointList.Add(null);
				this.movingObjectGroupList.Add(null);
				this.movingToolGroupList.Add(null);
				this.movingSuzanToolGroupList.Add(null);
			}


		} // public InterfaceGrid(...)

		
		public void addStorageButton(StorageButton btn) 
		{
			if(!this.storageButtonList.Contains(btn))
			{
				PointF[] boundingBox = btn.BoundingBox();

				ArrayList gridPoints = this.calculateGridPosition(btn.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			
				Point minPt = (Point)gridPoints[0];
				Point maxPt = (Point)gridPoints[1];

				for (int cols = minPt.X; cols <= maxPt.X; cols++) 
				{
					for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
					{
						PointF gridPt = new PointF(cols*GRID_SIZE + GRID_SIZE/2, rows*GRID_SIZE + GRID_SIZE/2);
						if(btn.InsideObject(gridPt)==true)
						{
							theGrid[rows, cols].addStorageButton(btn);
						}
					} // for (int j = ...)
				} // 

				this.storageButtonList.Add(btn);
			}
		}

		public void addObjectShadow(InterfaceObject obj) 
		{
			if(!this.interfaceObjectList.Contains(obj))
			{
				this.interfaceObjectList.Add(obj);
				this.drawObjectList.Add(obj);
			}
		}

		public void addRealObject(InterfaceObject obj) 
		{
			PointF[] boundingBox = obj.BoundingBox();

			ArrayList gridPoints = this.calculateGridPosition(obj.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			
			Point minPt = (Point)gridPoints[0];
			Point maxPt = (Point)gridPoints[1];

			for (int cols = minPt.X; cols <= maxPt.X; cols++) 
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
				{
					PointF gridPt = new PointF(cols*GRID_SIZE + GRID_SIZE/2, rows*GRID_SIZE + GRID_SIZE/2);
					if(obj.InsideObject(gridPt)==true)
					{
						theGrid[rows, cols].addObject(obj);
					}
				} // for (int j = ...)
			} // for (int i = ...) {
			
			gridPoints = this.calculateGridPosition(obj.getResizeButton().Location, 20, 20);

			minPt = (Point)gridPoints[0];
			maxPt = (Point)gridPoints[1];
			
			for(int cols = minPt.X; cols <= maxPt.X; cols++)	//Spalten
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++)	//Reihen
				{
					theGrid[rows,cols].addObject(obj);	//Adds a ControlPoint to the ControlPointList vom Grid
				} // for (int j = ...)
			} // for (int i = ...) {
		}

		public void addObject(InterfaceObject obj) 
		{
			if(!this.interfaceObjectList.Contains(obj))
			{
				PointF[] boundingBox = obj.BoundingBox();

				ArrayList gridPoints = this.calculateGridPosition(obj.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			
				Point minPt = (Point)gridPoints[0];
				Point maxPt = (Point)gridPoints[1];

				for (int cols = minPt.X; cols <= maxPt.X; cols++) 
				{
					for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
					{
						PointF gridPt = new PointF(cols*GRID_SIZE + GRID_SIZE/2, rows*GRID_SIZE + GRID_SIZE/2);
						if(obj.InsideObject(gridPt)==true)
						{
							theGrid[rows, cols].addObject(obj);
						}
					} // for (int j = ...)
				} // for (int i = ...) {
			
				gridPoints = this.calculateGridPosition(obj.getResizeButton().Location, 20, 20);

				minPt = (Point)gridPoints[0];
				maxPt = (Point)gridPoints[1];
			
				for(int cols = minPt.X; cols <= maxPt.X; cols++)	//Spalten
				{
					for (int rows = minPt.Y; rows <= maxPt.Y; rows++)	//Reihen
					{
						theGrid[rows,cols].addObject(obj);	//Adds a ControlPoint to the ControlPointList vom Grid
					} // for (int j = ...)
				} // for (int i = ...) {

				this.interfaceObjectList.Add(obj);
				this.drawObjectList.Add(obj);
			}

		} // public void addObject(...)

		public void addIOSelectObjectShadow(IOSelectObject IOSEL)
		{
			if(!this.IOSelectObjectList.Contains(IOSEL))
			{
				this.IOSelectObjectList.Add(IOSEL);
				this.drawObjectList.Add(IOSEL);
			}
		}

		public void addRealIOSelectObject(IOSelectObject IOSEL)
		{
			PointF[] boundingBox = IOSEL.BoundingBox();

			ArrayList gridPoints = this.calculateGridPosition(IOSEL.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			
			Point minPt = (Point)gridPoints[0];
			Point maxPt = (Point)gridPoints[1];

			for (int cols = minPt.X; cols <= maxPt.X; cols++) 
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
				{
					PointF gridPt = new PointF(cols*GRID_SIZE + GRID_SIZE/2, rows*GRID_SIZE + GRID_SIZE/2);
					if(IOSEL.InsideObject(gridPt)==true)
					{
						theGrid[rows, cols].addIOSELObject(IOSEL);
					}
				} // for (int j = ...)
			} // for (int i = ...) {
		}


		public void addIOSelectObject(IOSelectObject IOSEL)
		{
			if(!this.IOSelectObjectList.Contains(IOSEL))
			{
				PointF[] boundingBox = IOSEL.BoundingBox();

				ArrayList gridPoints = this.calculateGridPosition(IOSEL.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			
				Point minPt = (Point)gridPoints[0];
				Point maxPt = (Point)gridPoints[1];

				for (int cols = minPt.X; cols <= maxPt.X; cols++) 
				{
					for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
					{
						PointF gridPt = new PointF(cols*GRID_SIZE + GRID_SIZE/2, rows*GRID_SIZE + GRID_SIZE/2);
						if(IOSEL.InsideObject(gridPt)==true)
						{
							theGrid[rows, cols].addIOSELObject(IOSEL);
						}
					} // for (int j = ...)
				} // for (int i = ...) {

				this.IOSelectObjectList.Add(IOSEL);
				this.drawObjectList.Add(IOSEL);
			}
		}

		public void updateAddIOSelectObject(IOSelectObject IOSEL)
		{
			PointF[] boundingBox = IOSEL.BoundingBox();

			ArrayList gridPoints = this.calculateGridPosition(IOSEL.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			
			Point minPt = (Point)gridPoints[0];
			Point maxPt = (Point)gridPoints[1];

			for (int cols = minPt.X; cols <= maxPt.X; cols++) 
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
				{
					PointF gridPt = new PointF(cols*GRID_SIZE + GRID_SIZE/2, rows*GRID_SIZE + GRID_SIZE/2);
					if(IOSEL.InsideObject(gridPt)==true)
					{
						theGrid[rows, cols].addIOSELObject(IOSEL);
					}
				} // for (int j = ...)
			} // for (int i = ...) {
		}

		public void addControlPoint(ControlPoint c_point)
		{
			if(!this.controlPointList.Contains(c_point))
			{
				ArrayList gridPoints = this.calculateGridPosition(c_point.Location, c_point.Heigth, c_point.Width);

				Point minPt = (Point)gridPoints[0];
				Point maxPt = (Point)gridPoints[1];

				for(int cols = minPt.X; cols <= maxPt.X; cols++)	//Spalten
				{
					for (int rows = minPt.Y; rows <= maxPt.Y; rows++)	//Reihen
					{
						theGrid[rows,cols].addControlPoint(c_point);	//Adds a ControlPoint to the ControlPointList vom Grid
					} // for (int j = ...)
				} // for (int i = ...) {
				this.controlPointList.Add(c_point);						//Adds a ControlPoint to the ControlPointList der ControlPointList vom Grid
			}
		}


		public void addObjectButton(ObjectButton button)
		{
			if(!this.objectButtonsList.Contains(button))
			{
				ArrayList gridPoints = this.calculateGridPosition(button.Location, 20, 20);

				Point minPt = (Point)gridPoints[0];
				Point maxPt = (Point)gridPoints[1];

			
				for(int cols = minPt.X; cols <= maxPt.X; cols++)	//Spalten
				{
					for (int rows = minPt.Y; rows <= maxPt.Y; rows++)	//Reihen
					{
						theGrid[rows,cols].addObjectButton(button);	//Adds a ControlPoint to the ControlPointList vom Grid
					} // for (int j = ...)
				} // for (int i = ...) {
				this.objectButtonsList.Add(button);						//Adds a ControlPoint to the ControlPointList der ControlPointList vom Grid
			}
		}

		public void replaceObject(InterfaceObject obj) 
		{
			this.removeObject(obj);
			this.addObject(obj);

		} // public void replaceObject(...)


		public void replaceControlPoint(ControlPoint c_point) 
		{

			this.removeControlPoint(c_point);
			this.addControlPoint(c_point);

		} // public void replaceObject(...)
		
		//		public void replaceMoveSpline(LazySuzan_MoveSpline MoveSpline)
		//		{
		//			this.removeMoveSpline(MoveSpline);
		//			this.addMoveSpline(MoveSpline);
		//		}

		public void removeStorageButton(StorageButton btn) 
		{

			// Recalculate the current grid locations associated with this object
			// based on any size or orientation changes to the object.
			PointF[] boundingBox = btn.BoundingBox();

			ArrayList originalPoints = this.calculateGridPosition(btn.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			Point minOrigPt = (Point)originalPoints[0];
			Point maxOrigPt = (Point)originalPoints[1];

			ArrayList rotatedPoints = this.calculateGridPosition(btn.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			Point minRotPt = (Point)rotatedPoints[0];
			Point maxRotPt = (Point)rotatedPoints[1];

			//			// take min and max grid locations from both point sets, incase the
			// current is larger, or rotated from the original
			Point minPt = minOrigPt;
			Point maxPt = maxOrigPt;
			
			if (minRotPt.X < minOrigPt.X) 
				minPt.X = minRotPt.X;
			if (minRotPt.Y < minOrigPt.Y)
				minPt.Y = minRotPt.Y;
			if (maxRotPt.X > maxOrigPt.X) 
				maxPt.X = maxRotPt.X;
			if (maxRotPt.Y > maxOrigPt.Y)
				maxPt.Y = maxRotPt.Y;

			for (int cols = minPt.X; cols <= maxPt.X; cols++) 
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
				{
					theGrid[rows,cols].removeStorageButton(btn);
				} // for (int j = ...)
			} // for (int i = ...) {

			this.storageButtonList.Remove(btn);
		}

		public void removeObjectShadow(InterfaceObject obj) 
		{
			this.interfaceObjectList.Remove(obj);
			this.drawObjectList.Remove(obj);
		} // public void removeObject(...)

		public void addObjectToBG(InterfaceObject obj) 
		{
			this.removeObject(obj);
			PointF[] boundingBox = obj.BoundingBox();

			ArrayList gridPoints = this.calculateGridPosition(obj.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			
			Point minPt = (Point)gridPoints[0];
			Point maxPt = (Point)gridPoints[1];

			for (int cols = minPt.X; cols <= maxPt.X; cols++) 
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
				{
					PointF gridPt = new PointF(cols*GRID_SIZE + GRID_SIZE/2, rows*GRID_SIZE + GRID_SIZE/2);
					if(obj.InsideObject(gridPt)==true)
					{
						theGrid[rows, cols].addObjectFirst(obj);
					}
				} // for (int j = ...)
			} // for (int i = ...) {
			
			gridPoints = this.calculateGridPosition(obj.getResizeButton().Location, 20, 20);

			minPt = (Point)gridPoints[0];
			maxPt = (Point)gridPoints[1];
			
			for(int cols = minPt.X; cols <= maxPt.X; cols++)	//Spalten
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++)	//Reihen
				{
					theGrid[rows,cols].addObjectFirst(obj);	//Adds a ControlPoint to the ControlPointList vom Grid
				} // for (int j = ...)
			} // for (int i = ...) {

			this.interfaceObjectList.Insert(0, obj);
			this.drawObjectList.Insert(0, obj);

		}

		public void removeObject(InterfaceObject obj) 
		{

			// Recalculate the current grid locations associated with this object
			// based on any size or orientation changes to the object.
			PointF[] boundingBox = obj.BoundingBox();

			ArrayList originalPoints = this.calculateGridPosition(obj.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			Point minOrigPt = (Point)originalPoints[0];
			Point maxOrigPt = (Point)originalPoints[1];

			ArrayList rotatedPoints = this.calculateGridPosition(obj.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			Point minRotPt = (Point)rotatedPoints[0];
			Point maxRotPt = (Point)rotatedPoints[1];

			//			// take min and max grid locations from both point sets, incase the
			// current is larger, or rotated from the original
			Point minPt = minOrigPt;
			Point maxPt = maxOrigPt;
			
			if (minRotPt.X < minOrigPt.X) 
				minPt.X = minRotPt.X;
			if (minRotPt.Y < minOrigPt.Y)
				minPt.Y = minRotPt.Y;
			if (maxRotPt.X > maxOrigPt.X) 
				maxPt.X = maxRotPt.X;
			if (maxRotPt.Y > maxOrigPt.Y)
				maxPt.Y = maxRotPt.Y;

			for (int cols = minPt.X; cols <= maxPt.X; cols++) 
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
				{
					theGrid[rows,cols].removeObject(obj);
				} // for (int j = ...)
			} // for (int i = ...) {

			originalPoints = this.calculateGridPosition(obj.getResizeButton().LastLocation, 20, 20);
			minOrigPt = (Point)originalPoints[0];
			maxOrigPt = (Point)originalPoints[1];

			rotatedPoints = this.calculateGridPosition(obj.getResizeButton().LastLocation, 20, 20);
			minRotPt = (Point)rotatedPoints[0];
			maxRotPt = (Point)rotatedPoints[1];

			minPt = minOrigPt;
			maxPt = maxOrigPt;
			
			if (minRotPt.X < minOrigPt.X) 
				minPt.X = minRotPt.X;
			if (minRotPt.Y < minOrigPt.Y)
				minPt.Y = minRotPt.Y;
			if (maxRotPt.X > maxOrigPt.X) 
				maxPt.X = maxRotPt.X;
			if (maxRotPt.Y > maxOrigPt.Y)
				maxPt.Y = maxRotPt.Y;

			for (int cols = minPt.X; cols <= maxPt.X; cols++) 
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
				{
					theGrid[rows,cols].removeObject(obj);
				} // for (int j = ...)
			} // for (int i = ...) {

			this.interfaceObjectList.Remove(obj);
			this.drawObjectList.Remove(obj);
			

		} // public void removeObject(...)

		public void removeIOSelectObjectShadow(IOSelectObject IOSEL) 
		{
			this.IOSelectObjectList.Remove(IOSEL);
			this.drawObjectList.Remove(IOSEL);
		}

		public void removeIOSelectObject(IOSelectObject IOSEL) 
		{

			// Recalculate the current grid locations associated with this object
			// based on any size or orientation changes to the object.
			PointF[] boundingBox = IOSEL.BoundingBox();

			ArrayList originalPoints = this.calculateGridPosition(IOSEL.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			Point minOrigPt = (Point)originalPoints[0];
			Point maxOrigPt = (Point)originalPoints[1];

			ArrayList rotatedPoints = this.calculateGridPosition(IOSEL.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			Point minRotPt = (Point)rotatedPoints[0];
			Point maxRotPt = (Point)rotatedPoints[1];

			//			// take min and max grid locations from both point sets, incase the
			// current is larger, or rotated from the original
			Point minPt = minOrigPt;
			Point maxPt = maxOrigPt;
			
			if (minRotPt.X < minOrigPt.X) 
				minPt.X = minRotPt.X;
			if (minRotPt.Y < minOrigPt.Y)
				minPt.Y = minRotPt.Y;
			if (maxRotPt.X > maxOrigPt.X) 
				maxPt.X = maxRotPt.X;
			if (maxRotPt.Y > maxOrigPt.Y)
				maxPt.Y = maxRotPt.Y;

			for (int cols = minPt.X; cols <= maxPt.X; cols++) 
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
				{
					theGrid[rows,cols].removeIOSELObject(IOSEL);
				} // for (int j = ...)
			} // for (int i = ...) {

			this.IOSelectObjectList.Remove(IOSEL);
			this.drawObjectList.Remove(IOSEL);

		}

		public void updateRemoveIOSelectObject(IOSelectObject IOSEL) 
		{

			// Recalculate the current grid locations associated with this object
			// based on any size or orientation changes to the object.
			PointF[] boundingBox = IOSEL.BoundingBox();

			ArrayList originalPoints = this.calculateGridPosition(IOSEL.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			Point minOrigPt = (Point)originalPoints[0];
			Point maxOrigPt = (Point)originalPoints[1];

			ArrayList rotatedPoints = this.calculateGridPosition(IOSEL.CentrePoint, (boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			Point minRotPt = (Point)rotatedPoints[0];
			Point maxRotPt = (Point)rotatedPoints[1];

			//			// take min and max grid locations from both point sets, incase the
			// current is larger, or rotated from the original
			Point minPt = minOrigPt;
			Point maxPt = maxOrigPt;
			
			if (minRotPt.X < minOrigPt.X) 
				minPt.X = minRotPt.X;
			if (minRotPt.Y < minOrigPt.Y)
				minPt.Y = minRotPt.Y;
			if (maxRotPt.X > maxOrigPt.X) 
				maxPt.X = maxRotPt.X;
			if (maxRotPt.Y > maxOrigPt.Y)
				maxPt.Y = maxRotPt.Y;

			for (int cols = minPt.X; cols <= maxPt.X; cols++) 
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
				{
					theGrid[rows,cols].removeIOSELObject(IOSEL);
				} // for (int j = ...)
			} // for (int i = ...) {

		}

		public void removeControlPoint(ControlPoint c_point)
		{
			ArrayList originalPoints = this.calculateGridPosition(c_point.LastLocation, c_point.Width, c_point.Heigth);
			Point minOrigPt = (Point)originalPoints[0];
			Point maxOrigPt = (Point)originalPoints[1];

			ArrayList rotatedPoints = this.calculateGridPosition(c_point.LastLocation, c_point.Width, c_point.Heigth);
			Point minRotPt = (Point)rotatedPoints[0];
			Point maxRotPt = (Point)rotatedPoints[1];

			Point minPt = minOrigPt;
			Point maxPt = maxOrigPt;
			
			if (minRotPt.X < minOrigPt.X) 
				minPt.X = minRotPt.X;
			if (minRotPt.Y < minOrigPt.Y)
				minPt.Y = minRotPt.Y;
			if (maxRotPt.X > maxOrigPt.X) 
				maxPt.X = maxRotPt.X;
			if (maxRotPt.Y > maxOrigPt.Y)
				maxPt.Y = maxRotPt.Y;

			for (int cols = minPt.X; cols <= maxPt.X; cols++) 
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
				{
					theGrid[rows,cols].removeControlPoint(c_point);
				} // for (int j = ...)
			} // for (int i = ...) {

			this.controlPointList.Remove(c_point);

		}

		public void removeObjectButtons(ObjectButton button)
		{/*
			ArrayList originalPoints = this.calculateGridPosition(button.LastLocation, 20, 20);
			Point minOrigPt = (Point)originalPoints[0];
			Point maxOrigPt = (Point)originalPoints[1];

			ArrayList rotatedPoints = this.calculateGridPosition(button.LastLocation, 20, 20);
			Point minRotPt = (Point)rotatedPoints[0];
			Point maxRotPt = (Point)rotatedPoints[1];

			Point minPt = minOrigPt;
			Point maxPt = maxOrigPt;
			
			if (minRotPt.X < minOrigPt.X) 
				minPt.X = minRotPt.X;
			if (minRotPt.Y < minOrigPt.Y)
				minPt.Y = minRotPt.Y;
			if (maxRotPt.X > maxOrigPt.X) 
				maxPt.X = maxRotPt.X;
			if (maxRotPt.Y > maxOrigPt.Y)
				maxPt.Y = maxRotPt.Y;
*/
			ArrayList gridPoints = this.calculateGridPosition(button.Location, 20, 20);

			Point minPt = (Point)gridPoints[0];
			Point maxPt = (Point)gridPoints[1];

			
			for(int cols = minPt.X; cols <= maxPt.X; cols++)	//Spalten
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++)	//Reihen
				{
					theGrid[rows,cols].removeObjectButton(button);
				} // for (int j = ...)
			} // for (int i = ...) {

			this.objectButtonsList.Remove(button);

		}
	

		public ObjectButton getTopObjectButton(Point currentLoc) 
		{
			
			// Determine which grid square this point falls in
			Point gridSquare = new Point((int)Math.Floor(currentLoc.X/GRID_SIZE), (int)Math.Floor(currentLoc.Y/GRID_SIZE));
			
			// If currentLoc is within the grid workspace, process this point,
			// otherwise, ignore.
			if ((gridSquare.X <= this.maxCols) &&
				(gridSquare.Y <= this.maxRows)) 
			{

				ObjectButton topButton = theGrid[gridSquare.Y, gridSquare.X].getTopObjectButton();
				return topButton;
			} 
			else 
			{
				return null;
			}

		} 
		
		public InterfaceObject getTopObject(Point currentLoc) 
		{		
			// Determine which grid square this point falls in
			Point gridSquare = new Point((int)Math.Floor(currentLoc.X/GRID_SIZE), (int)Math.Floor(currentLoc.Y/GRID_SIZE));
			
			// If currentLoc is within the grid workspace, process this point,
			// otherwise, ignore.
			try
			{
				return theGrid[gridSquare.Y, gridSquare.X].getTopObject();
			}
			catch(System.IndexOutOfRangeException ex)
			{
				Console.Write(ex.StackTrace);
				return null;
			}
		} // public InterfaceObject getTopObject(...)


		public IOSelectObject getTopIOSelectObject(Point currentLoc) 
		{		
			// Determine which grid square this point falls in
			Point gridSquare = new Point((int)Math.Floor(currentLoc.X/GRID_SIZE), (int)Math.Floor(currentLoc.Y/GRID_SIZE));
			
			// If currentLoc is within the grid workspace, process this point,
			// otherwise, ignore.
			try
			{
				return theGrid[gridSquare.Y, gridSquare.X].getTopIOSELObject();
				
			}
			catch(System.IndexOutOfRangeException ex)
			{
				Console.Write(ex.StackTrace);
				return null;
			}
		} // public InterfaceObject getTopObject(...)

		public ControlPoint getControlPoint(Point currentLoc) 
		{
			
			// Determine which grid square this point falls in
			Point gridSquare = new Point((int)Math.Floor(currentLoc.X/GRID_SIZE), (int)Math.Floor(currentLoc.Y/GRID_SIZE));
			
			// If currentLoc is within the grid workspace, process this point,
			// otherwise, ignore.
			try
			{
				ControlPoint controlPoint = theGrid[gridSquare.Y, gridSquare.X].getContolPoint();
				return controlPoint;
			} 
			catch(System.IndexOutOfRangeException ex) 
			{
				Console.Write(ex.StackTrace);
				return null;
			}

		} // public InterfaceObject getTopObject(...)


		public ArrayList getDrawnObjects() 
		{
			
			return this.drawObjectList;

		}

		public ArrayList getAllGridStorageButtons() 
		{
			
			return this.storageButtonList;

		} 

		public ArrayList getAllGridObjects() 
		{
			
			return this.interfaceObjectList;

		} // public ArrayList getAllGridObjects(...)
	
		public ArrayList getAllGridIOSelectObjects() 
		{
			
			return this.IOSelectObjectList;

		}
	

		public ArrayList getAllControlPoints() 
		{
			
			return this.controlPointList;

		}

		public void addWholeMoveSpline(Spline MoveSpline)
		{
			if(!this.MoveSplineList.Contains(MoveSpline)) this.MoveSplineList.Add(MoveSpline);
		}

		public void removeWholeMoveSpline(Spline MoveSpline)
		{
			this.MoveSplineList.Remove(MoveSpline);
		}

		public ArrayList getAllGridMoveSplines()
		{
			return this.MoveSplineList;
		}

		public ObjectButton getAssociatedObjectButton(Point currentPoint) 
		{
			// Calculate the actual grid positions
			Point gridSquare = new Point((int)Math.Floor(currentPoint.X/GRID_SIZE), (int)Math.Floor(currentPoint.Y/GRID_SIZE));

			// If currentLoc is within the grid workspace, process this point,
			// otherwise, ignore.
			if ((gridSquare.X <= this.maxCols) &&
				(gridSquare.Y <= this.maxRows)) 
			{

				return theGrid[gridSquare.Y, gridSquare.X].getTopObjectButton();
			} 
			else 
			{
				return null;
			}
			
		} 


		public StorageButton getStorageButton(Point currentPoint) 
		{
			// Calculate the actual grid positions
			Point gridSquare = new Point((int)Math.Floor(currentPoint.X/GRID_SIZE), (int)Math.Floor(currentPoint.Y/GRID_SIZE));

			// If currentLoc is within the grid workspace, process this point,
			// otherwise, ignore.
			if ((gridSquare.X <= this.maxCols) &&
				(gridSquare.Y <= this.maxRows)) 
			{

				return theGrid[gridSquare.Y, gridSquare.X].getTopStorageButton();
			} 
			else 
			{
				return null;
			}
			
		} 

		public InterfaceObject getAssociatedObject(InterfaceObject obj)
		{
			// Calculate the actual grid positions
			Point gridSquare = new Point((int)Math.Floor(obj.CentrePoint.X/GRID_SIZE), (int)Math.Floor(obj.CentrePoint.Y/GRID_SIZE));

			// If currentLoc is within the grid workspace, process this point,
			// otherwise, ignore.
			if(theGrid[gridSquare.Y, gridSquare.X].getAnotherObject() != obj)
			{												   
				try 
				{
					return theGrid[gridSquare.Y, gridSquare.X].getAnotherObject();
				}
				catch(System.IndexOutOfRangeException ex)
				{
					Console.Write(ex.StackTrace);
					// this may not be the best thing to do, but it is what I am doing right now
					return null;
				}
			}
			else
			{
				return null;
			}
		}

//		public InterfaceObject getAssociatedObject(Point currentPoint) 
//		{
//			// Calculate the actual grid positions
//			Point gridSquare = new Point((int)Math.Floor(currentPoint.X/GRID_SIZE), (int)Math.Floor(currentPoint.Y/GRID_SIZE));
//
//			// If currentLoc is within the grid workspace, process this point,
//			// otherwise, ignore.
//			
//			try 
//			{
//				return theGrid[gridSquare.Y, gridSquare.X].getTopObject();
//			}
//			catch(System.IndexOutOfRangeException ex)
//			{
//				Console.Write(ex.StackTrace);
//				// this may not be the best thing to do, but it is what I am doing right now
//				return null;
//			}
//			
//	
//		} 

		public Spline getAssociatedMoveSpline(InterfaceObject obj) 
		{
			PointF[] boundingBox = obj.BoundingBox();
			// Recalculate object location in the grid and then
			// find the territories associated with these grid points
			ArrayList gridPoints = this.calculateGridPosition(obj.CentrePoint,(boundingBox[2].Y - boundingBox[0].Y)+20, (boundingBox[2].X - boundingBox[0].X)+20);
			
			Point minPt = (Point)gridPoints[0];
			Point maxPt = (Point)gridPoints[1];

			Spline assocMoveSpline = null;
			Spline tempMoveSpline = null;

			for (int cols = minPt.X; cols <= maxPt.X ; cols++) 
			{
				for (int rows = minPt.Y; rows <= maxPt.Y; rows++) 
				{
				
					tempMoveSpline = theGrid[rows,cols].getTopMoveSpline();
					
					// if this is the first territory found, or if the territory in 
					// this cell is a new territory, then assign a new territory
					// to this object.
					if (tempMoveSpline == null) 
					{
						assocMoveSpline = null;

					} 
					else 
					{
						
						assocMoveSpline = tempMoveSpline;
						
					} 

				} // for (int j = ...)
			} // for (int i = ...) {

			return assocMoveSpline;

		} // public LazySuzan getAssociatedLazySuzan(...)

		
		public ControlPoint getAssociatedControlPoint(Point currentPoint) 
		{
			// Calculate the actual grid positions
			Point gridSquare = new Point((int)Math.Floor(currentPoint.X/GRID_SIZE), (int)Math.Floor(currentPoint.Y/GRID_SIZE));

			// If currentLoc is within the grid workspace, process this point,
			// otherwise, ignore.
			try
			{
				return theGrid[gridSquare.Y, gridSquare.X].getContolPoint();
			}
			catch(System.IndexOutOfRangeException ex)
			{
				Console.Write(ex.StackTrace);
				// this may not be the best thing to do, but it is what I am doing right now
				return null;
			}
		
		} // public LazySuzan getAssociatedLazySuzan(...)
		
		public Spline getAssociatedMoveSpline(Point currentPoint) 
		{
			// Calculate the actual grid positions
			Point gridSquare = new Point((int)Math.Floor(currentPoint.X/GRID_SIZE), (int)Math.Floor(currentPoint.Y/GRID_SIZE));

			// If currentLoc is within the grid workspace, process this point,
			// otherwise, ignore.
			try 
			{
				return theGrid[gridSquare.Y, gridSquare.X].getTopMoveSpline();
			}
			catch(System.IndexOutOfRangeException ex)
			{
				Console.Write(ex.StackTrace);
				// this may not be the best thing to do, but it is what I am doing right now
				return null;
			}
	
		} 
		
		public void addMovingObject(int inputID, InterfaceObject obj) 
		{
		
			if (inputID >= movingObjectsList.Count) {
				for (int i = movingObjectsList.Count; i <= inputID; i++) {
					movingObjectsList.Add(null);
				} // for (int i ... )
			} // for (inputID ...)
			
			movingObjectsList[inputID] = obj;

		} // public void addMovingObject(...)


		public void addMovingObjectGroup(int inputID, ArrayList objGroup)
		{
			if(inputID >= movingObjectGroupList.Count)
			{
				for(int i = movingObjectGroupList.Count; i<= inputID; i++)
				{
					movingObjectGroupList.Add(null);
				}
			}
			movingObjectGroupList[inputID] = objGroup;
		}

		public void addMovingToolGroup(int inputID, ArrayList toolGroup)
		{
			if(inputID >= movingToolGroupList.Count)
			{
				for(int i = movingToolGroupList.Count; i<= inputID; i++)
				{
					movingToolGroupList.Add(null);
				}
			}
			movingToolGroupList[inputID] = toolGroup;
		}

		public void addMovingSuzanToolGroup(int inputID, ArrayList suzanToolGroup)
		{
			if(inputID >= movingSuzanToolGroupList.Count)
			{
				for(int i = movingSuzanToolGroupList.Count; i<= inputID; i++)
				{
					movingSuzanToolGroupList.Add(null);
				}
			}
			movingSuzanToolGroupList[inputID] = suzanToolGroup;
		}

		public void addMovingControlPoint(int inputID, ControlPoint c_point) 
		{
		
			if (inputID >= movingControlPointList.Count) 
			{
				for (int i = movingControlPointList.Count; i <= inputID; i++) 
				{
					movingControlPointList.Add(null);
				} // for (int i ... )
			} // for (inputID ...)
			
			movingControlPointList[inputID] = c_point;

		} // public void addMovingObject(...)

		public void replaceMovingObject(int inputID, InterfaceObject obj) 
		{
			this.movingObjectsList[inputID] = obj;
//			this.replaceObject(obj);

		} // public void replaceObject(...)

		
		public void replaceMovingObjectGroup(int inputID, ArrayList objGroup)
		{
			this.movingObjectGroupList[inputID] = objGroup;
			foreach(InterfaceObject grObj in objGroup)
			{
				this.replaceObject(grObj);
			}
		}

		public void replaceMovingControlPoint(int inputID, ControlPoint c_point) 
		{

			this.movingControlPointList[inputID] = c_point;
//			this.replaceControlPoint(c_point);

		} 

		public InterfaceObject getMovingObject(int inputID) 
		{	
			try 
			{
				return (InterfaceObject)movingObjectsList[inputID];
			} 
			catch(System.IndexOutOfRangeException ex) 
			{
				Console.Write(ex.StackTrace);
				return null;
			}	
		} // public InterfaceObject getMovingObject(...)

		

		public ControlPoint getMovingControlPoint(int inputID) 
		{
			try 
			{
				return (ControlPoint)movingControlPointList[inputID];
			} 
			catch(System.IndexOutOfRangeException ex) 
			{
				Console.Write(ex.StackTrace);
				return null;
			}	
		} // public InterfaceObject getMovingControlPoint(...)

		public Point getLastMovingLocation(int inputID) 
		{	
			try 
			{
				return (Point)this.lastMovingLocationList[inputID];
			} 
			catch(System.IndexOutOfRangeException ex) 
			{
				Console.Write(ex.StackTrace);
				return new Point(-1,-1);
			}
		} // public Point getLastLocation(...)

		/// <summary>
		/// 
		/// </summary>
		/// <param name="inputID"></param>
		/// <param name="location"></param>
		public void setLastMovingLocation(int inputID, Point location) 
		{

			if (inputID <= MAX_SUPPORTED_DEVICES) {
				this.lastMovingLocationList[inputID] = location;
			}

		} // public void setLastLocation(...)

		/// <summary>
		/// 
		/// </summary>
		/// <param name="inputID"></param>
		/// <param name="obj"></param>
		public void removeMovingObject(int inputID, InterfaceObject obj) {

			if (inputID < MAX_SUPPORTED_DEVICES) {
				this.movingObjectsList[inputID] = null;
				this.lastMovingLocationList[inputID] = new Point(-1,-1);
			}

		} // public void removeMovingObject(...)

		public void removeMovingObjectList(int inputID, ArrayList moveObj)
		{
			if(inputID < MAX_SUPPORTED_DEVICES)
			{
				this.movingObjectsList[inputID] = null;
				this.lastMovingLocationList[inputID] = new Point(-1, -1);
			}
		}
		public void removeMovingControlPoint(int inputID, ControlPoint c_point) 
		{

			if (inputID < MAX_SUPPORTED_DEVICES) 
			{
				this.movingControlPointList[inputID] = null;
				this.lastMovingLocationList[inputID] = new Point(-1,-1);
			}

		} 

		public void drawGrid() 
		{
			
			if (this.theGrid == null) {
				return;
			}
			for (int cols = 0; cols < this.maxCols; cols++) {
				for (int rows = 0; rows < this.maxRows; rows++) {

					float red = 0.0f;
					float green = 0.0f;
					float blue = 0.0f;
					Gl.glBegin(Gl.GL_QUADS);					// Draw A Box
					Gl.glColor3f(0.0f, 0.0f, 0.0f);
					ArrayList storages = this.theGrid[rows,cols].getStorage();
					if (storages != null) 
					{
						red = 1.0f;
						green = 1.0f;
						blue = 0.0f;
					} 
					ArrayList objects = this.theGrid[rows,cols].getObjects();
					if (objects != null) {
						switch (objects.Count) {
							case 0:
								red += 0.5f;
								break;
							case 1:
								green += 0.5f;
								break;
							case 2:
								blue += 0.5f;
								break;
							default:
								red += 0.5f;
								green += 0.5f;
								blue += 0.5f;
								break;
						} // switch
					} // if (objects != null)

					ArrayList IOSELObjects = this.theGrid[rows,cols].getIOSELObjects();
					if (IOSELObjects != null) 
					{
						red = 0.5f;
						green = 0.5f;
						blue = 0.5f;
					} // if (objects != null)

					ArrayList MoveSplines = this.theGrid[rows,cols].getMoveSplines();
					if (MoveSplines != null) 
					{
						switch (MoveSplines.Count) 
						{
							case 0:
								red += 0.5f;
								break;
							case 1:
								green += 0.5f;
								break;
							case 2:
								blue += 0.5f;
								break;
							default:
								red += 0.5f;
								green += 0.5f;
								blue += 0.5f;
								break;
						} // switch
					} // if (controlPoints != null)
					ArrayList controlPoints = this.theGrid[rows, cols].getControlPoints();
					if(controlPoints != null)
					{
						switch(controlPoints.Count)
						{
							case 0:
								red = 0.5f;
								break;
							case 1:
								green = 0.5f;
								break;
							case 2:
								blue = 0.5f;
								break;
							default:
								red = green = blue = 0.5f;
								break;
						}
					}
					ArrayList objectButtons = this.theGrid[rows,cols].getObjectButtons();
					if (objectButtons != null) 
					{
						switch (objectButtons.Count) 
						{
							case 0:
								red += 0.5f;
								break;
							case 1:
								green += 0.5f;
								break;
							case 2:
								blue += 0.5f;
								break;
							default:
								red += 0.5f;
								green += 0.5f; 
								blue += 0.5f;
								break;
						} // switch
					}	
					Gl.glColor3f(red, green, blue);
					float minX = cols * GRID_SIZE;
					float minY = rows * GRID_SIZE;
					Gl.glVertex3f(minX, minY, 0.0f);		   // Top Left
					Gl.glVertex3f(minX+GRID_SIZE, minY, 0.0f); // Top Right
					Gl.glVertex3f(minX+GRID_SIZE, minY+GRID_SIZE, 0.0f); // Bottom Right
					Gl.glVertex3f(minX, minY+GRID_SIZE, 0.0f); // Bottom Left
					Gl.glEnd();								// Done Drawing The Box

				} // for (int j ...)
			} // for (int i ...)


		} // public void drawGrid()
		private ArrayList calculateGridPosition(PointF centre, double objHeight, double objWidth) {

			// Determine which grid squares this object is currently covering.  
			// First determine the bounding box of the object, then determine
			// the minimum & maximum grid points this covers.  Then fill in the rest.
			Point minPt = new Point((int)((centre.X - objWidth/2)), (int)((centre.Y - objHeight/2)));
			Point maxPt = new Point((int)((centre.X + objWidth/2)), (int)((centre.Y + objHeight/2)));

			// Calculate the actual grid positions
			Point minGridPt = new Point((int)Math.Floor(minPt.X/GRID_SIZE), (int)Math.Floor(minPt.Y/GRID_SIZE));
			Point maxGridPt = new Point((int)Math.Floor(maxPt.X/GRID_SIZE), (int)Math.Floor(maxPt.Y/GRID_SIZE));

			// Make sure the bounds are within the grid
			if (minGridPt.X < 0) 
				minGridPt.X = 0;
			if (minGridPt.Y < 0)
				minGridPt.Y = 0;
			if (maxGridPt.X >= this.maxCols) 
				maxGridPt.X = (int) (this.maxCols - 1);
			if (maxGridPt.Y >= this.maxRows)
				maxGridPt.Y = (int) (this.maxRows - 1);

			ArrayList gridPoints = new ArrayList();
			gridPoints.Add(minGridPt);
			gridPoints.Add(maxGridPt);

			return gridPoints;
		
		} // private ArrayList calculateGridPosition(...)

	} // public class InterfaceGrid
}




See more files for this project here

MASE: Agile Software Engineering

The MASE project investigates methods to support the coordination and executable acceptance testing of software projects. Keywords: Agile methods, distributed teams, Extreme Programming. See http://ebe.cpsc.ucalgary.ca/ebe for more information.

Project homepage: http://sourceforge.net/projects/mase
Programming language(s): Java,XML
License: other

  ControlPoint.cs
  CustomTreeNode.cs
  CustomTreeView.cs
  Dashboard.cs
  Dashboard.resx
  EStoryForm.cs
  EStoryForm.resx
  IOSelectObject.cs
  InterfaceGrid.cs
  InterfaceObject.cs
  List.cs
  ListNode.cs
  LogFile.cs
  MenuForm.cs
  MenuForm.resx
  MoveAbleSpline.cs
  NonMoveAbleSpline.cs
  ObjectButton.cs
  Old_MoveAbleSpline.cs
  PenCalibration.cs
  PenCalibration.resx
  RNTObject.cs
  Spline.cs
  StartupScreen.cs
  StartupScreen.resx
  StorageButton.cs
  Study_Project.cs
  Study_Project.resx
  TabletUI.cs
  TabletUI.resx
  Workspace.cs
  Workspace.resx
  testCalibration.cs
  testCalibration.resx