fine-tuning of route planing implementation
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.srsoftware</groupId>
|
||||
<artifactId>web4rail</artifactId>
|
||||
<version>0.11.5</version>
|
||||
<version>0.11.6</version>
|
||||
<name>Web4Rail</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Java Model Railway Control</description>
|
||||
|
||||
@@ -27,11 +27,14 @@ click here to setup contact : Hier klicken, um Kontakt auszuwählen
|
||||
click here to setup relay : Hier klicken, um Relais einzurichten
|
||||
Command to send to control unit\: : Kommando, welches zur Zentrale gesendet werden soll:
|
||||
Create action : Aktion erzeugen
|
||||
Current location\: {} : Aufenthaltsort: {}
|
||||
DelayedAction : verzögerte Aktion
|
||||
delete : entfernen
|
||||
delete route : Route löschen
|
||||
Destination\: : Ziel:
|
||||
Destination\: {} from {} : Ziel: {} von {}
|
||||
Direction : Richtung
|
||||
Direction\: heading {} : Richtung: nach {}
|
||||
disabled : deaktiviert
|
||||
EAST : Osten
|
||||
editable train properties : veränderliche Zug-Eigenschaften
|
||||
@@ -64,6 +67,7 @@ new train : neuer Zug
|
||||
No : keine
|
||||
No free routes from {} : keine Route von {} frei
|
||||
NORTH : Norden
|
||||
Occupied area\: : Belegte Abschnitte:
|
||||
Off : Aus
|
||||
On : An
|
||||
One way\: : Richtung:
|
||||
@@ -77,6 +81,7 @@ Properties of {} : Eigenschaften von {}
|
||||
Properties of {} @ ({},{}) : Eigenschaften von {} @ ({},{})
|
||||
PushPullTrain : Wendezug
|
||||
Push-pull train : Wendezug
|
||||
{} reached it`s destination! : {} ist am Ziel angekommen!
|
||||
Reduce speed to {} km/h : Geschwindigkeit auf {} km/h reduzieren
|
||||
Report Issue : Problem melden
|
||||
RIGHT : rechts
|
||||
@@ -85,6 +90,7 @@ Routes using this tile\: : Fahrstraßen, die diesen Abschnitt verwenden:
|
||||
Route will only be available to trains fulfilling all conditions. : Route ist nur für Züge verfügbar, die alle Bedingungen erfüllen.
|
||||
Save : speichern
|
||||
Select contact\: : Kotakt auswählen:
|
||||
Select from plan : Auf Plan auswählen
|
||||
Select relay\: : Relais auswählen:
|
||||
SendCommand : Kommando senden
|
||||
Send command \"{}\" to control unit : Kommando „{}“ an Zentrale senden
|
||||
|
||||
@@ -365,7 +365,12 @@ public class Route extends BaseClass{
|
||||
}
|
||||
if (isSet(train)) {
|
||||
train.set(endBlock);
|
||||
train.setWaitTime(endBlock.getWaitTime(train));
|
||||
if (endBlock == train.destination()) {
|
||||
train.destination(null).quitAutopilot();
|
||||
endBlock.plan().stream(t("{} reached it`s destination!",train));
|
||||
} else {
|
||||
train.setWaitTime(endBlock.getWaitTime(train));
|
||||
}
|
||||
train.heading(endDirection.inverse());
|
||||
if (train.route == this) train.route = null;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
if (waitTime > 100) waitTime /=2;
|
||||
if (stop) return;
|
||||
Train.this.start();
|
||||
if (isSet(destination)) Thread.sleep(1000); // limit load on PathFinder
|
||||
}
|
||||
Thread.sleep(250);
|
||||
}
|
||||
@@ -172,25 +173,6 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
showTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Train o) {
|
||||
return name().compareTo(o.toString());
|
||||
}
|
||||
|
||||
public String directedName() {
|
||||
String result = name();
|
||||
if (isNull(direction)) return result;
|
||||
switch (direction) {
|
||||
case NORTH:
|
||||
case WEST:
|
||||
return '←'+result;
|
||||
case SOUTH:
|
||||
case EAST:
|
||||
return result+'→';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Object addCar(HashMap<String, String> params) {
|
||||
LOG.debug("addCar({})",params);
|
||||
if (!params.containsKey(CAR_ID)) return t("No car id passed to Train.addCar!");
|
||||
@@ -250,6 +232,11 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
return new Vector<Car>(cars);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Train o) {
|
||||
return name().compareTo(o.toString());
|
||||
}
|
||||
|
||||
private static Object create(HashMap<String, String> params, Plan plan) {
|
||||
Locomotive loco = (Locomotive) Locomotive.get(params.get(Train.LOCO_ID));
|
||||
if (isNull(loco)) return t("unknown locomotive: {}",params.get(ID));
|
||||
@@ -258,6 +245,29 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
return train;
|
||||
}
|
||||
|
||||
public Block destination() {
|
||||
return destination;
|
||||
}
|
||||
|
||||
public Train destination(Block dest) {
|
||||
destination = dest;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String directedName() {
|
||||
String result = name();
|
||||
if (isNull(direction)) return result;
|
||||
switch (direction) {
|
||||
case NORTH:
|
||||
case WEST:
|
||||
return '←'+result;
|
||||
case SOUTH:
|
||||
case EAST:
|
||||
return result+'→';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Direction direction() {
|
||||
return direction;
|
||||
}
|
||||
@@ -454,22 +464,6 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
|
||||
locoList().addTo(propList);
|
||||
carList().addTo(propList);
|
||||
new Tag("li").content(t("length: {}",length())).addTo(propList);
|
||||
|
||||
if (!trace.isEmpty()) {
|
||||
Tag li = new Tag("li").content(t("Occupied area:"));
|
||||
Tag ul = new Tag("ul");
|
||||
for (Tile tile : trace) new Tag("li").content(tile.toString()).addTo(ul);
|
||||
ul.addTo(li).addTo(propList);
|
||||
}
|
||||
|
||||
Tag dest = new Tag("li").content(t("Destination: "));
|
||||
if (isNull(destination)) {
|
||||
new Button(t("Select from plan"),"return selectDest("+id+");").addTo(dest);
|
||||
} else {
|
||||
link("span",Map.of(REALM,REALM_PLAN,ID,destination.id(),ACTION,ACTION_CLICK),destination.toString()).addTo(dest);
|
||||
}
|
||||
dest.addTo(propList);
|
||||
|
||||
if (isSet(currentBlock)) {
|
||||
link("li",Map.of(REALM,REALM_PLAN,ID,currentBlock.id(),ACTION,ACTION_CLICK),t("Current location: {}",currentBlock)).addTo(propList);
|
||||
@@ -486,14 +480,33 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
actions.addTo(propList);
|
||||
}
|
||||
|
||||
Tag dest = new Tag("li").content(t("Destination:")+NBSP);
|
||||
if (isNull(destination)) {
|
||||
new Button(t("Select from plan"),"return selectDest("+id+");").addTo(dest);
|
||||
} else {
|
||||
link("span",Map.of(REALM,REALM_PLAN,ID,destination.id(),ACTION,ACTION_CLICK),destination.toString()).addTo(dest);
|
||||
}
|
||||
|
||||
dest.addTo(propList);
|
||||
if (isSet(route)) {
|
||||
link("li", Map.of(REALM,REALM_ROUTE,ID,route.id(),ACTION,ACTION_PROPS), route).addTo(propList);
|
||||
}
|
||||
if (isSet(direction)) new Tag("li").content(t("Direction: heading {}",direction)).addTo(propList);
|
||||
|
||||
Tag tagList = new Tag("ul");
|
||||
for (String tag : tags()) new Tag("li").content(tag).addTo(tagList);
|
||||
tagList.addTo(new Tag("li").content(t("Tags"))).addTo(propList);
|
||||
SortedSet<String> allTags = tags();
|
||||
if (!allTags.isEmpty()) {
|
||||
Tag tagList = new Tag("ul");
|
||||
for (String tag : allTags) new Tag("li").content(tag).addTo(tagList);
|
||||
tagList.addTo(new Tag("li").content(t("Tags"))).addTo(propList);
|
||||
}
|
||||
new Tag("li").content(t("length: {}",length())).addTo(propList);
|
||||
|
||||
if (!trace.isEmpty()) {
|
||||
Tag li = new Tag("li").content(t("Occupied area:"));
|
||||
Tag ul = new Tag("ul");
|
||||
for (Tile tile : trace) new Tag("li").content(tile.toString()).addTo(ul);
|
||||
ul.addTo(li).addTo(propList);
|
||||
}
|
||||
|
||||
propList.addTo(fieldset).addTo(window);
|
||||
return window;
|
||||
@@ -656,8 +669,4 @@ public class Train extends BaseClass implements Comparable<Train> {
|
||||
public Block currentBlock() {
|
||||
return currentBlock;
|
||||
}
|
||||
|
||||
public Block destination() {
|
||||
return destination;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user