Code Search for Developers
 
 
  

StorageButton.cs from MASE: Agile Software Engineering at Krugle


Show StorageButton.cs syntax highlighted

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

using System.Drawing.Drawing2D;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using TEXT3D_WRAPPERLib;


namespace New_Study_Project
{
	
	public class StorageButton : Object
	{

		/* Definitions of the Program */

		public PointF CentrePoint;

		private PointF TopLeft;
		private PointF TopRight;
		private PointF BottomRight;
		private PointF BottomLeft;
		
		private int GLStorageList;

		private Text3D textLabel;

		private InterfaceGrid interfaceGrid;
		
		private bool east_side;

		/* End of Definitions of the Program */

		public StorageButton(PointF topleft, PointF topright, PointF bottomright, PointF bottomleft, InterfaceGrid IG, bool east)
		{
			this.TopLeft = topleft;
			this.TopRight = topright;
			this.BottomRight = bottomright;
			this.BottomLeft = bottomleft;
			this.interfaceGrid = IG;
			this.east_side = east;
			this.CentrePoint = new PointF((this.TopLeft.X+this.BottomRight.X)/2.0f, (this.TopLeft.Y+this.BottomRight.Y)/2.0f);

			Vec3D textColor = new Vec3DClass();
			textLabel = new Text3DClass();
			textColor.Set(0.3f, 0.6f, 0.9f);
			textLabel.SetString("Storage");
			textLabel.SetTextColor(textColor);
			textLabel.SetOrientation(TextOrientation.TO_HorzCenter);
			textLabel.SetAlignment(TextAlignment.TA_Centered);
			textLabel.SetFaceName("Georgia");

			this.GLStorageList = Gl.glGenLists(1);
			Gl.glNewList(this.GLStorageList, Gl.GL_COMPILE);
			Gl.glBegin(Gl.GL_TRIANGLE_FAN);
			Gl.glColor4f(0.0f, 0.0f, 0.0f, 0.0f);						
			Gl.glVertex2f(this.CentrePoint.X, this.CentrePoint.Y);		
			Gl.glColor4f(0.1f, 0.3f, 0.4f, 0.9f);
			Gl.glVertex2f(this.TopLeft.X, this.TopLeft.Y);	
			if (this.east_side == true) Gl.glColor4f(0.1f, 0.3f, 0.4f, 0.0f);		
			Gl.glVertex2f(this.TopRight.X, this.TopRight.Y);
			if (this.east_side == false) Gl.glColor4f(0.1f, 0.3f, 0.4f, 0.0f);
			Gl.glVertex2f(this.BottomRight.X, this.BottomRight.Y);
			if (this.east_side == true) Gl.glColor4f(0.1f, 0.3f, 0.4f, 0.9f);
			Gl.glVertex2f(this.BottomLeft.X, this.BottomLeft.Y);
			if (this.east_side == false) Gl.glColor4f(0.1f, 0.3f, 0.4f, 0.9f);
			Gl.glVertex2f(this.TopLeft.X, this.TopLeft.Y);					
			Gl.glEnd();	
			
			Gl.glLineWidth(1.0f);
			Gl.glBegin(Gl.GL_LINE_LOOP);
			Gl.glColor4f(0.3f, 0.6f, 0.9f, 1.0f);			
			Gl.glVertex2f(this.TopLeft.X, this.TopLeft.Y);					
			if (this.east_side == true) Gl.glColor4f(0.1f, 0.3f, 0.4f, 0.0f);
			Gl.glVertex2f(this.TopRight.X, this.TopRight.Y);
			if (this.east_side == false) Gl.glColor4f(0.3f, 0.6f, 0.9f, 0.0f);
			Gl.glVertex2f(this.BottomRight.X, this.BottomRight.Y);
			if (this.east_side == true) Gl.glColor4f(0.1f, 0.6f, 0.9f, 1.0f);
			Gl.glVertex2f(this.BottomLeft.X, this.BottomLeft.Y);						
			Gl.glEnd();	
			
			textLabel.Height = 18;
			if (this.east_side == false) Gl.glTranslatef(this.CentrePoint.X, this.CentrePoint.Y-1, 0.0f); else Gl.glTranslatef(this.CentrePoint.X-1, this.CentrePoint.Y, 0.0f); 
			if (this.east_side == true) Gl.glRotatef(-90.0f, 0.0f, 0.0f, 1.0f);
			Gl.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
			Gl.glScalef(1.25f, 1.0f, 1.0f);
			textLabel.Display();
			Gl.glEndList();

		}


		public bool InsideObject(PointF point)
		{
				
			bool side = false;

			PointF[] array = new PointF[4];

			array[0] = this.TopLeft;
			array[1] = this.TopRight;
			array[2] = this.BottomRight;
			array[3] = this.BottomLeft;
			
			
			for(int i = 0, j = 3; i <= 3; j = i, i = i+1)
			{
				if((((array[i].Y <= point.Y) && (point.Y < array[j].Y)) || 
					((array[j].Y <= point.Y) && (point.Y < array[i].Y))) && 
					(point.X < (array[j].X - array[i].X) * (point.Y - array[i].Y)/(array[j].Y - array[i].Y) + array[i].X))
				{
					side = !side;
				}
			}

			return side;
		}

		public float[] Sort(float[]array)
		{
			int n = array.Length;
			int i, j;
			float t;

			for( i = 1; i < n; i++)
			{
				j = i;
				t = array[j];
				while(j > 0 && array[j - 1] > t)
				{
					array[j] = array[j - 1];
					j--;
				}
				array[j] = t;
			}
			return array;
		}

		public PointF[] BoundingBox()
		{
			float[] cornerX = {this.TopLeft.X, this.TopRight.X, this.BottomRight.X, this.BottomLeft.X};
			float[] cornerY = {this.TopLeft.Y, this.TopRight.Y, this.BottomRight.Y, this.BottomLeft.Y};

			cornerX = this.Sort(cornerX);
			cornerY = this.Sort(cornerY);
			
			PointF min = new PointF(cornerX[0], cornerY[0]);
			PointF max = new PointF(cornerX[cornerX.Length - 1], cornerY[cornerY.Length - 1]);
			
			PointF[] boundingBox = {new PointF(min.X, min.Y), new PointF(max.X, min.Y), new PointF(max.X, max.Y), new PointF(min.X, max.Y)};
			return boundingBox;
		}


		/*******************************************************************/
		/* End of the head of this Object - now the user code stuff begins */
		/*******************************************************************/
	
		/*******************************************************************/
		/*                    Drawing and Mouse Events                     */
		/*******************************************************************/


		public void draw()
		{
			Gl.glPushMatrix();
			   Gl.glCallList(this.GLStorageList);
			Gl.glPopMatrix();
		}

		public void mouse_clicked(Workspace parent, PointF insert)
		{ 
			
		}



		/*******************************************************************/
		/*               some function for returning values                */
		/*******************************************************************/


		public PointF get_TopLeft()
		{
			return this.TopLeft;
		}

		public PointF get_TopRight()
		{
			return this.TopRight;
		}

		public PointF get_BottomLeft()
		{
			return this.BottomLeft;
		}

		public PointF get_BottomRight()
		{
			return this.BottomRight;
		}



		/*******************************************************************/
		/*   -----------------------------------------------------------   */
		/*******************************************************************/


	}
}




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