void DataManager::setSelectedAnnotations(const AnnotationVector& annotations) { if (_selection.size() == 0 && annotations.size() == 0) return; clearSelectedAnnotations(); { Threading::ScopedWriteLock lock(const_cast<DataManager*>(this)->_dataMutex); for (AnnotationVector::const_iterator itNew = annotations.begin(); itNew != annotations.end(); ++itNew) { (*itNew)->setDecoration(_selectedDecoration); _selection.push_back(*itNew); } } emit selectionChanged(); }
void MapCatalogWidget::refreshAnnotations() { bool wasUpdating = _updating; _updating = true; if (_manager.valid() && (_fields & ANNOTATIONS)) { if (!_annotationsItem) { _annotationsItem = new QTreeWidgetItem(); //_annotationsItem->setIcon(0, QIcon(":/resources/images/globe.png")); _annotationsItem->setText(0, "Annotations"); _tree->addTopLevelItem(_annotationsItem); _annotationsItem->setExpanded(true); } _annotationsItem->takeChildren(); AnnotationVector annos; _manager->getAnnotations(annos); for (AnnotationVector::const_iterator it = annos.begin(); it != annos.end(); ++it) { AnnotationTreeItem* annoItem = new AnnotationTreeItem(*it, _map); annoItem->setText(0, QString(((*it)->getAnnotationData() ? (*it)->getAnnotationData()->getName().c_str() : "Annotation"))); annoItem->setCheckState(0, (*it)->getNodeMask() != 0 ? Qt::Checked : Qt::Unchecked); _annotationsItem->addChild(annoItem); if (_manager->isSelected(*it)) annoItem->setSelected(true); } _annotationsItem->setHidden(_hideEmptyGroups && _annotationsItem->childCount() == 0); } _updating = wasUpdating; }