Search in sources :

Example 1 with MapPaneCtrl

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;
}
Also used : BorderPane(javafx.scene.layout.BorderPane) MapPaneCtrl(aimax.osm.gui.fx.viewer.MapPaneCtrl) StackPane(javafx.scene.layout.StackPane)

Example 2 with MapPaneCtrl

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;
}
Also used : BorderPane(javafx.scene.layout.BorderPane) MapPaneCtrl(aimax.osm.gui.fx.viewer.MapPaneCtrl) SimulationPaneBuilder(aima.gui.fx.framework.SimulationPaneBuilder) Parameter(aima.gui.fx.framework.Parameter) StackPane(javafx.scene.layout.StackPane)

Example 3 with MapPaneCtrl

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;
}
Also used : BorderPane(javafx.scene.layout.BorderPane) MapPaneCtrl(aimax.osm.gui.fx.viewer.MapPaneCtrl) SimulationPaneBuilder(aima.gui.fx.framework.SimulationPaneBuilder) Parameter(aima.gui.fx.framework.Parameter) StackPane(javafx.scene.layout.StackPane) SimpleEnvironmentViewCtrl(aima.gui.fx.views.SimpleEnvironmentViewCtrl)

Example 4 with MapPaneCtrl

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();
}
Also used : MapPaneCtrl(aimax.osm.gui.fx.viewer.MapPaneCtrl) BorderPane(javafx.scene.layout.BorderPane) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Aggregations

MapPaneCtrl (aimax.osm.gui.fx.viewer.MapPaneCtrl)4 BorderPane (javafx.scene.layout.BorderPane)4 StackPane (javafx.scene.layout.StackPane)4 Parameter (aima.gui.fx.framework.Parameter)2 SimulationPaneBuilder (aima.gui.fx.framework.SimulationPaneBuilder)2 SimpleEnvironmentViewCtrl (aima.gui.fx.views.SimpleEnvironmentViewCtrl)1 Scene (javafx.scene.Scene)1