added new reverse option
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>de.srsoftware</groupId>
|
<groupId>de.srsoftware</groupId>
|
||||||
<artifactId>web4rail</artifactId>
|
<artifactId>web4rail</artifactId>
|
||||||
<version>1.2.45</version>
|
<version>1.2.46</version>
|
||||||
<name>Web4Rail</name>
|
<name>Web4Rail</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description>Java Model Railway Control</description>
|
<description>Java Model Railway Control</description>
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ export : exportieren
|
|||||||
Faster (10 {}) : 10 {} schneller
|
Faster (10 {}) : 10 {} schneller
|
||||||
Firing {} : starte {}
|
Firing {} : starte {}
|
||||||
FinishRoute : Route abschließen
|
FinishRoute : Route abschließen
|
||||||
|
For each {} do: Für jede(n) {}:
|
||||||
forward : vorwärts
|
forward : vorwärts
|
||||||
Found {} routes. : {} Routen gefunden.
|
Found {} routes. : {} Routen gefunden.
|
||||||
FreeStartBlock : Start-Block freigeben
|
FreeStartBlock : Start-Block freigeben
|
||||||
@@ -111,6 +112,7 @@ Help : Hilfe
|
|||||||
(id\: {}, length\: {}) : (Id: {}, Länge: {})
|
(id\: {}, length\: {}) : (Id: {}, Länge: {})
|
||||||
if ({})\: : falls ({}):
|
if ({})\: : falls ({}):
|
||||||
inverted : invertiert
|
inverted : invertiert
|
||||||
|
Inverts the direction {} is heading to. : Kehrt die Richtung, in welche {} fährt, um.
|
||||||
{} is oriented {} : {} ist {} gerichtet
|
{} is oriented {} : {} ist {} gerichtet
|
||||||
known cars : bekannte Waggons
|
known cars : bekannte Waggons
|
||||||
known locomotives : bekannte Lokomotiven
|
known locomotives : bekannte Lokomotiven
|
||||||
@@ -171,7 +173,7 @@ quit autopilot : Autopilot beenden
|
|||||||
Relays and Turnouts : Relais und Weichen
|
Relays and Turnouts : Relais und Weichen
|
||||||
Relay/Turnout : Relais/Weiche
|
Relay/Turnout : Relais/Weiche
|
||||||
Report Issue : Problem melden
|
Report Issue : Problem melden
|
||||||
reverse : rückwärts
|
reverse : wenden
|
||||||
Reversed {}. : {} umgedreht.
|
Reversed {}. : {} umgedreht.
|
||||||
RIGHT : rechts
|
RIGHT : rechts
|
||||||
Right port\: : Port für rechts
|
Right port\: : Port für rechts
|
||||||
@@ -272,6 +274,7 @@ TurnoutRW : WeicheRW
|
|||||||
Turnouts : Weichen
|
Turnouts : Weichen
|
||||||
TurnTrain : Fahrtrichtung umkehren
|
TurnTrain : Fahrtrichtung umkehren
|
||||||
turn within train : innerhalb des Zugs drehen
|
turn within train : innerhalb des Zugs drehen
|
||||||
|
Turns the train, as if it went through a loop. : Dreht den ZUg, als wenn er eine Wendeschleife passiert hätte.
|
||||||
Unknown action\: {} : Unbekannte Aktion: {}
|
Unknown action\: {} : Unbekannte Aktion: {}
|
||||||
unset : ungesetzt
|
unset : ungesetzt
|
||||||
Wait {} ms, then\: : {} ms warten, dann:
|
Wait {} ms, then\: : {} ms warten, dann:
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ public class Route extends BaseClass {
|
|||||||
private Fieldset basicProperties() {
|
private Fieldset basicProperties() {
|
||||||
Fieldset fieldset = new Fieldset(t("Route properties"));
|
Fieldset fieldset = new Fieldset(t("Route properties"));
|
||||||
|
|
||||||
if (isSet(train)) train.link("span",t("Train: {}",train)).addTo(fieldset);
|
if (isSet(train)) train.link("span",t("Train")+": "+train).addTo(fieldset);
|
||||||
Tag list = new Tag("ul");
|
Tag list = new Tag("ul");
|
||||||
Plan.addLink(startBlock, t("Origin: {} to {}",startBlock.name,startDirection), list);
|
Plan.addLink(startBlock, t("Origin: {} to {}",startBlock.name,startDirection), list);
|
||||||
Plan.addLink(endBlock, t("Destination: {} from {}",endBlock.name,endDirection.inverse()), list);
|
Plan.addLink(endBlock, t("Destination: {} from {}",endBlock.name,endDirection.inverse()), list);
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ public class Car extends BaseClass implements Comparable<Car>{
|
|||||||
formInputs.add(t("Tags"), new Input(TAGS,String.join(", ", tags)));
|
formInputs.add(t("Tags"), new Input(TAGS,String.join(", ", tags)));
|
||||||
Tag div = new Tag("div");
|
Tag div = new Tag("div");
|
||||||
new Input(MAX_SPEED, maxSpeedForward).numeric().addTo(new Tag("p")).content(NBSP+speedUnit+NBSP+t("forward")).addTo(div);
|
new Input(MAX_SPEED, maxSpeedForward).numeric().addTo(new Tag("p")).content(NBSP+speedUnit+NBSP+t("forward")).addTo(div);
|
||||||
new Input(MAX_SPEED_REVERSE, maxSpeedReverse).numeric().addTo(new Tag("p")).content(NBSP+speedUnit+NBSP+t("reverse")).addTo(div);
|
new Input(MAX_SPEED_REVERSE, maxSpeedReverse).numeric().addTo(new Tag("p")).content(NBSP+speedUnit+NBSP+t("backward")).addTo(div);
|
||||||
formInputs.add(t("Maximum Speed"),div);
|
formInputs.add(t("Maximum Speed"),div);
|
||||||
|
|
||||||
Fieldset fieldset = new Fieldset(t("Train"));
|
Fieldset fieldset = new Fieldset(t("Train"));
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public class Locomotive extends Car implements Constants,Device{
|
|||||||
}
|
}
|
||||||
|
|
||||||
params.put(ACTION, ACTION_TURN);
|
params.put(ACTION, ACTION_TURN);
|
||||||
new Button(t("Turn"),params).clazz(ACTION_TURN).addTo(direction);
|
new Button(t("Turn"),params).title(t("Inverts the direction {} is heading to.",locoOrTrain)).clazz(ACTION_TURN).addTo(direction);
|
||||||
|
|
||||||
if (isSet(train)) {
|
if (isSet(train)) {
|
||||||
Block currentBlock = train.currentBlock();
|
Block currentBlock = train.currentBlock();
|
||||||
@@ -147,8 +147,7 @@ public class Locomotive extends Car implements Constants,Device{
|
|||||||
params.put(ACTION, e.getValue());
|
params.put(ACTION, e.getValue());
|
||||||
new Button(t(e.getKey()),params).addTo(functions);
|
new Button(t(e.getKey()),params).addTo(functions);
|
||||||
});
|
});
|
||||||
functions.addTo(fieldset);
|
functions.addTo(fieldset);
|
||||||
|
|
||||||
|
|
||||||
return fieldset;
|
return fieldset;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
private static final String TAGS = "tags";
|
private static final String TAGS = "tags";
|
||||||
|
|
||||||
private static final String DESTINATION = "destination";
|
private static final String DESTINATION = "destination";
|
||||||
|
|
||||||
|
private static final String ACTION_REVERSE = "reverse";
|
||||||
|
|
||||||
private HashSet<String> tags = new HashSet<String>();
|
private HashSet<String> tags = new HashSet<String>();
|
||||||
private boolean f1,f2,f3,f4;
|
private boolean f1,f2,f3,f4;
|
||||||
@@ -134,7 +136,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
Id id = Id.from(params);
|
Id id = Id.from(params);
|
||||||
Train train = trains.get(id);
|
Train train = trains.get(id);
|
||||||
if (isNull(train)) return(t("No train with id {}!",id));
|
if (isNull(train)) return(t("No train with id {}!",id));
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case ACTION_ADD:
|
case ACTION_ADD:
|
||||||
return train.addCar(params);
|
return train.addCar(params);
|
||||||
case ACTION_AUTO:
|
case ACTION_AUTO:
|
||||||
@@ -157,6 +159,8 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
return train.properties();
|
return train.properties();
|
||||||
case ACTION_QUIT:
|
case ACTION_QUIT:
|
||||||
return train.quitAutopilot();
|
return train.quitAutopilot();
|
||||||
|
case ACTION_REVERSE:
|
||||||
|
return train.reverse();
|
||||||
case ACTION_SLOWER10:
|
case ACTION_SLOWER10:
|
||||||
return train.slower(10);
|
return train.slower(10);
|
||||||
case ACTION_START:
|
case ACTION_START:
|
||||||
@@ -501,7 +505,10 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
carList().addTo(propList);
|
carList().addTo(propList);
|
||||||
|
|
||||||
if (isSet(currentBlock)) currentBlock.button(currentBlock.toString()).addTo(new Tag("li").content(t("Current location:")+NBSP)).addTo(propList);
|
if (isSet(currentBlock)) currentBlock.button(currentBlock.toString()).addTo(new Tag("li").content(t("Current location:")+NBSP)).addTo(propList);
|
||||||
if (isSet(direction)) new Tag("li").content(t("Direction: heading {}",direction)).addTo(propList);
|
Tag directionLi = null;
|
||||||
|
if (isSet(direction)) directionLi = new Tag("li").content(t("Direction: heading {}",direction)+NBSP);
|
||||||
|
if (isNull(directionLi)) directionLi = new Tag("li");
|
||||||
|
button(t("reverse"), Map.of(ACTION,ACTION_REVERSE)).title(t("Turns the train, as if it went through a loop.")).addTo(directionLi).addTo(propList);
|
||||||
|
|
||||||
Tag dest = new Tag("li").content(t("Destination:")+NBSP);
|
Tag dest = new Tag("li").content(t("Destination:")+NBSP);
|
||||||
if (isNull(destination)) {
|
if (isNull(destination)) {
|
||||||
@@ -584,6 +591,22 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This turns the train as if it went through a loop. Example:
|
||||||
|
* before: CabCar→ MiddleCar→ Loco→
|
||||||
|
* after: ←Loco ←MiddleCar ←CabCar
|
||||||
|
*/
|
||||||
|
private Tag reverse() {
|
||||||
|
LOG.debug("train.reverse();");
|
||||||
|
|
||||||
|
if (isSet(direction)) {
|
||||||
|
direction = direction.inverse();
|
||||||
|
reverseTrace();
|
||||||
|
}
|
||||||
|
if (isSet(currentBlock)) plan.place(currentBlock);
|
||||||
|
return properties();
|
||||||
|
}
|
||||||
|
|
||||||
private void reverseTrace() {
|
private void reverseTrace() {
|
||||||
LinkedList<Tile> reversed = new LinkedList<Tile>();
|
LinkedList<Tile> reversed = new LinkedList<Tile>();
|
||||||
LOG.debug("Trace: {}",trace);
|
LOG.debug("Trace: {}",trace);
|
||||||
@@ -808,17 +831,17 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
return name();
|
return name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this inverts the direction the train is heading to. Example:
|
||||||
|
* before: CabCar→ MiddleCar→ Loco→
|
||||||
|
* after: ←CabCar ←MiddleCar ←Loco
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Tag turn() {
|
public Tag turn() {
|
||||||
LOG.debug("train.turn()");
|
LOG.debug("train.turn()");
|
||||||
|
|
||||||
for (Car car : cars) car.turn();
|
for (Car car : cars) car.turn();
|
||||||
Collections.reverse(cars);
|
Collections.reverse(cars);
|
||||||
if (isSet(direction)) {
|
return reverse();
|
||||||
direction = direction.inverse();
|
|
||||||
reverseTrace();
|
|
||||||
}
|
|
||||||
if (isSet(currentBlock)) plan.place(currentBlock);
|
|
||||||
return properties();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Train update(HashMap<String, String> params) {
|
protected Train update(HashMap<String, String> params) {
|
||||||
|
|||||||
Reference in New Issue
Block a user