diff --git a/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java b/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
index 7c1e5540a..3b3b8615a 100644
--- a/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
+++ b/swing/src/net/sf/openrocket/gui/print/FinMarkingGuide.java
@@ -23,17 +23,18 @@ import net.sf.openrocket.rocketcomponent.BodyTube;
import net.sf.openrocket.rocketcomponent.ExternalComponent;
import net.sf.openrocket.rocketcomponent.FinSet;
import net.sf.openrocket.rocketcomponent.LaunchLug;
+import net.sf.openrocket.rocketcomponent.RailButton; // ADD IMPORT Rail Buttons
import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.startup.Application;
/**
* This is the core Swing representation of a fin marking guide. It can handle multiple fin sets on the same or
- * different body tubes. One marking guide will be created for any body tube that has a finset. If a tube has multiple
- * finsets, then they are combined onto one marking guide. It also includes launch lug marking line(s) if lugs are
- * present. If (and only if) a launch lug exists, then the word 'Front' is affixed to the leading edge of the guide to
- * give orientation.
- *
+ * different body tubes. One marking guide will be created for any body tube that has a fin set. If a tube has multiple
+ * fin sets, then they are combined onto one marking guide. It also includes launch lug and rail button marking line(s)
+ * if lugs and buttons are present. If (and only if) a launch lug or rail button exists, then the word 'Front' is
+ * affixed to the leading edge of the guide to give orientation.
+ *
*/
@SuppressWarnings("serial")
public class FinMarkingGuide extends JPanel {
@@ -82,7 +83,7 @@ public class FinMarkingGuide extends JPanel {
private int maxHeight = 0;
/**
- * A map of body tubes, to a list of components that contains finsets and launch lugs.
+ * A map of body tubes, to a list of components that contain fin sets, and launch lugs and rail buttons.
*/
private Map> markingGuideItems;
@@ -102,9 +103,10 @@ public class FinMarkingGuide extends JPanel {
/**
* Initialize the marking guide class by iterating over a rocket and finding all finsets.
*
- * @param component the root rocket component - this is iterated to find all finset and launch lugs
+ * @param component the root rocket component - this is iterated to find all fin sets, and launch lugs and
+ * rail buttons
*
- * @return a map of body tubes to lists of finsets and launch lugs.
+ * @return a map of body tubes to lists of fin sets, and launch lugs and rail buttons.
*/
private Map> init(Rocket component) {
Iterator iter = component.iterator(false);
@@ -119,7 +121,9 @@ public class FinMarkingGuide extends JPanel {
if (next instanceof BodyTube) {
current = (BodyTube) next;
}
- else if (next instanceof FinSet || next instanceof LaunchLug) {
+
+ // ACTION If Fin Set or Launch Lug or Rail Button
+ else if (next instanceof FinSet || next instanceof LaunchLug || next instanceof RailButton) {
java.util.List list = results.get(current);
if (list == null && current != null) {
list = new ArrayList();
@@ -202,8 +206,8 @@ public class FinMarkingGuide extends JPanel {
* | | + +
* | | + +
* | | +<------Launch Lug --------->+
- * | | + +
- * | | + +
+ * | | + and/or +
+ * | | + Rail Buttons +
* | | + +
* | | +<----------Fin------------->+
* | | + +
@@ -217,8 +221,8 @@ public class FinMarkingGuide extends JPanel {
* yLLOffset is computed from the difference between the base rotation of the fin and the radial direction of the
* lug.
*
- * Note: There is a current limitation that a tube with multiple launch lugs may not render the lug lines
- * correctly.
+ * Note: There is a current limitation that a tube with multiple launch lugs and/or rail buttons may not render
+ * the lug and/or rail button lines correctly.
*
*
* @param g the Graphics context
@@ -285,6 +289,8 @@ public class FinMarkingGuide extends JPanel {
// }
}
}
+
+ //BEGIN Launch Lug
else if (externalComponent instanceof LaunchLug) {
LaunchLug lug = (LaunchLug) externalComponent;
double angle = lug.getAngleOffset() - radialOrigin;
@@ -296,6 +302,21 @@ public class FinMarkingGuide extends JPanel {
g2.drawString(lug.getName(), x + (width / 3), (int) yLLOffset - 2);
}
+ //END Launch Lug
+
+ //BEGIN Rail Button
+ else if (externalComponent instanceof RailButton) {
+ RailButton button = (RailButton) externalComponent;
+ double angle = button.getAngleOffset() - radialOrigin;
+ while (angle < 0) {
+ angle += TWO_PI;
+ }
+ int yLLOffset = (int) Math.round(y + angle / TWO_PI * circumferenceInPoints);
+ drawDoubleArrowLine(g2, x, (int) yLLOffset, x + width, (int) yLLOffset);
+ g2.drawString(button.getName(), x + (width / 3), (int) yLLOffset - 2);
+
+ }
+ //END Rail Button
}
//Only if the tube has a lug or multiple finsets does the orientation of the marking guide matter. So print 'Front'.
if (hasMultipleComponents) {
@@ -318,8 +339,8 @@ public class FinMarkingGuide extends JPanel {
/**
* This function finds a origin in radians for the template so no component is on the template seam.
*
- * If no fin or launch lug is at 0.0 radians, then the origin is 0. If there is one, then half the distance
- * between the two are taken.
+ * If no fin, or launch lug or rail button is at 0.0 radians, then the origin is 0. If there is one, then half
+ * the distance between the two are taken.
*
* @param components
* @return
@@ -329,12 +350,22 @@ public class FinMarkingGuide extends JPanel {
ArrayList positions = new ArrayList(3 * components.size());
for (ExternalComponent component : components) {
-
+
+ // BEGIN Launch Lug
if (component instanceof LaunchLug) {
double componentPosition = ((LaunchLug) component).getAngleOffset();
positions.add(makeZeroTwoPi(componentPosition));
}
+ // END Launch Lug
+
+ // BEGIN Rail Button
+ if (component instanceof RailButton) {
+ double componentPosition = ((RailButton) component).getAngleOffset();
+
+ positions.add(makeZeroTwoPi(componentPosition));
+ }
+ // END Rail Button
if (component instanceof FinSet) {
FinSet fins = (FinSet) component;
@@ -434,8 +465,9 @@ public class FinMarkingGuide extends JPanel {
}
/**
- * Draw a vertical string indicating the front of the rocket. This is necessary when a launch lug exists to give
- * proper orientation of the guide (assuming that the lug is asymmetrically positioned with respect to a fin).
+ * Draw a vertical string indicating the front of the rocket. This is necessary when a launch lug and/or
+ * rail button exists to give proper orientation of the guide (assuming that the lug and/or button is
+ * asymmetrically positioned with respect to a fin).
*
* @param g2 the graphics context
* @param x the starting x coordinate