Interface MapConversionFunctions
- All Superinterfaces:
ExecutableFunctions,Identifiable
- All Known Implementing Classes:
LeafletMap
Map Conversion Methods
- Since:
- 2020-03-16
- Version:
- 1.1
- Author:
- Gabor Kokeny Email: kokeny19@gmail.com
-
Method Summary
Modifier and TypeMethodDescriptiondefault CompletableFuture<LatLng> containerPointToLatLng(Point point) Given a pixel coordinate relative to the map container, returns the corresponding geographical coordinate (for the current zoom level).default CompletableFuture<Point> containerPointToLayerPoint(Point point) Given a pixel coordinate relative to the map container, returns the corresponding pixel coordinate relative to the origin pixel.default CompletableFuture<Double> Returns the distance between two geographical coordinates according to the map's CRS.default CompletableFuture<Point> latLngToContainerPoint(LatLng latLng) Given a geographical coordinate, returns the corresponding pixel coordinate relative to the map container.default CompletableFuture<Point> latLngToLayerPoint(LatLng latLng) Given a geographical coordinate, returns the corresponding pixel coordinate relative to the origin pixel.default CompletableFuture<Point> layerPointToContainerPoint(Point point) Given a pixel coordinate relative to the origin pixel, returns the corresponding pixel coordinate relative to the map container.default CompletableFuture<LatLng> layerPointToLatLng(Point point) Given a pixel coordinate relative to the origin pixel, returns the corresponding geographical coordinate (for the current zoom level).default CompletableFuture<Point> mouseEventToContainerPoint(MouseEvent mouseEvent) Given a MouseEvent object, returns the pixel coordinate relative to the map container where the event took place.default CompletableFuture<LatLng> mouseEventToLatLng(MouseEvent mouseEvent) Given a MouseEvent object, returns geographical coordinate where the event took place.default CompletableFuture<Point> mouseEventToLayerPoint(MouseEvent mouseEvent) Given a MouseEvent object, returns the pixel coordinate relative to the origin pixel where the event took place.default CompletableFuture<Point> Projects a geographical coordinate LatLng according to the projection of the map's CRS, then scales it according to zoom and the CRS's Transformation.default CompletableFuture<LatLng> Inverse of project.default CompletableFuture<LatLng> wrapLatLng(LatLng latLng) Returns a LatLng where lat and lng has been wrapped according to the map's CRS's wrapLat and wrapLng properties, if they are outside the CRS's bounds.default CompletableFuture<LatLngBounds> wrapLatLngBounds(LatLngBounds bounds) Returns a LatLngBounds with the same size as the given one, ensuring that its center is within the CRS's bounds.Methods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.map.functions.ExecutableFunctions
call, call, executeJs, executeJsMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.Identifiable
getUuid
-
Method Details
-
project
Projects a geographical coordinate LatLng according to the projection of the map's CRS, then scales it according to zoom and the CRS's Transformation. The result is pixel coordinate relative to the CRS origin.- Parameters:
latLng- the coordinate to be projectedzoom- the zoom level- Returns:
- the pixel coordinate relative to the CRS origin
-
unproject
Inverse of project.- Parameters:
point- the point to be unprojectedzoom- the zoom level- Returns:
- the geographical coordinate
-
layerPointToLatLng
Given a pixel coordinate relative to the origin pixel, returns the corresponding geographical coordinate (for the current zoom level).- Parameters:
point- a pixel coordinate relative to the origin pixel- Returns:
- the corresponding geographical coordinate
-
latLngToLayerPoint
Given a geographical coordinate, returns the corresponding pixel coordinate relative to the origin pixel.- Parameters:
latLng- a geographical coordinate- Returns:
- the corresponding pixel coordinate
-
wrapLatLng
Returns a LatLng where lat and lng has been wrapped according to the map's CRS's wrapLat and wrapLng properties, if they are outside the CRS's bounds. By default this means longitude is wrapped around the dateline so its value is between -180 and +180 degrees.- Parameters:
latLng- a geographical coordinate- Returns:
- the wrapped latlng
-
wrapLatLngBounds
Returns a LatLngBounds with the same size as the given one, ensuring that its center is within the CRS's bounds. By default this means the center longitude is wrapped around the dateline so its value is between -180 and +180 degrees, and the majority of the bounds overlaps the CRS's bounds.- Parameters:
bounds- a LatLngBounds to be wrapped- Returns:
- the wrapped LatLngBounds
- See Also:
-
distance
Returns the distance between two geographical coordinates according to the map's CRS. By default this measures distance in meters.- Parameters:
latLng1- the first geographical coordinatelatLng2- the second geographical coordinate- Returns:
- the distance between the given geographical coordinates
- See Also:
-
containerPointToLayerPoint
Given a pixel coordinate relative to the map container, returns the corresponding pixel coordinate relative to the origin pixel.- Parameters:
point- a pixel coordinate relative to the map container- Returns:
- the corresponding pixel coordinate relative to the origin pixel
- See Also:
-
layerPointToContainerPoint
Given a pixel coordinate relative to the origin pixel, returns the corresponding pixel coordinate relative to the map container.- Parameters:
point- a pixel coordinate relative to the origin pixel- Returns:
- the corresponding pixel coordinate relative to the map container
- See Also:
-
containerPointToLatLng
Given a pixel coordinate relative to the map container, returns the corresponding geographical coordinate (for the current zoom level).- Parameters:
point- a pixel coordinate relative to the map container- Returns:
- the corresponding geographical coordinate (for the current zoom level)
- See Also:
-
latLngToContainerPoint
Given a geographical coordinate, returns the corresponding pixel coordinate relative to the map container.- Parameters:
latLng- a geographical coordinate- Returns:
- the corresponding pixel coordinate relative to the map container
- See Also:
-
mouseEventToContainerPoint
Given a MouseEvent object, returns the pixel coordinate relative to the map container where the event took place.- Parameters:
mouseEvent- a MouseEvent object- Returns:
- the pixel coordinate relative to the map container where the event took place
- See Also:
-
mouseEventToLayerPoint
Given a MouseEvent object, returns the pixel coordinate relative to the origin pixel where the event took place.- Parameters:
mouseEvent- a MouseEvent object- Returns:
- the origin pixel where the event took place
- See Also:
-
mouseEventToLatLng
Given a MouseEvent object, returns geographical coordinate where the event took place.- Parameters:
mouseEvent- a MouseEvent object- Returns:
- the geographical coordinate where the event took place.
- See Also:
-