make more things const and refs, and add mutexes
This commit is contained in:
@@ -531,19 +531,19 @@ const std::string &Map::getAccessToken() const {
|
||||
|
||||
#pragma mark - Annotations
|
||||
|
||||
void Map::setDefaultPointAnnotationSymbol(std::string& symbol) {
|
||||
void Map::setDefaultPointAnnotationSymbol(const std::string& symbol) {
|
||||
assert(Environment::currentlyOn(ThreadType::Main));
|
||||
annotationManager->setDefaultPointAnnotationSymbol(symbol);
|
||||
}
|
||||
|
||||
uint32_t Map::addPointAnnotation(LatLng point, std::string& symbol) {
|
||||
uint32_t Map::addPointAnnotation(const LatLng& point, const std::string& symbol) {
|
||||
assert(Environment::currentlyOn(ThreadType::Main));
|
||||
std::vector<LatLng> points({ point });
|
||||
std::vector<std::string> symbols({ symbol });
|
||||
return addPointAnnotations(points, symbols)[0];
|
||||
}
|
||||
|
||||
std::vector<uint32_t> Map::addPointAnnotations(std::vector<LatLng> points, std::vector<std::string>& symbols) {
|
||||
std::vector<uint32_t> Map::addPointAnnotations(const std::vector<LatLng>& points, const std::vector<std::string>& symbols) {
|
||||
assert(Environment::currentlyOn(ThreadType::Main));
|
||||
auto result = annotationManager->addPointAnnotations(points, symbols, *this);
|
||||
updateAnnotationTiles(result.first);
|
||||
@@ -555,23 +555,24 @@ void Map::removeAnnotation(uint32_t annotation) {
|
||||
removeAnnotations({ annotation });
|
||||
}
|
||||
|
||||
void Map::removeAnnotations(std::vector<uint32_t> annotations) {
|
||||
void Map::removeAnnotations(const std::vector<uint32_t>& annotations) {
|
||||
assert(Environment::currentlyOn(ThreadType::Main));
|
||||
auto result = annotationManager->removeAnnotations(annotations);
|
||||
updateAnnotationTiles(result);
|
||||
}
|
||||
|
||||
std::vector<uint32_t> Map::getAnnotationsInBounds(LatLngBounds bounds) const {
|
||||
std::vector<uint32_t> Map::getAnnotationsInBounds(const LatLngBounds& bounds) const {
|
||||
assert(Environment::currentlyOn(ThreadType::Main));
|
||||
return annotationManager->getAnnotationsInBounds(bounds, *this);
|
||||
}
|
||||
|
||||
LatLngBounds Map::getBoundsForAnnotations(std::vector<uint32_t> annotations) const {
|
||||
LatLngBounds Map::getBoundsForAnnotations(const std::vector<uint32_t>& annotations) const {
|
||||
assert(Environment::currentlyOn(ThreadType::Main));
|
||||
return annotationManager->getBoundsForAnnotations(annotations);
|
||||
}
|
||||
|
||||
void Map::updateAnnotationTiles(std::vector<Tile::ID>& ids) {
|
||||
void Map::updateAnnotationTiles(const std::vector<Tile::ID>& ids) {
|
||||
assert(Environment::currentlyOn(ThreadType::Main));
|
||||
for (const auto &source : activeSources) {
|
||||
if (source->info.type == SourceType::Annotations) {
|
||||
source->source->invalidateTiles(*this, ids);
|
||||
|
||||
Reference in New Issue
Block a user