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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>de.srsoftware</groupId>
|
<groupId>de.srsoftware</groupId>
|
||||||
<artifactId>web4rail</artifactId>
|
<artifactId>web4rail</artifactId>
|
||||||
<version>0.11.5</version>
|
<version>0.11.6</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>
|
||||||
|
|||||||
@@ -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
|
click here to setup relay : Hier klicken, um Relais einzurichten
|
||||||
Command to send to control unit\: : Kommando, welches zur Zentrale gesendet werden soll:
|
Command to send to control unit\: : Kommando, welches zur Zentrale gesendet werden soll:
|
||||||
Create action : Aktion erzeugen
|
Create action : Aktion erzeugen
|
||||||
|
Current location\: {} : Aufenthaltsort: {}
|
||||||
DelayedAction : verzögerte Aktion
|
DelayedAction : verzögerte Aktion
|
||||||
delete : entfernen
|
delete : entfernen
|
||||||
delete route : Route löschen
|
delete route : Route löschen
|
||||||
|
Destination\: : Ziel:
|
||||||
Destination\: {} from {} : Ziel: {} von {}
|
Destination\: {} from {} : Ziel: {} von {}
|
||||||
Direction : Richtung
|
Direction : Richtung
|
||||||
|
Direction\: heading {} : Richtung: nach {}
|
||||||
disabled : deaktiviert
|
disabled : deaktiviert
|
||||||
EAST : Osten
|
EAST : Osten
|
||||||
editable train properties : veränderliche Zug-Eigenschaften
|
editable train properties : veränderliche Zug-Eigenschaften
|
||||||
@@ -64,6 +67,7 @@ new train : neuer Zug
|
|||||||
No : keine
|
No : keine
|
||||||
No free routes from {} : keine Route von {} frei
|
No free routes from {} : keine Route von {} frei
|
||||||
NORTH : Norden
|
NORTH : Norden
|
||||||
|
Occupied area\: : Belegte Abschnitte:
|
||||||
Off : Aus
|
Off : Aus
|
||||||
On : An
|
On : An
|
||||||
One way\: : Richtung:
|
One way\: : Richtung:
|
||||||
@@ -77,6 +81,7 @@ Properties of {} : Eigenschaften von {}
|
|||||||
Properties of {} @ ({},{}) : Eigenschaften von {} @ ({},{})
|
Properties of {} @ ({},{}) : Eigenschaften von {} @ ({},{})
|
||||||
PushPullTrain : Wendezug
|
PushPullTrain : Wendezug
|
||||||
Push-pull train : Wendezug
|
Push-pull train : Wendezug
|
||||||
|
{} reached it`s destination! : {} ist am Ziel angekommen!
|
||||||
Reduce speed to {} km/h : Geschwindigkeit auf {} km/h reduzieren
|
Reduce speed to {} km/h : Geschwindigkeit auf {} km/h reduzieren
|
||||||
Report Issue : Problem melden
|
Report Issue : Problem melden
|
||||||
RIGHT : rechts
|
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.
|
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
|
Save : speichern
|
||||||
Select contact\: : Kotakt auswählen:
|
Select contact\: : Kotakt auswählen:
|
||||||
|
Select from plan : Auf Plan auswählen
|
||||||
Select relay\: : Relais auswählen:
|
Select relay\: : Relais auswählen:
|
||||||
SendCommand : Kommando senden
|
SendCommand : Kommando senden
|
||||||
Send command \"{}\" to control unit : Kommando „{}“ an Zentrale senden
|
Send command \"{}\" to control unit : Kommando „{}“ an Zentrale senden
|
||||||
|
|||||||
@@ -365,7 +365,12 @@ public class Route extends BaseClass{
|
|||||||
}
|
}
|
||||||
if (isSet(train)) {
|
if (isSet(train)) {
|
||||||
train.set(endBlock);
|
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());
|
train.heading(endDirection.inverse());
|
||||||
if (train.route == this) train.route = null;
|
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 (waitTime > 100) waitTime /=2;
|
||||||
if (stop) return;
|
if (stop) return;
|
||||||
Train.this.start();
|
Train.this.start();
|
||||||
|
if (isSet(destination)) Thread.sleep(1000); // limit load on PathFinder
|
||||||
}
|
}
|
||||||
Thread.sleep(250);
|
Thread.sleep(250);
|
||||||
}
|
}
|
||||||
@@ -171,25 +172,6 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
}
|
}
|
||||||
showTrace();
|
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) {
|
private Object addCar(HashMap<String, String> params) {
|
||||||
LOG.debug("addCar({})",params);
|
LOG.debug("addCar({})",params);
|
||||||
@@ -250,6 +232,11 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
return new Vector<Car>(cars);
|
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) {
|
private static Object create(HashMap<String, String> params, Plan plan) {
|
||||||
Locomotive loco = (Locomotive) Locomotive.get(params.get(Train.LOCO_ID));
|
Locomotive loco = (Locomotive) Locomotive.get(params.get(Train.LOCO_ID));
|
||||||
if (isNull(loco)) return t("unknown locomotive: {}",params.get(ID));
|
if (isNull(loco)) return t("unknown locomotive: {}",params.get(ID));
|
||||||
@@ -258,10 +245,33 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
return 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() {
|
public Direction direction() {
|
||||||
return direction;
|
return direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object dropCar(HashMap<String, String> params) {
|
private Object dropCar(HashMap<String, String> params) {
|
||||||
String carId = params.get(CAR_ID);
|
String carId = params.get(CAR_ID);
|
||||||
if (isSet(carId)) cars.remove(Car.get(carId));
|
if (isSet(carId)) cars.remove(Car.get(carId));
|
||||||
@@ -454,22 +464,6 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
|
|
||||||
locoList().addTo(propList);
|
locoList().addTo(propList);
|
||||||
carList().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)) {
|
if (isSet(currentBlock)) {
|
||||||
link("li",Map.of(REALM,REALM_PLAN,ID,currentBlock.id(),ACTION,ACTION_CLICK),t("Current location: {}",currentBlock)).addTo(propList);
|
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);
|
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)) {
|
if (isSet(route)) {
|
||||||
link("li", Map.of(REALM,REALM_ROUTE,ID,route.id(),ACTION,ACTION_PROPS), route).addTo(propList);
|
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);
|
if (isSet(direction)) new Tag("li").content(t("Direction: heading {}",direction)).addTo(propList);
|
||||||
|
|
||||||
Tag tagList = new Tag("ul");
|
SortedSet<String> allTags = tags();
|
||||||
for (String tag : tags()) new Tag("li").content(tag).addTo(tagList);
|
if (!allTags.isEmpty()) {
|
||||||
tagList.addTo(new Tag("li").content(t("Tags"))).addTo(propList);
|
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);
|
propList.addTo(fieldset).addTo(window);
|
||||||
return window;
|
return window;
|
||||||
@@ -656,8 +669,4 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
public Block currentBlock() {
|
public Block currentBlock() {
|
||||||
return currentBlock;
|
return currentBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block destination() {
|
|
||||||
return destination;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user