This commit is contained in:
Stephan Richter
2020-11-12 12:40:43 +01:00
parent d372b9333f
commit d12ddf66ad
4 changed files with 32 additions and 14 deletions

View File

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.srsoftware</groupId>
<artifactId>web4rail</artifactId>
<version>0.11.7</version>
<version>0.11.8</version>
<name>Web4Rail</name>
<packaging>jar</packaging>
<description>Java Model Railway Control</description>

View File

@@ -83,6 +83,7 @@ Properties of {} : Eigenschaften von {}
Properties of {} @ ({},{}) : Eigenschaften von {} @ ({},{})
PushPullTrain : Wendezug
Push-pull train : Wendezug
quit autopilot : Autopilot beenden
{} reached it`s destination! : {} ist am Ziel angekommen!
Reduce speed to {} km/h : Geschwindigkeit auf {} km/h reduzieren
Report Issue : Problem melden

View File

@@ -245,6 +245,10 @@ public class Train extends BaseClass implements Comparable<Train> {
return train;
}
public Block currentBlock() {
return currentBlock;
}
public Block destination() {
return destination;
}
@@ -468,8 +472,13 @@ public class Train extends BaseClass implements Comparable<Train> {
if (isSet(currentBlock)) {
link("li",Map.of(REALM,REALM_PLAN,ID,currentBlock.id(),ACTION,ACTION_CLICK),t("Current location: {}",currentBlock)).addTo(propList);
Tag actions = new Tag("li").clazz().content(t("Actions:")+NBSP);
props.put(ACTION, ACTION_START);
new Button(t("start"),props).addTo(actions);
if (isSet(route)) {
props.put(ACTION, ACTION_STOP);
new Button(t("stop"),props).addTo(actions);
} else {
props.put(ACTION, ACTION_START);
new Button(t("start"),props).addTo(actions);
}
if (isNull(autopilot)) {
props.put(ACTION, ACTION_AUTO);
new Button(t("auto"),props).addTo(actions);
@@ -521,6 +530,10 @@ public class Train extends BaseClass implements Comparable<Train> {
} else return t("autopilot not active.");
}
public void removeFromTrace(Tile tile) {
trace.remove(tile);
}
private void reverseTrace() {
// TODO Auto-generated method stub
}
@@ -572,6 +585,10 @@ public class Train extends BaseClass implements Comparable<Train> {
this.speed = v;
}
public void setWaitTime(Range waitTime) {
if (autopilot != null) autopilot.waitTime = waitTime.random();
}
public void showTrace() {
int remainingLength = length();
if (remainingLength<1) remainingLength=1;
@@ -663,15 +680,7 @@ public class Train extends BaseClass implements Comparable<Train> {
return this;
}
public void removeFromTrace(Tile tile) {
trace.remove(tile);
}
public void setWaitTime(Range waitTime) {
if (autopilot != null) autopilot.waitTime = waitTime.random();
}
public Block currentBlock() {
return currentBlock;
public boolean usesAutopilot() {
return isSet(autopilot);
}
}

View File

@@ -223,6 +223,14 @@ public abstract class Tile extends BaseClass{
props.put(ACTION, ACTION_START);
window.children().insertElementAt(new Button(t("start"),props), 1);
}
if (train.usesAutopilot()) {
props.put(ACTION, ACTION_QUIT);
window.children().insertElementAt(new Button(t("quit autopilot"),props),2);
} else {
props.put(ACTION, ACTION_AUTO);
window.children().insertElementAt(new Button(t("auto"),props),2);
}
window.children().insertElementAt(train.link("span"), 1);
window.children().insertElementAt(new Tag("h4").content(t("Train:")), 1);
}