working on directed destinations
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>1.5.30</version>
|
<version>1.5.31</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>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</encoder>
|
</encoder>
|
||||||
<filter class="de.srsoftware.web4rail.ThreadFilter">
|
<filter class="de.srsoftware.web4rail.ThreadFilter">
|
||||||
<level>WARN</level>
|
<level>WARN</level>
|
||||||
<keywords>Brake, Contact, Feed, Route, e, u</keywords>
|
<keywords>BaseClass, ControlUnit, RoutePrepper, Tile</keywords>
|
||||||
</filter>
|
</filter>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ Cars : Fahrzeuge
|
|||||||
cars : Fahrzeugen teilen
|
cars : Fahrzeugen teilen
|
||||||
Clear destinations : Ziele löschen
|
Clear destinations : Ziele löschen
|
||||||
Clear destinations of train : Ziele des Zugs löschen
|
Clear destinations of train : Ziele des Zugs löschen
|
||||||
|
Clear trigger : Trigger löschen
|
||||||
Clicked tile is not a {}! : Angeklickte Kachel ist kein {}!
|
Clicked tile is not a {}! : Angeklickte Kachel ist kein {}!
|
||||||
Click here to add conditions : Hier klicken, um Bedingungen hinzuzufügen
|
Click here to add conditions : Hier klicken, um Bedingungen hinzuzufügen
|
||||||
Click here to select block! : Hier klicken, um Block auszuwählen!
|
Click here to select block! : Hier klicken, um Block auszuwählen!
|
||||||
|
|||||||
@@ -117,7 +117,10 @@ public class AddRemoveDestination extends Action {
|
|||||||
formInputs.add(t("Turn at destination"),new Checkbox(TURN, t("Turn"), destination.turn()));
|
formInputs.add(t("Turn at destination"),new Checkbox(TURN, t("Turn"), destination.turn()));
|
||||||
formInputs.add(t("Shunting"),new Checkbox(SHUNTING, t("Shunting"), destination.shunting()));
|
formInputs.add(t("Shunting"),new Checkbox(SHUNTING, t("Shunting"), destination.shunting()));
|
||||||
}
|
}
|
||||||
formInputs.add(t("Trigger Contact/Switch at destination")+": "+(isNull(destinationTrigger) ? t("unset") : destinationTrigger),button(t("Select from plan"),Map.of(ACTION,ACTION_UPDATE,ASSIGN,CONTACT)));
|
span = new Tag("span");
|
||||||
|
button(t("Select from plan"),Map.of(ACTION,ACTION_UPDATE,ASSIGN,CONTACT)).addTo(span);
|
||||||
|
button(t("Clear trigger"),Map.of(ACTION,ACTION_UPDATE,CONTACT,"0")).addTo(span);
|
||||||
|
formInputs.add(t("Trigger Contact/Switch at destination")+": "+(isNull(destinationTrigger) ? t("unset") : destinationTrigger),span);
|
||||||
return super.properties(preForm, formInputs, postForm,errors);
|
return super.properties(preForm, formInputs, postForm,errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,8 +149,14 @@ public class AddRemoveDestination extends Action {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (params.containsKey(CONTACT)) {
|
if (params.containsKey(CONTACT)) {
|
||||||
Tile tile = Tile.get(Id.from(params,CONTACT));
|
Id id = Id.from(params,CONTACT);
|
||||||
|
if (id.equals(0)) {
|
||||||
|
destinationTrigger = null;
|
||||||
|
return properties();
|
||||||
|
}
|
||||||
|
Tile tile = Tile.get(id);
|
||||||
if (tile instanceof Contact || tile instanceof Switch) destinationTrigger = tile;
|
if (tile instanceof Contact || tile instanceof Switch) destinationTrigger = tile;
|
||||||
|
return properties();
|
||||||
}
|
}
|
||||||
if (isSet(destination)) {
|
if (isSet(destination)) {
|
||||||
destination.turn("on".equals(params.getString(TURN)));
|
destination.turn("on".equals(params.getString(TURN)));
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
@@ -454,6 +455,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
Block endBlock = endedRoute.endBlock();
|
Block endBlock = endedRoute.endBlock();
|
||||||
Block startBlock = endedRoute.startBlock();
|
Block startBlock = endedRoute.startBlock();
|
||||||
boolean resetDest = endedRoute.endsAt(destination);
|
boolean resetDest = endedRoute.endsAt(destination);
|
||||||
|
LinkedList<Tile> triggerRef = new LinkedList<>();
|
||||||
if (resetDest){
|
if (resetDest){
|
||||||
destination = null;
|
destination = null;
|
||||||
|
|
||||||
@@ -467,17 +469,9 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isNull(destTag)) {
|
if (isNull(destTag)) {
|
||||||
Tile trigger = destinationTrigger; // quitAutopilot drops destinationTrigger
|
triggerRef.add(destinationTrigger); // quitAutopilot drops destinationTrigger
|
||||||
quitAutopilot();
|
quitAutopilot();
|
||||||
plan.stream(t("{} reached it`s destination!",this));
|
plan.stream(t("{} reached it`s destination!",this));
|
||||||
if (isSet(trigger)) new DelayedExecution(1000,this) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
if (trigger instanceof Contact) ((Contact)trigger).trigger(200);
|
|
||||||
if (trigger instanceof Switch) ((Switch)trigger).trigger(new Context(Train.this));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isSet(brake)) brake.updateTime();
|
if (isSet(brake)) brake.updateTime();
|
||||||
@@ -493,6 +487,16 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
trace.add(endBlock);
|
trace.add(endBlock);
|
||||||
if (!trace.contains(startBlock)) startBlock.dropTrain(this);
|
if (!trace.contains(startBlock)) startBlock.dropTrain(this);
|
||||||
stuckTrace = null;
|
stuckTrace = null;
|
||||||
|
if (!triggerRef.isEmpty()) new DelayedExecution(1000,this) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
Tile trigger = triggerRef.getFirst();
|
||||||
|
if (trigger instanceof Contact) ((Contact)trigger).trigger(200);
|
||||||
|
if (trigger instanceof Switch) ((Switch)trigger).trigger(new Context(Train.this));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (autopilot) {
|
if (autopilot) {
|
||||||
if (isNull(waitTime)) waitTime = 0;
|
if (isNull(waitTime)) waitTime = 0;
|
||||||
if (waitTime>0) plan.stream(t("{} waiting {} secs.",this,(int)(waitTime/1000)));
|
if (waitTime>0) plan.stream(t("{} waiting {} secs.",this,(int)(waitTime/1000)));
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public class BrakeProcess extends BaseClass implements Runnable{
|
|||||||
route.brakeTime(brakeId,newTimeStep);
|
route.brakeTime(brakeId,newTimeStep);
|
||||||
calculated = calcDistance(newTimeStep);
|
calculated = calcDistance(newTimeStep);
|
||||||
LOG.debug("Corrected brake timestep from {} to {} ms for {} @ {}.",timeStep,newTimeStep,train,route);
|
LOG.debug("Corrected brake timestep from {} to {} ms for {} @ {}.",timeStep,newTimeStep,train,route);
|
||||||
LOG.debug("Differemce from estimated distance: {} ({}%)",distance-calculated,100*(distance-calculated)/(float)distance);
|
LOG.debug("Difference from estimated distance: {} ({}%)",distance-calculated,100*(distance-calculated)/(float)distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user