Skip to content

Commit f66d4f9

Browse files
committed
Minor functional improvements....
1 parent 35c31aa commit f66d4f9

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

aimax-osm/src/main/java/aimax/osm/gui/fx/applications/OsmRouteFindingAgentApp.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ public void initialize() {
136136
break;
137137
}
138138

139-
140139
switch (simPaneCtrl.getParamValueIndex(PARAM_HEURISTIC)) {
141140
case 0:
142141
heuristic = new H1();
@@ -188,6 +187,7 @@ protected boolean initAgents() {
188187
/** Starts the experiment. */
189188
public void simulate() {
190189
if (initAgents()) {
190+
env.notifyViews("Using " + simPaneCtrl.getParamValue(PARAM_SEARCH));
191191
while (!env.isDone() && !CancelableThread.currIsCanceled()) {
192192
env.step();
193193
simPaneCtrl.waitAfterStep();
@@ -203,7 +203,15 @@ public void finalize() {
203203
}
204204

205205

206-
206+
private void updateTrack(Agent agent) {
207+
MapAdapter map = (MapAdapter) env.getMap();
208+
MapNode node = map.getWayNode(env.getAgentLocation(agent));
209+
if (node != null) {
210+
int aIdx = env.getAgents().indexOf(agent);
211+
map.getOsmMap().addToTrack("Track" + aIdx,
212+
new Position(node.getLat(), node.getLon()));
213+
}
214+
}
207215

208216
// helper classes...
209217

@@ -248,17 +256,7 @@ public void agentAdded(Agent agent, Environment source) {}
248256
@Override
249257
public void agentActed(Agent agent, Action command, Environment source) {
250258
if (command instanceof MoveToAction) {
251-
Platform.runLater(() -> updateTrack(agent, env.getAgentLocation(agent)));
252-
}
253-
}
254-
255-
private void updateTrack(Agent agent, String location) {
256-
MapAdapter map = (MapAdapter) env.getMap();
257-
MapNode node = map.getWayNode(location);
258-
if (node != null) {
259-
int aIdx = env.getAgents().indexOf(agent);
260-
map.getOsmMap().addToTrack("Track" + aIdx,
261-
new Position(node.getLat(), node.getLon()));
259+
Platform.runLater(() -> updateTrack(agent));
262260
}
263261
}
264262
}

0 commit comments

Comments
 (0)