Created
July 29, 2016 22:56
-
-
Save rterp/c2a7c9fb047f3c48082d992deaba46a4 to your computer and use it in GitHub Desktop.
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