use of aimax.osm.gui.fx.viewer.MapPaneCtrl in project aima-java by aimacode.
the class OsmRoutePlannerApp method createRootPane.
/**
* Simple pane to control the game.
*/
@Override
public Pane createRootPane() {
routeCalculator = createRouteCalculator();
BorderPane root = new BorderPane();
ToolBar toolBar = new ToolBar();
clearBtn = new Button("Clear");
clearBtn.setOnAction(ev -> initialize());
taskCombo = new ComboBox<>();
taskCombo.getItems().addAll(routeCalculator.getTaskSelectionOptions());
taskCombo.getSelectionModel().select(0);
calcBtn = new Button("Calculate Route");
calcBtn.setOnAction(ev -> calculateRoute());
toolBar.getItems().addAll(clearBtn, new Separator(), taskCombo, calcBtn);
root.setTop(toolBar);
StackPane mapPane = new StackPane();
mapPaneCtrl = new MapPaneCtrl(mapPane);
mapPaneCtrl.getMap().addMapDataEventListener(ev -> updateEnabledState());
mapPaneCtrl.loadMap(DataResource.getULMFileResource());
root.setCenter(mapPane);
statusLabel = new Label();
statusLabel.setMaxWidth(Double.MAX_VALUE);
statusLabel.setMaxWidth(Double.MAX_VALUE);
statusLabel.setAlignment(Pos.CENTER);
statusLabel.setFont(Font.font(16));
root.setBottom(statusLabel);
return root;
}
use of aimax.osm.gui.fx.viewer.MapPaneCtrl in project aima-java by aimacode.
the class OsmLRTAStarAgentApp method createRootPane.
/**
* Defines state view, parameters, and call-back functions and calls the
* simulation pane builder to create layout and controller objects.
*/
@Override
public Pane createRootPane() {
BorderPane root = new BorderPane();
List<Parameter> params = createParameters();
StackPane mapPane = new StackPane();
mapPaneCtrl = new MapPaneCtrl(mapPane);
loadMap();
SimulationPaneBuilder builder = new SimulationPaneBuilder();
builder.defineParameters(params);
builder.defineStateView(mapPane);
builder.defineInitMethod(this::initialize);
builder.defineSimMethod(this::simulate);
simPaneCtrl = builder.getResultFor(root);
simPaneCtrl.setParam(SimulationPaneCtrl.PARAM_SIM_SPEED, 0);
return root;
}
use of aimax.osm.gui.fx.viewer.MapPaneCtrl in project aima-java by aimacode.
the class OsmAgentBaseApp method createRootPane.
/**
* Defines state view, parameters, and call-back functions and calls the
* simulation pane builder to create layout and controller objects.
*/
@Override
public Pane createRootPane() {
BorderPane root = new BorderPane();
List<Parameter> params = createParameters();
StackPane mapPane = new StackPane();
mapPaneCtrl = new MapPaneCtrl(mapPane);
loadMap();
StackPane envView = new StackPane();
envViewCtrl = new SimpleEnvironmentViewCtrl(envView, mapPane, 0.75);
SimulationPaneBuilder builder = new SimulationPaneBuilder();
builder.defineParameters(params);
builder.defineStateView(envView);
builder.defineInitMethod(this::initialize);
builder.defineSimMethod(this::simulate);
simPaneCtrl = builder.getResultFor(root);
simPaneCtrl.setParam(SimulationPaneCtrl.PARAM_SIM_SPEED, 0);
return root;
}
use of aimax.osm.gui.fx.viewer.MapPaneCtrl in project aima-java by aimacode.
the class OsmViewerApp method start.
@Override
public void start(Stage primaryStage) throws Exception {
// indicates progress when reading large maps (for testing only)
// Logger.getLogger("aimax.osm").setLevel(Level.FINEST);
// Logger.getLogger("").getHandlers()[0].setLevel(Level.FINE);
Locale.setDefault(Locale.US);
StackPane mapPane = new StackPane();
MapPaneCtrl mapPaneCtrl = new MapPaneCtrl(mapPane);
mapPaneCtrl.loadMap(DataResource.getULMFileResource());
BorderPane root = new BorderPane();
root.setCenter(mapPane);
Scene scene = new Scene(root, 800, 600);
primaryStage.setTitle("Osm Viewer App");
primaryStage.setScene(scene);
primaryStage.show();
}
Aggregations