create changelog entry
[debian/openrocket] / core / src / net / sf / openrocket / gui / print / PaperOrientation.java
1 package net.sf.openrocket.gui.print;
2
3 import com.itextpdf.text.Rectangle;
4 import com.itextpdf.text.RectangleReadOnly;
5
6 public enum PaperOrientation {
7         
8         PORTRAIT("Portrait") {
9                 @Override
10                 public Rectangle orient(Rectangle rect) {
11                         return new RectangleReadOnly(rect);
12                 }
13         },
14         LANDSCAPE("Landscape") {
15                 @Override
16                 public Rectangle orient(Rectangle rect) {
17                         return new RectangleReadOnly(new Rectangle(rect).rotate());
18                 }
19         };
20         
21
22         private final String name;
23         
24         private PaperOrientation(String name) {
25                 this.name = name;
26         }
27         
28         /**
29          * Change the orientation of a portrait paper to the orientation represented by this
30          * orientation.
31          *  
32          * @param rect  the original paper size rectangle
33          * @return              the oriented paper size rectangle
34          */
35         public abstract Rectangle orient(Rectangle rect);
36         
37         
38         @Override
39         public String toString() {
40                 return name;
41         }
42 }