コード例 #1
0
ViewerOperatorFactory::ViewerOperatorFactory() : ViewerBase()
{
    OperatorPluginManager *operatorPluginMgr = GetOperatorPluginManager();

    nTypes = operatorPluginMgr->GetNEnabledPlugins();

    viewerPluginInfo  = new ViewerOperatorPluginInfo*[nTypes];

    for (int i = 0; i < nTypes; ++i)
    {
        viewerPluginInfo[i]  = operatorPluginMgr->GetViewerPluginInfo(
                                           operatorPluginMgr->GetEnabledID(i));
    }
}
コード例 #2
0
void
AddOperatorAction::Execute()
{
    //
    // Get the rpc arguments.
    //
    int type = args.GetOperatorType();
    bool fromDefault = args.GetBoolFlag();

    OperatorPluginManager *opMgr = GetOperatorPluginManager();
    std::string name(opMgr->GetPluginName(opMgr->GetEnabledID(type)));
    if (name == "Lineout") // PLUGIN SIN!!!
    {
        window->Lineout(fromDefault);
    }
    else
    {
        //
        // Add the operator to the window's plot list.
        //
        bool applyToAllWindows = GetViewerState()->GetGlobalAttributes()->GetApplyWindow();
        bool applyOperatorToAllPlots = GetViewerState()->GetGlobalAttributes()->GetApplyOperator();

        if( applyToAllWindows )
        {
          for( int i=0; i< windowMgr->GetNumWindows(); ++i )
          {
            windowMgr->GetWindow(i)->GetPlotList()->
              AddOperator(type, applyOperatorToAllPlots, fromDefault);
          }
        }
        else // Just the active window
        {
          window->GetPlotList()->
            AddOperator(type, applyOperatorToAllPlots, fromDefault);
        }
    }
}
コード例 #3
0
void
ViewerQuery::CreateLineout(const bool fromDefault, const bool forceSampling)
{
    //
    //  Grab information from the originating window.
    //
    ViewerPlotList *origList = originatingWindow->GetPlotList();
    intVector plotIDs;
    origList->GetActivePlotIDs(plotIDs);
    int origPlotID = (plotIDs.size() > 0 ? plotIDs[0] : -1);
    originatingPlot = origList->GetPlot(origPlotID);

    std::string vName;
    if (lineAtts->GetVarName() == "default")
        vName = originatingPlot->GetVariableName();
    else 
        vName = lineAtts->GetVarName();
    std::string hdbName(originatingPlot->GetSource());
    bool replacePlots = ViewerWindowManager::Instance()->
                        GetClientAtts()->GetReplacePlots();
 
    int plotType = GetPlotPluginManager()->GetEnabledIndex("Curve_1.0");
    ViewerPlotList *plotList = resultsWindow->GetPlotList();

    // If the original plot list has a time slider corresponding to the
    // the originating plot's hostdabase name, make sure that
    // the the new plot list uses the same time slider.
    if (origList->TimeSliderExists(hdbName))
    {
        int state, nStates;
        origList->GetTimeSliderStates(hdbName, state, nStates);
        plotList->CreateTimeSlider(hdbName, state);
        plotList->SetActiveTimeSlider(hdbName);
    }

    plotList->SetHostDatabaseName(hdbName);
    plotList->SetEngineKey(originatingPlot->GetEngineKey());
 
    int pid = plotList->AddPlot(plotType, vName, replacePlots, false, false);
    resultsPlot = plotList->GetPlot(pid);

    resultsPlot->SetSILRestriction(originatingPlot->GetSILRestriction()); 
    //
    // Copy operators from the originating plot to the results (curve) plot.
    //
    for (int j = 0; j < originatingPlot->GetNOperators(); ++j)
    {
        ViewerOperator *op = originatingPlot->GetOperator(j);
        //
        // Keep a copy of the slice-plane atts, so that the line endpoints
        // may be updated accordingly whent the slice-plane changes.
        //
        if (strcmp(op->GetName(), "Slice") == 0)
        {
            planeAtts = (PlaneAttributes *)op->GetOperatorAtts()->
                        CreateCompatible("PlaneAttributes");
        }
        resultsPlot->AddOperator(op->GetType());
        ViewerOperator *newOp = resultsPlot->GetOperator(j);
        newOp->SetOperatorAtts(op->GetOperatorAtts());
    }
 
    //
    // Add the lineout operator.
    //
    int operatorType = GetOperatorPluginManager()->GetEnabledIndex("Lineout_1.0");
    resultsPlot->AddOperator(operatorType, fromDefault);

    //
    //  The client atts were already copied created,
    //  so now update them with the lineAtts.
    //
    resultsPlot->SetPlotAtts(lineAtts);

    int id = resultsPlot->GetNOperators() -1;
    resultsPlot->GetOperator(id)->SetOperatorAtts(lineAtts);
    resultsPlot->GetOperator(id)->SetOperatorAtts(
        ViewerQueryManager::Instance()->GetGlobalLineoutAtts());
    if (forceSampling)
    {
        lineAtts->SetSamplingOn(true);
        resultsPlot->GetOperator(id)->SetOperatorAtts(lineAtts);
    }

    plotList->RealizePlots();
}
コード例 #4
0
ViewerQuery::ViewerQuery(const ViewerQuery *obj, int ts) : SimpleObserver(), 
    ViewerBase()
{
    resPlotQueryInfo = 0;
    planeAtts = 0;

    lineAtts = new Line();
    originatingWindow = obj->originatingWindow;
    resultsWindow = obj->resultsWindow;
    lineAtts->CopyAttributes(obj->lineAtts);

    ViewerQueryManager *vqm = ViewerQueryManager::Instance();
    if (vqm->GetGlobalLineoutAtts()->GetColorOption() ==
        GlobalLineoutAttributes::CreateColor)
    {
        lineAtts->SetColor(vqm->GetColor());
    }

    originatingPlot = obj->originatingPlot;
    std::string vName;
    if (lineAtts->GetVarName() == "default")
        vName = originatingPlot->GetVariableName();
    else 
        vName = lineAtts->GetVarName();

    bool replacePlots = ViewerWindowManager::Instance()->
                        GetClientAtts()->GetReplacePlots();

    ViewerPlotList *plotList = resultsWindow->GetPlotList();

    int plotType = GetPlotPluginManager()->GetEnabledIndex("Curve_1.0");

    int pid = plotList->AddPlot(plotType, vName, replacePlots, false, false);
    resultsPlot = plotList->GetPlot(pid);
    resultsPlot->SetSILRestriction(originatingPlot->GetSILRestriction());

    //
    // Copy operators from the originating plot to the results (curve) plot.
    //
    for (int j = 0; j < originatingPlot->GetNOperators(); ++j)
    {
        ViewerOperator *op = originatingPlot->GetOperator(j);
        //
        // Keep a copy of the slice-plane atts, so that the line endpoints
        // may be updated accordingly whent the slice-plane changes.
        //
        if (strcmp(op->GetName(), "Slice") == 0)
        {
            planeAtts = (PlaneAttributes *)op->GetOperatorAtts()->
                        CreateCompatible("PlaneAttributes");
        }
        resultsPlot->AddOperator(op->GetType());
        ViewerOperator *newOp = resultsPlot->GetOperator(j);
        newOp->SetOperatorAtts(op->GetOperatorAtts());
    }
 
    //
    // Add the lineout operator.
    //
    int operatorType = GetOperatorPluginManager()->GetEnabledIndex("Lineout_1.0");
    resultsPlot->AddOperator(operatorType, false);

    //
    //  The client atts were already copied created,
    //  so now update them with the lineAtts.
    //
    resultsPlot->SetPlotAtts(lineAtts);

    int id = resultsPlot->GetNOperators() -1;
    resultsPlot->GetOperator(id)->SetOperatorAtts(lineAtts);
    resultsPlot->GetOperator(id)->SetOperatorAtts(
        ViewerQueryManager::Instance()->GetGlobalLineoutAtts());

    resultsPlot->SetFollowsTime(true);
    resultsPlot->SetCacheIndex(ts);
    resultsPlot->SetFollowsTime(false);
    plotList->RealizePlots();

    //
    // Connect to the resultsPlot
    //
    StartObservingPlot();
    
    handlingTool = false;
}