refactored RocketFigure to use RocketPanel.VIEW_TYPE enum instead of unchecked ints
This commit is contained in:
parent
8e268a9a25
commit
6f4cba68ae
@ -44,8 +44,8 @@ RocketActions.MoveDownAct.Movedown = Move down
|
||||
RocketActions.MoveDownAct.ttip.Movedown = Move this component downwards.
|
||||
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = Side view
|
||||
RocketPanel.FigTypeAct.Backview = Back view
|
||||
RocketPanel.FigTypeAct.SideView = Side view
|
||||
RocketPanel.FigTypeAct.BackView = Back view
|
||||
RocketPanel.FigTypeAct.Figure3D = 3D Figure
|
||||
RocketPanel.FigTypeAct.Finished = 3D Finished
|
||||
RocketPanel.FigTypeAct.Unfinished = 3D Unfinished
|
||||
|
@ -44,10 +44,10 @@ RocketActions.MoveDownAct.Movedown = Presun dolu
|
||||
RocketActions.MoveDownAct.ttip.Movedown = Presun tuto komponentu smerem dolu.
|
||||
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = Pohled ze strany
|
||||
RocketPanel.FigTypeAct.ttip.Sideview = Pohled ze strany
|
||||
RocketPanel.FigTypeAct.Backview = Zpetný pohled
|
||||
RocketPanel.FigTypeAct.ttip.Backview = Zadní pohled
|
||||
RocketPanel.FigTypeAct.SideView = Pohled ze strany
|
||||
RocketPanel.FigTypeAct.ttip.SideView = Pohled ze strany
|
||||
RocketPanel.FigTypeAct.BackView = Zpetný pohled
|
||||
RocketPanel.FigTypeAct.ttip.BackView = Zadní pohled
|
||||
RocketPanel.FigViewAct.2D = 2D Pohled
|
||||
RocketPanel.FigViewAct.ttip.2D = 2D Pohled
|
||||
RocketPanel.FigViewAct.3D = 3D Pohled
|
||||
|
@ -44,10 +44,10 @@ RocketActions.MoveDownAct.Movedown = Nach unten verschieben
|
||||
RocketActions.MoveDownAct.ttip.Movedown = Verschiebt diese Komponente nach unten.
|
||||
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = Seitenansicht
|
||||
RocketPanel.FigTypeAct.ttip.Sideview = Seitenansicht
|
||||
RocketPanel.FigTypeAct.Backview = Rückansicht
|
||||
RocketPanel.FigTypeAct.ttip.Backview = Vorderansicht
|
||||
RocketPanel.FigTypeAct.SideView = Seitenansicht
|
||||
RocketPanel.FigTypeAct.ttip.SideView = Seitenansicht
|
||||
RocketPanel.FigTypeAct.BackView = Rückansicht
|
||||
RocketPanel.FigTypeAct.ttip.BackView = Vorderansicht
|
||||
RocketPanel.FigViewAct.2D = 2D Ansicht
|
||||
RocketPanel.FigViewAct.ttip.2D = 2D Ansicht
|
||||
RocketPanel.FigViewAct.3D = 3D Ansicht
|
||||
|
@ -891,14 +891,14 @@ RocketInfo.massText2 = Masa sin motores:
|
||||
RocketInfo.stabText = Estabilidad:
|
||||
RocketInfo.velocityValue = N/A
|
||||
|
||||
RocketPanel.FigTypeAct.Backview = Vista trasera
|
||||
RocketPanel.FigTypeAct.BackView = Vista trasera
|
||||
RocketPanel.FigTypeAct.Figure3D = Esquema en 3D
|
||||
RocketPanel.FigTypeAct.Finished = Acabado en 3D
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = Vista lateral
|
||||
RocketPanel.FigTypeAct.SideView = Vista lateral
|
||||
RocketPanel.FigTypeAct.Unfinished = Sin acabado en 3D
|
||||
RocketPanel.FigTypeAct.ttip.Backview = Vista desde atr\u00e1s
|
||||
RocketPanel.FigTypeAct.ttip.Sideview = Vista desde un lateral
|
||||
RocketPanel.FigTypeAct.ttip.BackView = Vista desde atr\u00e1s
|
||||
RocketPanel.FigTypeAct.ttip.SideView = Vista desde un lateral
|
||||
RocketPanel.FigViewAct.2D = Vista 2D
|
||||
RocketPanel.FigViewAct.3D = Vista 3D
|
||||
RocketPanel.FigViewAct.ttip.2D = Vista en 2D
|
||||
|
@ -883,14 +883,14 @@ RocketInfo.massText2 = Masse sans moteurs
|
||||
RocketInfo.stabText = Stabilit\u00E9:
|
||||
RocketInfo.velocityValue = N/A
|
||||
|
||||
RocketPanel.FigTypeAct.Backview = Vue arri\u00E8re
|
||||
RocketPanel.FigTypeAct.BackView = Vue arri\u00E8re
|
||||
RocketPanel.FigTypeAct.Figure3D = Figure 3D
|
||||
RocketPanel.FigTypeAct.Finished = Finitions en 3D
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = Vue de cot\u00E9
|
||||
RocketPanel.FigTypeAct.SideView = Vue de cot\u00E9
|
||||
RocketPanel.FigTypeAct.Unfinished = Sans finissions 3D
|
||||
RocketPanel.FigTypeAct.ttip.Backview = Vue arri\u00E8re
|
||||
RocketPanel.FigTypeAct.ttip.Sideview = Vue de cot\u00E9
|
||||
RocketPanel.FigTypeAct.ttip.BackView = Vue arri\u00E8re
|
||||
RocketPanel.FigTypeAct.ttip.SideView = Vue de cot\u00E9
|
||||
RocketPanel.FigViewAct.2D = Vue 2D
|
||||
RocketPanel.FigViewAct.3D = Vue 3D
|
||||
RocketPanel.FigViewAct.ttip.2D = Vue 2D
|
||||
|
@ -44,10 +44,10 @@ RocketActions.MoveDownAct.Movedown = Muove giu'
|
||||
RocketActions.MoveDownAct.ttip.Movedown = Muovi questo componente verso il basso.
|
||||
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = Vista laterale
|
||||
RocketPanel.FigTypeAct.ttip.Sideview = Vista laterale
|
||||
RocketPanel.FigTypeAct.Backview = Vista da sotto
|
||||
RocketPanel.FigTypeAct.ttip.Backview = Vista da dietro
|
||||
RocketPanel.FigTypeAct.SideView = Vista laterale
|
||||
RocketPanel.FigTypeAct.ttip.SideView = Vista laterale
|
||||
RocketPanel.FigTypeAct.BackView = Vista da sotto
|
||||
RocketPanel.FigTypeAct.ttip.BackView = Vista da dietro
|
||||
RocketPanel.FigViewAct.2D = 2D View
|
||||
RocketPanel.FigViewAct.ttip.2D = 2D View
|
||||
RocketPanel.FigViewAct.3D = 3D View
|
||||
|
@ -40,10 +40,10 @@ RocketActions.MoveDownAct.Movedown = \u4E0B\u306B\u79FB\u52D5
|
||||
RocketActions.MoveDownAct.ttip.Movedown = \u90E8\u54C1\u3092\u4E0B\u306E\u968E\u5C64\u306B\u79FB\u52D5
|
||||
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = \u5074\u9762\u56F3
|
||||
RocketPanel.FigTypeAct.ttip.Sideview = \u5074\u9762\u56F3
|
||||
RocketPanel.FigTypeAct.Backview = \u80CC\u9762\u56F3
|
||||
RocketPanel.FigTypeAct.ttip.Backview = \u5F8C\u308D\u304B\u3089\u306E\u56F3
|
||||
RocketPanel.FigTypeAct.SideView = \u5074\u9762\u56F3
|
||||
RocketPanel.FigTypeAct.ttip.SideView = \u5074\u9762\u56F3
|
||||
RocketPanel.FigTypeAct.BackView = \u80CC\u9762\u56F3
|
||||
RocketPanel.FigTypeAct.ttip.BackView = \u5F8C\u308D\u304B\u3089\u306E\u56F3
|
||||
RocketPanel.FigViewAct.2D = 2D View
|
||||
RocketPanel.FigViewAct.ttip.2D = 2D View
|
||||
RocketPanel.FigViewAct.3D = 3D View
|
||||
|
@ -44,10 +44,10 @@
|
||||
RocketActions.MoveDownAct.ttip.Movedown = Przesu\u0144 wybran\u0105 cz\u0119\u015B\u0107 w dó\u0142.
|
||||
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = Widok z boku
|
||||
RocketPanel.FigTypeAct.ttip.Sideview = Widok z boku
|
||||
RocketPanel.FigTypeAct.Backview = Widok z ty\u0142u
|
||||
RocketPanel.FigTypeAct.ttip.Backview = Widok tylny
|
||||
RocketPanel.FigTypeAct.SideView = Widok z boku
|
||||
RocketPanel.FigTypeAct.ttip.SideView = Widok z boku
|
||||
RocketPanel.FigTypeAct.BackView = Widok z ty\u0142u
|
||||
RocketPanel.FigTypeAct.ttip.BackView = Widok tylny
|
||||
RocketPanel.FigViewAct.2D = Widok 2D
|
||||
RocketPanel.FigViewAct.ttip.2D = Widok 2D
|
||||
RocketPanel.FigViewAct.3D = Widok 3D
|
||||
|
@ -867,14 +867,14 @@ RocketInfo.massText2 = Massa sem motores
|
||||
RocketInfo.stabText = Estabilidade:
|
||||
RocketInfo.velocityValue = N/D
|
||||
|
||||
RocketPanel.FigTypeAct.Backview = Vista traseira
|
||||
RocketPanel.FigTypeAct.BackView = Vista traseira
|
||||
RocketPanel.FigTypeAct.Figure3D = Figura 3D
|
||||
RocketPanel.FigTypeAct.Finished = 3D Acabado
|
||||
# RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = Vista lateral
|
||||
RocketPanel.FigTypeAct.SideView = Vista lateral
|
||||
RocketPanel.FigTypeAct.Unfinished = 3D Inacabado
|
||||
RocketPanel.FigTypeAct.ttip.Backview = Vista traseira
|
||||
RocketPanel.FigTypeAct.ttip.Sideview = Vista lateral
|
||||
RocketPanel.FigTypeAct.ttip.BackView = Vista traseira
|
||||
RocketPanel.FigTypeAct.ttip.SideView = Vista lateral
|
||||
RocketPanel.FigViewAct.2D = Vista 2D
|
||||
RocketPanel.FigViewAct.3D = Vista 3D
|
||||
RocketPanel.FigViewAct.ttip.2D = Vista 2D
|
||||
|
@ -44,8 +44,8 @@ RocketActions.MoveDownAct.Movedown = \u041f\u0435\u0440\u0435\u043c\u0435\u0441\
|
||||
RocketActions.MoveDownAct.ttip.Movedown = \u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0432\u043d\u0438\u0437.
|
||||
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = \u0412\u0438\u0434 \u0441\u0431\u043e\u043a\u0443
|
||||
RocketPanel.FigTypeAct.Backview = \u0412\u0438\u0434 \u0441\u0437\u0430\u0434\u0438
|
||||
RocketPanel.FigTypeAct.SideView = \u0412\u0438\u0434 \u0441\u0431\u043e\u043a\u0443
|
||||
RocketPanel.FigTypeAct.BackView = \u0412\u0438\u0434 \u0441\u0437\u0430\u0434\u0438
|
||||
RocketPanel.FigTypeAct.Figure3D = 3D \u0441\u0445\u0435\u043c\u0430
|
||||
RocketPanel.FigTypeAct.Finished = 3D \u043e\u0442\u0434\u0435\u043b\u043a\u0430
|
||||
RocketPanel.FigTypeAct.Unfinished = 3D \u0447\u0435\u0440\u043d\u043e\u0432\u0430\u044f
|
||||
|
@ -50,8 +50,8 @@ RocketActions.MoveDownAct.ttip.Movedown = A\u015fa\u011f\u0131ya do\u011fru bu p
|
||||
ettir.
|
||||
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = Yandan G\u00f6r\u00fcn\u00fc\u015f
|
||||
RocketPanel.FigTypeAct.Backview = Arkadan G\u00f6r\u00fcn\u00fc\u015f
|
||||
RocketPanel.FigTypeAct.SideView = Yandan G\u00f6r\u00fcn\u00fc\u015f
|
||||
RocketPanel.FigTypeAct.BackView = Arkadan G\u00f6r\u00fcn\u00fc\u015f
|
||||
RocketPanel.FigTypeAct.Figure3D = 3D Resimlendirme
|
||||
RocketPanel.FigTypeAct.Finished = 3D Bitmi\u015f
|
||||
RocketPanel.FigTypeAct.Unfinished = 3D Bitmemi\u015f
|
||||
|
@ -46,8 +46,8 @@ RocketActions.MoveDownAct.Movedown = Move down
|
||||
RocketActions.MoveDownAct.ttip.Movedown = Move this component downwards.
|
||||
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = Side view
|
||||
RocketPanel.FigTypeAct.Backview = Back view
|
||||
RocketPanel.FigTypeAct.SideView = Side view
|
||||
RocketPanel.FigTypeAct.BackView = Back view
|
||||
RocketPanel.FigTypeAct.Figure3D = 3D Figure
|
||||
RocketPanel.FigTypeAct.Finished = 3D Finished
|
||||
RocketPanel.FigTypeAct.Unfinished = 3D Unfinished
|
||||
|
@ -957,11 +957,11 @@ RocketInfo.massText2 = \u4E0D\u542B\u53D1\u52A8\u673A\u7684\u51C0\u
|
||||
RocketInfo.stabText = \u7A33\u5B9A\u6027:
|
||||
RocketInfo.velocityValue = N/A
|
||||
|
||||
RocketPanel.FigTypeAct.Backview = \u540E\u89C6\u56FE
|
||||
RocketPanel.FigTypeAct.BackView = \u540E\u89C6\u56FE
|
||||
RocketPanel.FigTypeAct.Figure3D = \u4E09\u7EF4\u56FE
|
||||
RocketPanel.FigTypeAct.Finished = \u4E09\u7EF4\u7CBE\u7EC6\u56FE
|
||||
! RocketPanel
|
||||
RocketPanel.FigTypeAct.Sideview = \u4FA7\u89C6\u56FE
|
||||
RocketPanel.FigTypeAct.SideView = \u4FA7\u89C6\u56FE
|
||||
RocketPanel.FigTypeAct.Unfinished = \u4E09\u7EF4\u8349\u56FE
|
||||
RocketPanel.lbl.Flightcfg = \u98DE\u884C\u914D\u7F6E:
|
||||
RocketPanel.lbl.ViewType = \u89C6\u56FE\u7C7B\u578B:
|
||||
|
@ -135,6 +135,7 @@ public class Stage extends ComponentAssembly implements FlightConfigurableCompon
|
||||
@Override
|
||||
public void setRadialPosition(final double radius) {
|
||||
this.radialPosition_m = radius;
|
||||
log.error(" set radial position for: " + this.getName() + " to: " + this.radialPosition_m + " ... in meters?");
|
||||
if (this.outside) {
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
}
|
||||
|
@ -56,9 +56,9 @@ import com.jogamp.opengl.util.awt.Overlay;
|
||||
*/
|
||||
public class RocketFigure3d extends JPanel implements GLEventListener {
|
||||
|
||||
public static final int TYPE_FIGURE = 0;
|
||||
public static final int TYPE_UNFINISHED = 1;
|
||||
public static final int TYPE_FINISHED = 2;
|
||||
public static final int TYPE_FIGURE = 2;
|
||||
public static final int TYPE_UNFINISHED = 3;
|
||||
public static final int TYPE_FINISHED = 4;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger log = LoggerFactory.getLogger(RocketFigure3d.class);
|
||||
|
@ -26,6 +26,7 @@ import net.sf.openrocket.motor.Motor;
|
||||
import net.sf.openrocket.rocketcomponent.Configuration;
|
||||
import net.sf.openrocket.rocketcomponent.MotorMount;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.gui.scalefigure.RocketPanel;
|
||||
import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.util.BugException;
|
||||
import net.sf.openrocket.util.Coordinate;
|
||||
@ -47,8 +48,8 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
private static final String ROCKET_FIGURE_PACKAGE = "net.sf.openrocket.gui.rocketfigure";
|
||||
private static final String ROCKET_FIGURE_SUFFIX = "Shapes";
|
||||
|
||||
public static final int TYPE_SIDE = 1;
|
||||
public static final int TYPE_BACK = 2;
|
||||
public static final int VIEW_SIDE=0;
|
||||
public static final int VIEW_BACK=1;
|
||||
|
||||
// Width for drawing normal and selected components
|
||||
public static final double NORMAL_WIDTH = 1.0;
|
||||
@ -58,7 +59,7 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
private Configuration configuration;
|
||||
private RocketComponent[] selection = new RocketComponent[0];
|
||||
|
||||
private int type = TYPE_SIDE;
|
||||
private RocketPanel.VIEW_TYPE currentViewType = RocketPanel.VIEW_TYPE.SideView;
|
||||
|
||||
private double rotation;
|
||||
private Transformation transformation;
|
||||
@ -158,17 +159,17 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
}
|
||||
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
public RocketPanel.VIEW_TYPE getType() {
|
||||
return currentViewType;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
if (type != TYPE_BACK && type != TYPE_SIDE) {
|
||||
public void setType(final RocketPanel.VIEW_TYPE type) {
|
||||
if (type != RocketPanel.VIEW_TYPE.BackView && type != RocketPanel.VIEW_TYPE.SideView) {
|
||||
throw new IllegalArgumentException("Illegal type: " + type);
|
||||
}
|
||||
if (this.type == type)
|
||||
if (this.currentViewType == type)
|
||||
return;
|
||||
this.type = type;
|
||||
this.currentViewType = type;
|
||||
updateFigure();
|
||||
}
|
||||
|
||||
@ -185,7 +186,9 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
|
||||
// Get shapes for all active components
|
||||
for (RocketComponent c : configuration) {
|
||||
Shape[] s = getShapes(c);
|
||||
Shape[] s = getShapes( this.currentViewType, c, this.transformation);
|
||||
|
||||
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
figureShapes.add(s[i]);
|
||||
figureComponents.add(c);
|
||||
@ -249,19 +252,19 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
if (figureWidthPx + 2 * borderPixelsWidth < getWidth()) {
|
||||
|
||||
// Figure fits in the viewport
|
||||
if (type == TYPE_BACK)
|
||||
if (currentViewType == RocketPanel.VIEW_TYPE.BackView){
|
||||
tx = getWidth() / 2;
|
||||
else
|
||||
}else{
|
||||
tx = (getWidth() - figureWidthPx) / 2 - minX * scale;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
// Figure does not fit in viewport
|
||||
if (type == TYPE_BACK)
|
||||
if (currentViewType == RocketPanel.VIEW_TYPE.BackView){
|
||||
tx = borderPixelsWidth + figureWidthPx / 2;
|
||||
else
|
||||
}else{
|
||||
tx = borderPixelsWidth - minX * scale;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ty = computeTy(figureHeightPx);
|
||||
@ -365,7 +368,7 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
|
||||
for (Coordinate coord : position) {
|
||||
Shape s;
|
||||
if (type == TYPE_SIDE) {
|
||||
if (currentViewType == RocketPanel.VIEW_TYPE.SideView) {
|
||||
s = new Rectangle2D.Double(EXTRA_SCALE * coord.x,
|
||||
EXTRA_SCALE * (coord.y - radius), EXTRA_SCALE * length,
|
||||
EXTRA_SCALE * 2 * radius);
|
||||
@ -436,17 +439,17 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
private Shape[] getShapes(RocketComponent component) {
|
||||
private static Shape[] getShapes(final RocketPanel.VIEW_TYPE type, final RocketComponent component, final Transformation transformation) {
|
||||
Reflection.Method m;
|
||||
|
||||
// Find the appropriate method
|
||||
switch (type) {
|
||||
case TYPE_SIDE:
|
||||
case SideView:
|
||||
m = Reflection.findMethod(ROCKET_FIGURE_PACKAGE, component, ROCKET_FIGURE_SUFFIX, "getShapesSide",
|
||||
RocketComponent.class, Transformation.class);
|
||||
break;
|
||||
|
||||
case TYPE_BACK:
|
||||
case BackView:
|
||||
m = Reflection.findMethod(ROCKET_FIGURE_PACKAGE, component, ROCKET_FIGURE_SUFFIX, "getShapesBack",
|
||||
RocketComponent.class, Transformation.class);
|
||||
break;
|
||||
@ -513,19 +516,19 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
private void calculateSize() {
|
||||
calculateFigureBounds();
|
||||
|
||||
switch (type) {
|
||||
case TYPE_SIDE:
|
||||
switch (currentViewType) {
|
||||
case SideView:
|
||||
figureWidth = maxX - minX;
|
||||
figureHeight = 2 * maxR;
|
||||
break;
|
||||
|
||||
case TYPE_BACK:
|
||||
case BackView:
|
||||
figureWidth = 2 * maxR;
|
||||
figureHeight = 2 * maxR;
|
||||
break;
|
||||
|
||||
default:
|
||||
assert (false) : "Should not occur, type=" + type;
|
||||
assert (false) : "Should not occur, type=" + currentViewType;
|
||||
figureWidth = 0;
|
||||
figureHeight = 0;
|
||||
}
|
||||
@ -544,15 +547,15 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
}
|
||||
|
||||
public Rectangle2D getDimensions() {
|
||||
switch (type) {
|
||||
case TYPE_SIDE:
|
||||
switch (currentViewType) {
|
||||
case SideView:
|
||||
return new Rectangle2D.Double(minX, -maxR, maxX - minX, 2 * maxR);
|
||||
|
||||
case TYPE_BACK:
|
||||
case BackView:
|
||||
return new Rectangle2D.Double(-maxR, -maxR, 2 * maxR, 2 * maxR);
|
||||
|
||||
default:
|
||||
throw new BugException("Illegal figure type = " + type);
|
||||
throw new BugException("Illegal figure type = " + currentViewType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,8 +89,8 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
private static final Translator trans = Application.getTranslator();
|
||||
|
||||
public static enum VIEW_TYPE {
|
||||
Sideview(false, RocketFigure.TYPE_SIDE),
|
||||
Backview(false, RocketFigure.TYPE_BACK),
|
||||
SideView(false, RocketFigure.VIEW_SIDE),
|
||||
BackView(false, RocketFigure.VIEW_BACK),
|
||||
Figure3D(true, RocketFigure3d.TYPE_FIGURE),
|
||||
Unfinished(true, RocketFigure3d.TYPE_UNFINISHED),
|
||||
Finished(true, RocketFigure3d.TYPE_FINISHED);
|
||||
@ -283,7 +283,9 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
|
||||
|
||||
// View Type Dropdown
|
||||
ComboBoxModel cm = new DefaultComboBoxModel(VIEW_TYPE.values()) {
|
||||
@SuppressWarnings("serial") // because java throws a warning without this.
|
||||
ComboBoxModel<VIEW_TYPE> cm = new DefaultComboBoxModel<VIEW_TYPE>(VIEW_TYPE.values()) {
|
||||
|
||||
@Override
|
||||
public void setSelectedItem(Object o) {
|
||||
super.setSelectedItem(o);
|
||||
@ -292,14 +294,14 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
figure3d.setType(v.type);
|
||||
go3D();
|
||||
} else {
|
||||
figure.setType(v.type);
|
||||
figure.setType(v);
|
||||
updateExtras(); // when switching from side view to back view, need to clear CP & CG markers
|
||||
go2D();
|
||||
}
|
||||
}
|
||||
};
|
||||
add(new JLabel(trans.get("RocketPanel.lbl.ViewType")), "spanx, split");
|
||||
add(new JComboBox(cm));
|
||||
add(new JComboBox<VIEW_TYPE>(cm));
|
||||
|
||||
|
||||
// Zoom level selector
|
||||
@ -655,7 +657,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
extraText.setWarnings(warnings);
|
||||
|
||||
|
||||
if (figure.getType() == RocketFigure.TYPE_SIDE && length > 0) {
|
||||
if (figure.getType() == RocketPanel.VIEW_TYPE.SideView && length > 0) {
|
||||
|
||||
// TODO: LOW: Y-coordinate and rotation
|
||||
extraCP.setPosition(cpx * RocketFigure.EXTRA_SCALE, 0);
|
||||
@ -844,9 +846,9 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
*/
|
||||
private class FigureTypeAction extends AbstractAction implements StateChangeListener {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final int type;
|
||||
private final VIEW_TYPE type;
|
||||
|
||||
public FigureTypeAction(int type) {
|
||||
public FigureTypeAction(VIEW_TYPE type) {
|
||||
this.type = type;
|
||||
stateChanged(null);
|
||||
figure.addChangeListener(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user