Design a deck plan space ship in eclipse

Assignment Help C/C++ Programming
Reference no: EM1372160

Computer Graphics

Develop a simple interactive two-dimensional spaceship deck plan editor using OpenGL and GLUT. Your program will enable a user to create and save a deck plan of a hypothetical spaceship comprising the hull walls, shielding/insulation/reinforcement (SIR) areas, walkable areas, interior walls, hull windows and interior doors. The deck could contain some simple pieces of furniture, hardware (power plant, shield generator, computer, etc.), and pods. Your program will allow the user to create the hull walls, SIR areas, walkable areas, interior walls, hull windows and interior doors; to place and size objects such as furniture and hardware on the deck; and to delete any object no longer wanted.

For simplicity a hull wall could consist of a thick straight line segment (instead of a curved line segment); thin straight line segments could be used for interior walls and hull windows. Shielding/insulation/reinforcement (SIR) areas could be suitably filled polygons; walkable areas of the deck could be polygons filled with an appropriate stipple pattern.

As a starting point for your work you could use the program contained in DeckPlan.zip. Compile, build and execute this program. Notice that it displays a screen window containing some aligned rectangles (that is, rectangles whose sides are aligned with the coordinate axes). The large rectangle on the left is the drawing region in which the deck plan could be created. On the right hand side appears a button containing a small square: this button allows the user to select a piece of furniture (represented by an aligned rectangle of fixed width and height to begin with) as the current object to be drawn. The following parts ask you to extend this program. A sketch which indicates roughly what your final program GUI, together with a simple hypothetical deck plan layout in its drawing region, might look is provided to you in DeckPlan.pdf. Your GUI does *not* have to be exactly the same as the one suggested in the diagram. In particular, your choice of colours could be different. Note that the upper diagram was obtained from the internet, and served as a kind of inspiration for the sketch below it.

Notice that the program is organised as three files. You could keep the same basic file (and class) structure throughout your extension work if you like. However it is up to you if you wish to add more files or otherwise change the structure of the program. (If you redesign it radically, it would be appreciated if you include some rationale in your Readme.html file.)

1. Draw a grid (equally spaced horizontal and vertical lines) for the drawing region. This will facilitate the creation of a deck plan.

2. Add a button which allows the user to create a hull wall (thick straight line) of desired length. Left mouse button press, drag and release could specify the endpoints. Add a button which allows the user similarly to create an interior wall or hull window (thin line) of desired length. No "rubber line" is requested yet.

3. Add a button which allows the user to create an SIR area (appropriately filled polygon). A succession of left mouse button clicks could specify the corners, with some "finish" action, such as a right mouse button click, indicating completion of the polygon. Add a button which allows the user similarly to create a walkable area (polygon filled with an appropriate stipple pattern).

4. For your furniture (light coloured rectangle with border) creation tool, now allow the user to enter the opposite corners of the desired rectangle using the mouse (with left button press, drag and release). Add a button which allows the user simlarly to create hardware (dark coloured rectangle with border) of desired size. No "rubber rectangle" is requested yet.

5. Add a button which allows the user to create an interior door (thick/thin straight line) of desired length. Left mouse button press, drag and release could specify the endpoints. Add a button which allows the user to create a pod (coloured circle).

6. Currently, drawn objects can extend beyond the drawing region. Arrange for drawn objects to be *clipped* against the drawing region.
Hint. Look at Example 3.2.5 on pages 101 and 102 of Hill and Kelley (or see pages 89 and 90 of the 2nd edition).

7. For the wall, furniture and hardware objects only, provide the user with feedback during the process of drawing an object by displaying a "rubber object" outline that changes shape as the user moves the mouse. Use the XOR logical operation, as described in Section 9.3.3 of Hill and Kelley 3rd edn (Section 10.3.3 of the 2nd edn) in which relevant theory is described and implementation details are outlined.

8. A sigificant disadvantage with the deck plan editor as it currently exists is that objects are drawn and then forgotten, so to speak. Consequently, if the screen window is partially covered by another window, and subsequently exposed by moving the other window away, then the objects which were drawn by the user disappear as the redraw event triggers a call to the display function.
Eliminate this problem by having your program build a model (list) of all the deck objects (walls, deck areas, furniture, etc.) drawn by the user.
A nice way to do this is to use a global vector of deck objects. Let's call our global vector DeckModel. The mouse function should draw and append to DeckModel each new deck object created. The display function should traverse DeckModel, drawing each object stored.
After doing this, move the call to glClear() and the command to fill the drawing region from init() to display(). (They really belongs in display().)

9. Add a button labelled "File". Clicking on this button should cause a pop-up File menu to appear. This menu should provide at least three options: Save (write to file), Open (read from file), Quit. In case Save is selected, the contents of DeckModel should be saved in (written to) the text file DeckPlan.txt. In case Open is selected, the contents of the text file DeckPlan.txt should be read intoDeckModel and displayed.
Details concerning the text file format you are requested to use are found below in a separate section.

10. Add two buttons for select and delete. Provide functionality for these buttons. Selection of an object could result in a simple selection box (rectangle, say) being drawn around the object.

11. Add a small row of 4 different colour buttons and provide the functionality for them.

12. One mark is awarded for an impressive professional looking user interface. One mark is awarded for good programming style.

Reference no: EM1372160

Questions Cloud

Determine the optimal price of product : After a 10 percent price discount, a company found that its weekly sales increased by 30 percent. If the marginal cost (MC) of this product is $40 each, determine the optimal price for this product?
Estimating profit : Your supervisor recently instituted a plan that encourages her managers to share non private demographic characteristics voluntarily provided by those who buy your company's final product.
How can a firm gain by reducing competition : Price higher in monopoly market. Bigger quantity in perfect competition. How can a firm gain by reducing competition.
How did this impact competition in many markets : f P falls below AC, what is result for firm? Firm loses money 16. In late-19th century, both firms and markets expanded. How did this impact competition in many markets.
Design a deck plan space ship in eclipse : Develop a simple interactive two-dimensional spaceship deck plan editor using OpenGL and GLUT. Your program will enable a user to create and save a deck plan of a hypothetical spaceship comprising the hull walls.
Does currency-board regime was a mistake. : with monetary policy for closed, it is hard for authorities to stimulate demand. Interior design does this show that currency-board regime was a mistake.
Calculate the profit-maximizing level of outpu : Use the following data to answer the questions given below; Calculate the profit-maximizing level of output and price if the company sells all of its tickets at one price.
Is this firm able to earn a positive profit : Suppose that C (q) = 10q + 3,500,000 (for which MC (q) = 10 ). Use Inverse Elasticity Pricing Rule in order to determine profit maximizing price and level of output for this firm. Is this firm able to earn a positive profit.
Which limits amount of goods they can purchase : which limits amount of goods they can purchase. Preference Consumers always choose goods which give most pleasure. So how do we measure about pleasure.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Program to declare array alpha of components of type int

Write C++ statements to do the following: Declare an array alpha of 15 components of the type int. Output the value of the tenth component of the array alpha.

  Code to implement a staque

Write a C++ code to implement a Staque. Since the data structure is all about inserting and deleting numbers, it would be a good option to use a linked list to implement Staque.

  Write application to calculate price of carpeting for room

The Westfield Carpet Company has asked you to write an application that calculates the price of carpeting for rectangular rooms.

  Main function to input twenty integers in given range

Write a main function to input 20 integers in range of 1-6, function should count number of times the numbers 2 and 5 occur. function must declare statics variables count2 and count5.

  Create class integerset

Create class IntegerSet for which each object can hold integers in the range 0 through 100. Represent the set internally as a vector of bool values. Element a[i] is true if integer i is in the set. Element a[j] is false if integer j is not in the set..

  Change temperature fahrenheit to celsius and kelvin

Write a program in c++ that takes the temperature in Fahrenheit and convert it to Celsius And Kelvin:

  C program to compute parking fare for customers

Write C program to compute parking fare for customers who park their cars in parking lot when following information is provided: A character showing type of vehicle: C for car, B for bus and T for truck

  Represent an instruction supported by simpletron

Implementation contains a Simpletron class and several supporting Instruction classes

  Write a program that converts between app and ppm values

Write a simple program that converts between APP and PPM values

  Write a program to calculate existing angles

Write a program to calculate existing angles and do if and then from this, and to place fixed angles at certain position.

  Implementation of sorting technique

Implementation of sorting technique

  Basics of code development on linux and cryptography

Prepare a C program that gives simple mono-alphabetic substitution between plaintext, and Enhance your code to use "-e" to encrypt a string argument and "-d" to decrypt it using argv and argc

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd