コード例 #1
0
ファイル: StateActions.C プロジェクト: burlen/visit_vtk_7_src
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();
}
コード例 #2
0
void
VisWinAnnotations::SetAnnotationObjectOptions(const AnnotationObjectList &al)
{
    for(size_t i = 0; i < (size_t)al.GetNumAnnotations(); ++i)
    {
        const AnnotationObject &annot = al[i];
        if(i < annotations.size())
        {
            // Set whether the annotation is active.
            annotations[i]->SetActive(annot.GetActive());

            //
            // Let the annotation set its attributes with the annotation
            // object.
            //
            annotations[i]->SetOptions(annot);

            //
            // Set whether or not the annotation is visible.
            //
            annotations[i]->SetVisible(annot.GetVisible());
            if(annotations[i]->GetVisible())
                annotations[i]->AddToRenderer();
            else
                annotations[i]->RemoveFromRenderer();
        }
    }

    // Update the legends for the actors.
    UpdateLegends();
}
コード例 #3
0
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);
    }
}
コード例 #4
0
void
VisWinAnnotations::CreateAnnotationObjectsFromList(const AnnotationObjectList &al)
{
    for(int i = 0; i < al.GetNumAnnotations(); ++i)
    {
        const AnnotationObject &annot = al[i];
        int annotType = int(annot.GetObjectType());
        if(AddAnnotationObject(annotType, annot.GetObjectName()))
            annotations[annotations.size()-1]->SetOptions(annot);
    }
}