Skip to content

Commit 1fc8844

Browse files
committed
Added control interval count text field
1 parent 4e02cf0 commit 1fc8844

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

app/src/main/java/org/team2363/helixnavigator/document/waypoint/HCustomWaypoint.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
import javafx.beans.property.BooleanProperty;
1414
import javafx.beans.property.DoubleProperty;
15+
import javafx.beans.property.IntegerProperty;
1516
import javafx.beans.property.SimpleBooleanProperty;
1617
import javafx.beans.property.SimpleDoubleProperty;
18+
import javafx.beans.property.SimpleIntegerProperty;
1719
import javafx.scene.transform.Transform;
1820

1921
public class HCustomWaypoint extends HWaypoint {
@@ -30,6 +32,8 @@ public class HCustomWaypoint extends HWaypoint {
3032
private final BooleanProperty velocityYConstrained = new SimpleBooleanProperty(this, "velocityYConstrained", false);
3133
private final BooleanProperty velocityMagnitudeConstrained = new SimpleBooleanProperty(this, "velocityMagnitudeConstrained", false);
3234
private final BooleanProperty angularVelocityConstrained = new SimpleBooleanProperty(this, "angularVelocityConstrained", false);
35+
36+
private final IntegerProperty controlIntervalCount = new SimpleIntegerProperty(this, "controlIntervalCount", 100);
3337

3438
@DeserializedJSONConstructor
3539
public HCustomWaypoint() {
@@ -184,9 +188,21 @@ public final boolean isAngularVelocityConstrained() {
184188
return angularVelocityConstrained.get();
185189
}
186190

191+
public final IntegerProperty controlIntervalCountProperty() {
192+
return controlIntervalCount;
193+
}
194+
195+
public final void setControlIntervalCount(int value) {
196+
controlIntervalCount.set(value);
197+
}
198+
199+
public final int getControlIntervalCount() {
200+
return controlIntervalCount.get();
201+
}
202+
187203
public HolonomicWaypoint toWaypoint(List<InitialGuessPoint> initialGuessPoints) {
188204
return new HolonomicWaypoint(getX(), getY(), getHeading(), getVelocityX(), getVelocityY(), getAngularVelocity(),
189205
isXConstrained(), isYConstrained(), isHeadingConstrained(), isVelocityXConstrained(),
190-
isVelocityYConstrained(), isVelocityMagnitudeConstrained(), isAngularVelocityConstrained(), 100, initialGuessPoints, List.of());
206+
isVelocityYConstrained(), isVelocityMagnitudeConstrained(), isAngularVelocityConstrained(), getControlIntervalCount(), initialGuessPoints, List.of());
191207
}
192208
}

app/src/main/java/org/team2363/helixnavigator/ui/prompts/waypoint/CustomWaypointEditDialog.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.team2363.helixnavigator.document.waypoint.HCustomWaypoint;
1111
import org.team2363.helixnavigator.global.Standards.SupportedUnits.SupportedAngularSpeed;
1212
import org.team2363.helixnavigator.global.Standards.SupportedUnits.SupportedSpeed;
13+
import org.team2363.lib.ui.validation.IntegerTextField;
1314
import org.team2363.lib.ui.validation.UnitTextField;
1415

1516
import javafx.scene.control.CheckBox;
@@ -39,6 +40,8 @@ public class CustomWaypointEditDialog extends WaypointEditDialog {
3940
private final CheckBox velocityYConstrainedCheckBox = new CheckBox("Velocity Y");
4041
private final CheckBox velocityMagnitudeConstrainedCheckBox = new CheckBox("Velocity Magnitude");
4142
private final CheckBox angularVelocityConstrainedCheckBox = new CheckBox("Angular Velocity");
43+
private final Text controlIntervalCountText = new Text("Control Interval Count:");
44+
private final IntegerTextField controlIntervalCountTextField = new IntegerTextField(0, Integer.MAX_VALUE);
4245

4346
public CustomWaypointEditDialog(HCustomWaypoint customWaypoint) {
4447
super(customWaypoint, new HCustomWaypoint());
@@ -52,9 +55,12 @@ public CustomWaypointEditDialog(HCustomWaypoint customWaypoint) {
5255
GridPane.setConstraints(velocityYTextField, 1, ADDITIONAL_PROPERTIES_ROW + 2);
5356
GridPane.setConstraints(angularVelocityText, 0, ADDITIONAL_PROPERTIES_ROW + 3);
5457
GridPane.setConstraints(angularVelocityTextField, 1, ADDITIONAL_PROPERTIES_ROW + 3);
58+
GridPane.setConstraints(controlIntervalCountText, 0, ADDITIONAL_PROPERTIES_ROW + 4);
59+
GridPane.setConstraints(controlIntervalCountTextField, 1, ADDITIONAL_PROPERTIES_ROW + 4);
5560

5661
addGridItems(List.of(headingText, headingTextField, velocityXText, velocityXTextField,
57-
velocityYText, velocityYTextField, angularVelocityText, angularVelocityTextField));
62+
velocityYText, velocityYTextField, angularVelocityText, angularVelocityTextField,
63+
controlIntervalCountText, controlIntervalCountTextField));
5864

5965
vBox.getChildren().add(ADDITIONAL_NODES_ROW , activeConstraints);
6066
vBox.getChildren().add(ADDITIONAL_NODES_ROW + 1, xConstrainedCheckBox);
@@ -86,6 +92,7 @@ protected void initializeTextFields() {
8692
velocityYConstrainedCheckBox.setSelected(customWaypoint.isVelocityYConstrained());
8793
velocityMagnitudeConstrainedCheckBox.setSelected(customWaypoint.isVelocityMagnitudeConstrained());
8894
angularVelocityConstrainedCheckBox.setSelected(customWaypoint.isAngularVelocityConstrained());
95+
controlIntervalCountTextField.setValue(customWaypoint.getControlIntervalCount());
8996
}
9097

9198
@Override
@@ -102,6 +109,7 @@ protected void unbindWaypoint() {
102109
customWaypoint.velocityYConstrainedProperty().unbind();
103110
customWaypoint.velocityMagnitudeConstrainedProperty().unbind();
104111
customWaypoint.angularVelocityConstrainedProperty().unbind();
112+
customWaypoint.controlIntervalCountProperty().unbind();
105113
}
106114

107115
@Override
@@ -118,7 +126,7 @@ protected void bindWaypoint() {
118126
customWaypoint.velocityYConstrainedProperty().bind(velocityYConstrainedCheckBox.selectedProperty());
119127
customWaypoint.velocityMagnitudeConstrainedProperty().bind(velocityMagnitudeConstrainedCheckBox.selectedProperty());
120128
customWaypoint.angularVelocityConstrainedProperty().bind(angularVelocityConstrainedCheckBox.selectedProperty());
121-
129+
customWaypoint.controlIntervalCountProperty().bind(controlIntervalCountTextField.valueProperty());
122130
}
123131

124132
@Override
@@ -135,6 +143,7 @@ protected void backupWaypoint() {
135143
backupCustomWaypoint.setVelocityYConstrained(customWaypoint.isVelocityYConstrained());
136144
backupCustomWaypoint.setVelocityMagnitudeConstrained(customWaypoint.isVelocityMagnitudeConstrained());
137145
backupCustomWaypoint.setAngularVelocityConstrained(customWaypoint.isAngularVelocityConstrained());
146+
backupCustomWaypoint.setControlIntervalCount(customWaypoint.getControlIntervalCount());
138147
}
139148

140149
@Override
@@ -151,5 +160,6 @@ protected void restoreBackup() {
151160
customWaypoint.setVelocityYConstrained(backupCustomWaypoint.isVelocityYConstrained());
152161
customWaypoint.setVelocityMagnitudeConstrained(backupCustomWaypoint.isVelocityMagnitudeConstrained());
153162
customWaypoint.setAngularVelocityConstrained(backupCustomWaypoint.isAngularVelocityConstrained());
163+
customWaypoint.setControlIntervalCount(backupCustomWaypoint.getControlIntervalCount());
154164
}
155165
}

0 commit comments

Comments
 (0)