“Global Shapes” Proposal COMS 4115 Programming Languages and Translators Global Shapes is a language that allows users to easily draw various shapes, square, circle, rectangle, ellipse, line, polyline, using latitude and longitude data. Andrew Willouer asw2126 6/3/2009“Global Shapes” Proposal Andrew Willouer asw2126 Jun. 3 2 Introduction Global Shapes is a simple programming language that allows users to easily draw the following two-dimensional shapes, square, circle, rectangle, ellipse, line and polyline, using the geographic coordinate system. The inclusion of polyline allows the use of any irregular shape. Geographic Coordinate System The user must specify the size of the output window. The output window is centered at latitude and longitude and has a height and width in miles. All shape locations are specified using latitude and longitude values which are converted to pixels and displayed in the correct location within the output window. Example, specify a latitude/longitude of 40.47 and 73.58 will draw a shape centered at New York City which will appear in the top left quadrant in the above picture using that was output window. Each shape has the following attributes: name, latitude, longitude, width, color and notes. The name attribute is required and cannot be changed once a shape is created. The latitude and longitude are required and are in the decimal format and control the location of the shape. The width, color and notes are not required. The width attribute controls the width of the line of the shape with default being 1. The color controls the color of the lines of the shape with the default being red. The notes“Global Shapes” Proposal Andrew Willouer asw2126 Jun. 3 3 attribute allows the user to enter a string of text that is associated and displayed next to the shape. Each shape then has some extra attributes such as radius, height, width which are in miles. The compiler will give a warning if a shape will not be displayed in the current output window. Example Code Outputwindow (40.47, 73.58, 200, 200); //Creates an output window centered around New York City //Format for a rectangle--rectangle(name, latitude, longitude, height, length) rectangle(rect1, 40.47, 73.58, 50, 50); rect1.width = 10; //In miles rect1.color = blue; rect1.notes = “This is rectangle around New York City”; //Format for a square--square(name, latitude, longitude, height) square(sqa1, 40.3, 73.5, 50); sqa1.width = 1; sqa1.color = orange; sqa1.notes=”This is a square around New York City”; //Format for a circle--circle(name, latitude, longitude, diameter) circle(cic1, 40, 73, 40); //just going to use the default values for width, color and no notes circle(cic2, 50, 80.88, 50); cic2.color = blue; //Format for a ellipse--ellipse(name, latitude, longitude, height, length) ellipse(ell1, 43.45, 50.43, 50,40); ell1.width = 5; //Format for a line – line(name, starting latitude, start longitude, ending latitude, ending longitude); line(line1, 40.44, 73.30, 44.44, 77.30); line1.color = black;“Global Shapes” Proposal Andrew Willouer asw2126 Jun. 3 4 //Format for a polyline(name, starting lat, start long, next lat, next long, ….. ending latitude, ending longitude); polyline(poly1, 40, 30, 41,31, 42,32, 44.43, 35.44); poly1.notes=”Flight plan for aircraft”; Keywords: square, rectangle, circle, ellipse, line, polyline, width, color, notes, the various colors (blue, red, black, orange etc) Sample Output (Not based on code
View Full Document