本文整理匯總了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);
}
}