[core] Add batch conversion of latLngs to/from screenCoords (#15891)
* [core] Add batch conversion of latLng vs screenCoord * [core] Take the simple approach
This commit is contained in:
@@ -364,6 +364,24 @@ LatLng Map::latLngForPixel(const ScreenCoordinate& pixel) const {
|
||||
return impl->transform.screenCoordinateToLatLng(pixel);
|
||||
}
|
||||
|
||||
std::vector<ScreenCoordinate> Map::pixelsForLatLngs(const std::vector<LatLng>& latLngs) const {
|
||||
std::vector<ScreenCoordinate> ret;
|
||||
ret.reserve(latLngs.size());
|
||||
for (const auto& latLng : latLngs) {
|
||||
ret.emplace_back(pixelForLatLng(latLng));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<LatLng> Map::latLngsForPixels(const std::vector<ScreenCoordinate>& screenCoords) const {
|
||||
std::vector<LatLng> ret;
|
||||
ret.reserve(screenCoords.size());
|
||||
for (const auto& point : screenCoords) {
|
||||
ret.emplace_back(latLngForPixel(point));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#pragma mark - Annotations
|
||||
|
||||
void Map::addAnnotationImage(std::unique_ptr<style::Image> image) {
|
||||
|
||||
Reference in New Issue
Block a user