This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FXML | |
public void addressTextFieldAction(ActionEvent event) { | |
geocodingService.geocode(address.get(), (GeocodingResult[] results, GeocoderStatus status) -> { | |
LatLong latLong = null; | |
if( status == GeocoderStatus.ZERO_RESULTS) { | |
Alert alert = new Alert(Alert.AlertType.ERROR, "No matching address found"); | |
alert.show(); | |
return; | |
} else if( results.length > 1 ) { | |
Alert alert = new Alert(Alert.AlertType.WARNING, "Multiple results found, showing the first one."); | |
alert.show(); | |
latLong = new LatLong(results[0].getGeometry().getLocation().getLatitude(), results[0].getGeometry().getLocation().getLongitude()); | |
} else { | |
latLong = new LatLong(results[0].getGeometry().getLocation().getLatitude(), results[0].getGeometry().getLocation().getLongitude()); | |
} | |
map.setCenter(latLong); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment