Merge pull request #2407 from SiboVG/issue-2345
[#2345] Reintroduce motor ignition delay optimization
This commit is contained in:
commit
ce2c9c97fe
@ -10,6 +10,7 @@ import java.util.Map;
|
|||||||
import net.sf.openrocket.document.OpenRocketDocument;
|
import net.sf.openrocket.document.OpenRocketDocument;
|
||||||
import net.sf.openrocket.document.Simulation;
|
import net.sf.openrocket.document.Simulation;
|
||||||
import net.sf.openrocket.l10n.Translator;
|
import net.sf.openrocket.l10n.Translator;
|
||||||
|
import net.sf.openrocket.motor.MotorConfiguration;
|
||||||
import net.sf.openrocket.optimization.general.OptimizationException;
|
import net.sf.openrocket.optimization.general.OptimizationException;
|
||||||
import net.sf.openrocket.optimization.rocketoptimization.SimulationModifier;
|
import net.sf.openrocket.optimization.rocketoptimization.SimulationModifier;
|
||||||
import net.sf.openrocket.optimization.rocketoptimization.modifiers.FlightConfigurationModifier;
|
import net.sf.openrocket.optimization.rocketoptimization.modifiers.FlightConfigurationModifier;
|
||||||
@ -181,6 +182,7 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
|
|||||||
MotorMount mount = (MotorMount) c;
|
MotorMount mount = (MotorMount) c;
|
||||||
if (mount.isMotorMount()) {
|
if (mount.isMotorMount()) {
|
||||||
|
|
||||||
|
// Motor overhang
|
||||||
SimulationModifier mod = new GenericComponentModifier(
|
SimulationModifier mod = new GenericComponentModifier(
|
||||||
trans.get("optimization.modifier.motormount.overhang"),
|
trans.get("optimization.modifier.motormount.overhang"),
|
||||||
trans.get("optimization.modifier.motormount.overhang.desc"),
|
trans.get("optimization.modifier.motormount.overhang.desc"),
|
||||||
@ -189,21 +191,17 @@ public class DefaultSimulationModifierService implements SimulationModifierServi
|
|||||||
setDefaultMinMax(mod, simulation);
|
setDefaultMinMax(mod, simulation);
|
||||||
modifiers.add(mod);
|
modifiers.add(mod);
|
||||||
|
|
||||||
// TODO: reimplement motor ignition optimization
|
// Motor ignition delay
|
||||||
// mod = new FlightConfigurationModifier<MotorInstance>(
|
mod = new FlightConfigurationModifier<MotorConfiguration>(
|
||||||
// trans.get("optimization.modifier.motormount.delay"),
|
trans.get("optimization.modifier.motormount.delay"),
|
||||||
// trans.get("optimization.modifier.motormount.delay.desc"),
|
trans.get("optimization.modifier.motormount.delay.desc"),
|
||||||
// c, UnitGroup.UNITS_SHORT_TIME,
|
c, UnitGroup.UNITS_SHORT_TIME,
|
||||||
// 1.0,
|
1.0, c.getClass(), c.getID(), "MotorConfigurationSet",
|
||||||
// c.getClass(),
|
MotorConfiguration.class,
|
||||||
// c.getID(),
|
"IgnitionDelay");
|
||||||
// "IgnitionConfiguration",
|
mod.setMinValue(0);
|
||||||
// IgnitionConfiguration.class,
|
mod.setMaxValue(5);
|
||||||
// "IgnitionDelay");
|
modifiers.add(mod);
|
||||||
//
|
|
||||||
// mod.setMinValue(0);
|
|
||||||
// mod.setMaxValue(5);
|
|
||||||
// modifiers.add(mod);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ public class SimulationModifierTree extends BasicTree {
|
|||||||
|
|
||||||
private static Color textColor;
|
private static Color textColor;
|
||||||
private static Color dimTextColor;
|
private static Color dimTextColor;
|
||||||
|
private static Color disabledTextColor;
|
||||||
private static Color textSelectionForegroundColor;
|
private static Color textSelectionForegroundColor;
|
||||||
private static Color textSelectionBackgroundColor;
|
private static Color textSelectionBackgroundColor;
|
||||||
|
|
||||||
@ -77,6 +78,7 @@ public class SimulationModifierTree extends BasicTree {
|
|||||||
private static void updateColors() {
|
private static void updateColors() {
|
||||||
textColor = GUIUtil.getUITheme().getTextColor();
|
textColor = GUIUtil.getUITheme().getTextColor();
|
||||||
dimTextColor = GUIUtil.getUITheme().getDimTextColor();
|
dimTextColor = GUIUtil.getUITheme().getDimTextColor();
|
||||||
|
disabledTextColor = GUIUtil.getUITheme().getDisabledTextColor();
|
||||||
textSelectionForegroundColor = GUIUtil.getUITheme().getTextSelectionForegroundColor();
|
textSelectionForegroundColor = GUIUtil.getUITheme().getTextSelectionForegroundColor();
|
||||||
textSelectionBackgroundColor = GUIUtil.getUITheme().getTextSelectionBackgroundColor();
|
textSelectionBackgroundColor = GUIUtil.getUITheme().getTextSelectionBackgroundColor();
|
||||||
}
|
}
|
||||||
@ -197,16 +199,18 @@ public class SimulationModifierTree extends BasicTree {
|
|||||||
setForeground(dimTextColor);
|
setForeground(dimTextColor);
|
||||||
setFont(stringFont);
|
setFont(stringFont);
|
||||||
} else if (object instanceof SimulationModifier) {
|
} else if (object instanceof SimulationModifier) {
|
||||||
|
boolean isSelected = tree.getSelectionRows() != null && IntStream.of(tree.getSelectionRows()).anyMatch(r -> r == row);
|
||||||
if (selectedModifiers.contains(object)) {
|
if (isSelected) {
|
||||||
setForeground(dimTextColor);
|
|
||||||
setFont(stringFont);
|
|
||||||
} else {
|
|
||||||
if (tree.getSelectionRows() != null &&
|
|
||||||
IntStream.of(tree.getSelectionRows()).anyMatch(r -> r == row)) {
|
|
||||||
setForeground(textSelectionForegroundColor);
|
|
||||||
setBackground(textSelectionBackgroundColor);
|
setBackground(textSelectionBackgroundColor);
|
||||||
setOpaque(true);
|
setOpaque(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedModifiers.contains(object)) {
|
||||||
|
setForeground(disabledTextColor);
|
||||||
|
setFont(stringFont);
|
||||||
|
} else {
|
||||||
|
if (isSelected) {
|
||||||
|
setForeground(textSelectionForegroundColor);
|
||||||
} else {
|
} else {
|
||||||
setForeground(textColor);
|
setForeground(textColor);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ public class UITheme {
|
|||||||
Color getBorderColor();
|
Color getBorderColor();
|
||||||
Color getTextColor();
|
Color getTextColor();
|
||||||
Color getDimTextColor();
|
Color getDimTextColor();
|
||||||
|
Color getDisabledTextColor();
|
||||||
Color getTextSelectionForegroundColor();
|
Color getTextSelectionForegroundColor();
|
||||||
Color getTextSelectionBackgroundColor();
|
Color getTextSelectionBackgroundColor();
|
||||||
Color getWarningColor();
|
Color getWarningColor();
|
||||||
@ -205,6 +206,11 @@ public class UITheme {
|
|||||||
return Color.GRAY;
|
return Color.GRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getDisabledTextColor() {
|
||||||
|
return getDimTextColor();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Color getTextSelectionForegroundColor() {
|
public Color getTextSelectionForegroundColor() {
|
||||||
return UIManager.getColor("Tree.selectionForeground");
|
return UIManager.getColor("Tree.selectionForeground");
|
||||||
@ -567,6 +573,11 @@ public class UITheme {
|
|||||||
return new Color(182, 182, 182);
|
return new Color(182, 182, 182);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getDisabledTextColor() {
|
||||||
|
return new Color(161, 161, 161);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Color getTextSelectionForegroundColor() {
|
public Color getTextSelectionForegroundColor() {
|
||||||
return Color.WHITE;
|
return Color.WHITE;
|
||||||
@ -925,6 +936,12 @@ public class UITheme {
|
|||||||
return new Color(165, 171, 184);
|
return new Color(165, 171, 184);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getDisabledTextColor() {
|
||||||
|
return new Color(128, 128, 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Color getTextSelectionForegroundColor() {
|
public Color getTextSelectionForegroundColor() {
|
||||||
return Color.WHITE;
|
return Color.WHITE;
|
||||||
@ -1296,6 +1313,11 @@ public class UITheme {
|
|||||||
return getCurrentTheme().getDimTextColor();
|
return getCurrentTheme().getDimTextColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getDisabledTextColor() {
|
||||||
|
return getCurrentTheme().getDisabledTextColor();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Color getTextSelectionForegroundColor() {
|
public Color getTextSelectionForegroundColor() {
|
||||||
return getCurrentTheme().getTextSelectionForegroundColor();
|
return getCurrentTheme().getTextSelectionForegroundColor();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user