void DataManager::getAnnotations(AnnotationVector& out_annotations) const { out_annotations.reserve(_annotations.size()); Threading::ScopedReadLock lock(const_cast<DataManager*>(this)->_dataMutex); for(AnnotationVector::const_iterator it = _annotations.begin(); it != _annotations.end(); ++it) out_annotations.push_back(it->get()); }
void MapCatalogWidget::onTreeSelectionChanged() { if (_fields & ANNOTATIONS && !_updating && _manager.valid()) { AnnotationVector annos; QList<QTreeWidgetItem*> items = _tree->selectedItems(); for (QList<QTreeWidgetItem*>::iterator it = items.begin(); it != items.end(); ++it) { AnnotationTreeItem* annoItem = dynamic_cast<AnnotationTreeItem*>(*it); if (annoItem) annos.push_back(annoItem->getAnnotation()); } _manager->setSelectedAnnotations(annos); } }