本文整理汇总了Java中com.lynden.gmapsfx.service.directions.DirectionsRenderer类的典型用法代码示例。如果您正苦于以下问题:Java DirectionsRenderer类的具体用法?Java DirectionsRenderer怎么用?Java DirectionsRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DirectionsRenderer类属于com.lynden.gmapsfx.service.directions包,在下文中一共展示了DirectionsRenderer类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRoutePane
import com.lynden.gmapsfx.service.directions.DirectionsRenderer; //导入依赖的package包/类
public void createRoutePane() {
routeVbox = addVBox("select route");
fromLocation = new ComboBox<String>();
fromLocation.setOnAction(λ -> map.hideDirectionsPane());
toLocation = new ComboBox<String>();
toLocation.setOnAction(λ -> map.hideDirectionsPane());
final Button btn = new Button("draw");
btn.setOnAction(e -> {
if (toLocation.getSelectionModel().getSelectedItem() == null
|| fromLocation.getSelectionModel().getSelectedItem() == null)
return;
final MyMarker to = getMarkerByTitle(toLocation.getSelectionModel().getSelectedItem()),
from = getMarkerByTitle(fromLocation.getSelectionModel().getSelectedItem());
directionsService.getRoute(
new DirectionsRequest(from.lat.getLatitude() + ", " + from.lat.getLongitude(),
to.lat.getLatitude() + ", " + to.lat.getLongitude(), TravelModes.DRIVING),
this, new DirectionsRenderer(true, mapComponent.getMap(), directionsPane));
});
final Button removeBtn = new Button("remove line");
removeBtn.setOnAction(λ -> map.hideDirectionsPane());
routeVbox.getChildren().addAll(fromLocation, toLocation, btn, removeBtn);
}
示例2: getCoordinatesCalculatePathShowDirectionsAndHidePanel
import com.lynden.gmapsfx.service.directions.DirectionsRenderer; //导入依赖的package包/类
private void getCoordinatesCalculatePathShowDirectionsAndHidePanel(final Pane path_choice_pane,
final TextField txt_from, final TextField txt_to,
final Button btn_get_coords_find_path) {
final String addressOrigin = txt_from.getText();
final String addressDestination = txt_to.getText();
final DirectionsRequest directionsRequest =
new DirectionsRequest(addressOrigin, addressDestination, TravelModes.DRIVING);
directionsPane = mapComponent.getDirec(); // TODO: 11/10/2017 IT HAS TO BE CLEARED!
directionsService = new DirectionsService();
directionsRenderer = new DirectionsRenderer(true, map, directionsPane);
directionsService.getRoute(directionsRequest, this, directionsRenderer);
if (!addressOrigin.equals("") || !addressDestination.equals("")) {
path_choice_pane.setVisible(false);
btn_get_coords_find_path.setVisible(false);
}
}