]> git.gag.com Git - debian/openrocket/blob - core/src/net/sf/openrocket/file/TipShapeCode.java
Merge commit '42b2e5ca519766e37ce6941ba4faecc9691cc403' into upstream
[debian/openrocket] / core / src / net / sf / openrocket / file / TipShapeCode.java
1 package net.sf.openrocket.file;
2
3 import net.sf.openrocket.rocketcomponent.FinSet;
4
5 /**
6  */
7 public final class TipShapeCode {
8
9     /**
10      * Convert a Rocksim tip shape to an OpenRocket CrossSection.
11      *
12      * @param tipShape the tip shape code from Rocksim
13      *
14      * @return a CrossSection instance
15      */
16     public static FinSet.CrossSection convertTipShapeCode (int tipShape) {
17         switch (tipShape) {
18             case 0:
19                 return FinSet.CrossSection.SQUARE;
20             case 1:
21                 return FinSet.CrossSection.ROUNDED;
22             case 2:
23                 return FinSet.CrossSection.AIRFOIL;
24             default:
25                 return FinSet.CrossSection.SQUARE;
26         }
27     }
28
29     public static int convertTipShapeCode (FinSet.CrossSection cs) {
30         if (FinSet.CrossSection.ROUNDED.equals(cs)) {
31             return 1;
32         }
33         if (FinSet.CrossSection.AIRFOIL.equals(cs)) {
34             return 2;
35         }
36         return 0;
37     }
38 }