Exemplo n.º 1
0
bool
ViewerQuery::InitializeTool(avtToolInterface &ti)
{
    bool retval = false;

    // Lineout is always last.
    int index = resultsPlot->GetNOperators()-1;

    //
    // Try and convert the operator attributes object into a type that
    // is compatible with the tool. Note that we must do it like this
    // so the generic tool attributes do not need to know about the
    // operator attributes. This is important because the operator
    // attributes exist only in plugins.
    //
    std::string tname(ti.GetAttributes()->TypeName());
    const AttributeSubject *operatorAtts = resultsPlot->GetOperator(index)->GetOperatorAtts();
    AttributeSubject *atts = operatorAtts->CreateCompatible(tname);

    if(atts != 0 && ti.GetAttributes()->CopyAttributes(atts))
    {
        retval = true;
        delete atts;
        handlingTool = true;
    }
  
    return retval;
}
Exemplo n.º 2
0
void
LineoutListItem::HandleTool(const avtToolInterface &ti)
{
    int i;
    bool success = false;
    if (ti.GetAttributes()->TypeName() == "Line")
    {
        for (i = 0; i < nQueries; i++)
        {
            success |= queries[i]->HandleTool(ti); 
        }
    }
    else if (origPlotQueryInfo)  // in Dynamic mode, other tools can be handled
    {
        if (ti.GetAttributes()->TypeName() == "PlaneAttributes")
        {
           PlaneAttributes *planeAtts = (PlaneAttributes*)ti.GetAttributes()->
                                        CreateCompatible("PlaneAttributes"); 
           if (planeAtts)
           {
               for (i =0; i < nQueries; i++)
               {
                   success |= queries[i]->UpdateLineFromSlice(planeAtts);
               }
               delete planeAtts;
           }
        } 
        else // some other tool, have the plot list handle it in the usual way.
        {
            ViewerPlotList *resPL = resWin->GetPlotList();
            resPL->HandleTool(ti);
        }
    }
    if (success)
    {
        //
        //  We want to update the window where lineouts are drawn,
        //
        ViewerPlotList *resPL = resWin->GetPlotList();
        resPL->UpdatePlotAtts(false);
        resPL->UpdateFrame();
    }
}
Exemplo n.º 3
0
bool
ViewerQuery::HandleTool(const avtToolInterface &ti)
{
    bool val = false;
    Line *temp = (Line *)ti.GetAttributes()->CreateCompatible("Line");
    if (temp && handlingTool)
    {
        if  (!(lineAtts->FieldsEqual(0, temp)) ||
             !(lineAtts->FieldsEqual(1, temp))) 
        {
            // Lineout is always last, get its index. 
            int index = resultsPlot->GetNOperators()-1;
            // Update lineout's atts with the tool atts. 
            val |= resultsPlot->GetOperator(index)->SetOperatorAtts(ti.GetAttributes());
            // Update this query's line atts with the tool atts.
            lineAtts->SetPoint1(temp->GetPoint1());
            lineAtts->SetPoint2(temp->GetPoint2());
            //  Make sure the refline updates, too.
            originatingWindow->UpdateQuery(lineAtts);
        }
        delete temp;
    }
    return val;
}