Browse Source

improved programming card + bugfixes

lookup-tables
Stephan Richter 4 years ago
parent
commit
321907f4ce
  1. 2
      pom.xml
  2. 1
      resources/translations/Application.de.translation
  3. 16
      src/main/java/de/srsoftware/web4rail/BaseClass.java
  4. 1
      src/main/java/de/srsoftware/web4rail/Plan.java
  5. 18
      src/main/java/de/srsoftware/web4rail/moving/Locomotive.java

2
pom.xml

@ -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.4.25</version> <version>1.4.26</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>

1
resources/translations/Application.de.translation

@ -241,6 +241,7 @@ Not connected to other bridge part! : Nicht mit anderem Brücken-Teil verbunden!
Notes : Notizen Notes : Notizen
No tile moved. : keine Kachel verschoben. No tile moved. : keine Kachel verschoben.
{} not within last {} blocks of train : {} ist nicht in den letzten {} Blöcken des Zugs {} not within last {} blocks of train : {} ist nicht in den letzten {} Blöcken des Zugs
no value : kein Wert
{} now heading for {} : {} ist nun unterwegs nach {} {} now heading for {} : {} ist nun unterwegs nach {}
{} now in auto-mode : {} ist nun im Automatikmodus {} now in auto-mode : {} ist nun im Automatikmodus
Occupied area : Belegte Abschnitte Occupied area : Belegte Abschnitte

16
src/main/java/de/srsoftware/web4rail/BaseClass.java

@ -86,7 +86,7 @@ public abstract class BaseClass implements Constants{
} }
public Context block(Block newBlock) { public Context block(Block newBlock) {
LOG.debug("{}.block({})",this,newBlock); //LOG.debug("{}.block({})",this,newBlock);
block = newBlock; block = newBlock;
return this; return this;
} }
@ -143,7 +143,7 @@ public abstract class BaseClass implements Constants{
} }
public Context direction(Direction newDirection) { public Context direction(Direction newDirection) {
LOG.debug("{}.direction({})",this,newDirection); //LOG.debug("{}.direction({})",this,newDirection);
direction = newDirection; direction = newDirection;
return this; return this;
} }
@ -164,7 +164,7 @@ public abstract class BaseClass implements Constants{
public Context setMain(BaseClass object) { public Context setMain(BaseClass object) {
main = object; main = object;
LOG.debug("{}.setMain({})",this,object); //LOG.debug("{}.setMain({})",this,object);
if (main instanceof Tile) this.tile = (Tile) main; if (main instanceof Tile) this.tile = (Tile) main;
if (main instanceof Contact) this.contact = (Contact) main; if (main instanceof Contact) this.contact = (Contact) main;
if (main instanceof Block) this.block = (Block) main; if (main instanceof Block) this.block = (Block) main;
@ -209,7 +209,7 @@ public abstract class BaseClass implements Constants{
} }
public Context train(Train newTrain) { public Context train(Train newTrain) {
LOG.debug("{}.train({})",this,newTrain); //LOG.debug("{}.train({})",this,newTrain);
train = newTrain; train = newTrain;
return this; return this;
} }
@ -331,18 +331,20 @@ public abstract class BaseClass implements Constants{
public static String distance(long l) { public static String distance(long l) {
String unit = Plan.lengthUnit; String unit = Plan.lengthUnit;
if (DEFAULT_LENGTH_UNIT.equals(unit)) { if (DEFAULT_LENGTH_UNIT.equals(unit)) {
double d = l;
if (l > 1_000_000) { if (l > 1_000_000) {
l/=1_000_000; d = l/1_000_000d;
unit = t("km"); unit = t("km");
} else } else
if (l > 1_000) { if (l > 1_000) {
l/=1_000; d = l/1_000;
unit = t("m"); unit = t("m");
} else } else
if (l > 10) { if (l > 10) {
l/=10; d = l/10;
unit = t("cm"); unit = t("cm");
} }
return String.format("%.3f", d)+NBSP+unit;
} }
return l+NBSP+unit; return l+NBSP+unit;
} }

1
src/main/java/de/srsoftware/web4rail/Plan.java

@ -214,6 +214,7 @@ public class Plan extends BaseClass{
case ACTION_FREE: case ACTION_FREE:
Tile t = get(Id.from(params), false); Tile t = get(Id.from(params), false);
t.free(t.lockingTrain()); t.free(t.lockingTrain());
plan.alter();
return t.properties(); return t.properties();
case ACTION_MOVE: case ACTION_MOVE:
return moveTile(params.get(DIRECTION),Id.from(params)); return moveTile(params.get(DIRECTION),Id.from(params));

18
src/main/java/de/srsoftware/web4rail/moving/Locomotive.java

@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
@ -334,8 +335,17 @@ public class Locomotive extends Car implements Constants,Device{
Table table = new Table(); Table table = new Table();
table.addHead(t("setting"),t("CV"),t("value"),t("actions")); table.addHead(t("setting"),t("CV"),t("value"),t("actions"));
for (Entry<Integer, Integer> entry : cvs.entrySet()){ for (int cv=1; cv<19; cv++) {
Object val = cvs.get(cv);
if (isNull(val)) {
if (Set.of(7, 8, 10, 11, 12, 13, 14, 15, 16).contains(cv)) continue;
val = t("no value");
}
table.addRow(setting(cv),cv,val,new Button(t("edit"), "copyCv(this);"));
}
for (Entry<Integer, Integer> entry : cvs.entrySet()){
int cv = entry.getKey(); int cv = entry.getKey();
if (cv<10) continue;
int val = entry.getValue(); int val = entry.getValue();
table.addRow(setting(cv),cv,val,new Button(t("edit"), "copyCv(this);")); table.addRow(setting(cv),cv,val,new Button(t("edit"), "copyCv(this);"));
} }
@ -429,7 +439,7 @@ public class Locomotive extends Car implements Constants,Device{
return t("maximum speed v<sub>max</sub>"); return t("maximum speed v<sub>max</sub>");
case 6: case 6:
return t("mid speed v<sub>mid</sub>"); return t("mid speed v<sub>mid</sub>");
case 8: case 9:
return t("PWM rate"); return t("PWM rate");
case 17: case 17:
case 18: case 18:
@ -459,10 +469,10 @@ public class Locomotive extends Car implements Constants,Device{
} }
public Object turn() { public Object turn() {
stop(); setSpeed(0);
super.turn(); super.turn();
plan.stream(t("Stopped and reversed {}.",this)); plan.stream(t("Stopped and reversed {}.",this));
return properties(); return stop();
} }
@Override @Override

Loading…
Cancel
Save