void ResetAnnotationObjectListAction::Execute() { AnnotationObjectList legendPlusDefault; // Add the legends. for(int i = 0; i < GetViewerState()->GetAnnotationObjectList()->GetNumAnnotations(); ++i) { if(GetViewerState()->GetAnnotationObjectList()->GetAnnotation(i).GetObjectType() == AnnotationObject::LegendAttributes) { legendPlusDefault.AddAnnotation(GetViewerState()->GetAnnotationObjectList()->GetAnnotation(i)); } } // Add the defaults. for(int i = 0; i < windowMgr->GetDefaultAnnotationObjectList()->GetNumAnnotations(); ++i) legendPlusDefault.AddAnnotation(windowMgr->GetDefaultAnnotationObjectList()->GetAnnotation(i)); // We should add an optional bool array to CreateAnnotationObjectsFromList that // lets us tell the routine whether to set the options for the newly created object. // That would let us create annotation objects but not use the attributes we have // for them. The use case for that is resetting the legends to default values. GetWindow()->DeleteAllAnnotationObjects(); GetWindow()->CreateAnnotationObjectsFromList(legendPlusDefault); windowMgr->UpdateAnnotationObjectList(); }
void VisWinAnnotations::UpdateAnnotationObjectList(AnnotationObjectList &al) { al.ClearAnnotations(); std::vector<avtActor*>::iterator it; for(size_t i = 0; i < annotations.size(); ++i) { AnnotationObject annot; annotations[i]->GetOptions(annot); annot.SetObjectName(annotations[i]->GetName()); for (it = actorList.begin(); it != actorList.end(); it++) { if (annotations[i]->GetName() == (*it)->GetActorName()) { avtLegend_p legend = (*it)->GetLegend(); if (*legend != NULL) { annot.SetIntAttribute3(legend->GetType()); if (legend->GetType() == 0 && legend->GetCurrentlyDrawn() && !legend->GetUseSuppliedLabels()) { doubleVector v; legend->GetCalculatedLabels(v); annot.SetDoubleVector1(v); } else if (legend->GetType() == 1 && legend->GetCurrentlyDrawn()) { stringVector s; legend->GetCalculatedLabels(s); annot.SetStringVector2(s); } break; } } } al.AddAnnotation(annot); } }