AddOperatorAction::AddOperatorAction(ViewerWindow *win) :
    ViewerActionLogic(win), graphicalPlugins()
{
    //
    // Iterate through all of the loaded operator plugins and add a
    // choice for all of the ones that have icons.
    //
    ViewerOperatorPluginInfo *info = 0;
    OperatorPluginManager *pluginMgr = GetOperatorPluginManager();
    int nTypes = pluginMgr->GetNEnabledPlugins();
    for (int i = 0; i < nTypes; ++i)
    {
        info = pluginMgr->GetViewerPluginInfo(pluginMgr->GetEnabledID(i));
        if(info)
        {
            if(!GetViewerProperties()->GetNowin() && 
               info->XPMIconData() != 0 &&
               info->GetUserSelectable())
            {
                // Record that this plugin has an icon.
                graphicalPlugins.push_back(i);
            }
        }
    }
}
void
AddInitializedOperatorAction::Execute()
{
    //
    // Get the rpc arguments.
    //
    int type = args.GetOperatorType();

    OperatorPluginManager *opMgr = GetOperatorPluginManager();
    bool lineout = (opMgr->GetPluginName(opMgr->GetEnabledID(type))
                    == "Lineout");

    //
    // Perform the rpc.
    //
    if (!lineout)
    {
        bool applyToAll = GetViewerState()->GetGlobalAttributes()->GetApplyOperator();
        GetWindow()->GetPlotList()->AddOperator(type, applyToAll, false);
    }
    else
    {
        GetWindow()->Lineout(false);
    }
}
Пример #3
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));
    }
}
Пример #4
0
void
VisItDataServerPrivate::Open(int argc, char *argv[])
{
    // Profile to launch the engine in serial on localhost. A parallel
    // launch would include more information in the MachineProfile and 
    // would set the parallel options in the LaunchProfile.
    MachineProfile localhost;
    LaunchProfile  lp;
    lp.SetProfileName("serial");
    lp.SetParallel(false);
    localhost.AddLaunchProfiles(lp);

    // Initialize
    VisItInit::SetComponentName("VisItDataServerPrivate");
    VisItInit::Initialize(argc, argv);

    //
    // Initialize the plugin managers and load the plugins.
    //
    plotPlugins.Initialize(PlotPluginManager::Scripting, false, pluginDir.c_str());
    operatorPlugins.Initialize(OperatorPluginManager::Scripting, false, pluginDir.c_str());
    LoadPluginsNow(plotPlugins);
    LoadPluginsNow(operatorPlugins);

    //
    // Create the mdserver
    //
    mdserver.Create(localhost);
    mdserver.GetMDServerMethods()->LoadPlugins();

    //
    // Create the engine
    //
    engine.Create(localhost);
}
Пример #5
0
AttributeSubject *
VisItDataServerPrivate::CreateOperatorAttributes(const std::string id)
{
    AttributeSubject *atts = NULL;
    ScriptingOperatorPluginInfo *info = operatorPlugins.GetScriptingPluginInfo(id);
    if(info != 0)
        atts = info->AllocAttributes();
    return atts;
}
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);
        }
    }
}
void
QvisOperatorWindow::SetOperatorOptions()
{
    PlotList *plots = GetViewerState()->GetPlotList();

    // If there are plots, see if the operator should be applied.
    if(plots->GetNumPlots() > 0)
    {
        bool applyToAll = GetViewerState()->GetGlobalAttributes()->GetApplyOperator();
        int i, j;

        // Look to see if the operator exists in the plots
        bool found = false;
        for(i = 0; i < plots->GetNumPlots() && !found; ++i)
        {
            const Plot &plot = plots->operator[](i);
            if(plot.GetActiveFlag() || applyToAll)
            {
                for(j = 0; j < plot.GetNumOperators(); ++j)
                {
                     if(operatorType == plot.GetOperator(j))
                     {
                         found = true;
                         break;
                     }
                }
            }
        }

        // If the operator was not found in the plot list, ask the user whether
        // the operator should be added to the plots.
        if(!found)
        {
            int button = 0;

            // Only ask the user if we are not automatically adding the
            // operator.
            if(!GetViewerState()->GetGlobalAttributes()->GetAutomaticallyAddOperator())
            {
                OperatorPluginManager *opMgr = GetViewerProxy()->GetOperatorPluginManager();

                // Create a prompt for the user.
                GUIOperatorPluginInfo *info = opMgr->GetGUIPluginInfo(
                                              opMgr->GetEnabledID(operatorType));
                QString menuName, *s = 0;
                if(info)
                {
                    s = info->GetMenuName();
                    menuName = *s;
                }

                QString msg = tr("No %1 operator was found for the selected plots.\n"
                                 "Do you want to apply the %2 operator?\n\n").
                              arg(menuName).arg(menuName);

                if(s != 0)
                    delete s;

                QMessageBox msgBox;
                msgBox.setWindowTitle("VisIt");
                msgBox.setText(msg);
                QPushButton *yesButton    = msgBox.addButton(QMessageBox::Yes);
                QPushButton *noButton     = msgBox.addButton(QMessageBox::No);
                QPushButton *yesAllButton = msgBox.addButton(tr("Yes, Do not prompt again"),
                                                             QMessageBox::ActionRole);
                
                msgBox.exec();
                QPushButton *clicked = (QPushButton*)msgBox.clickedButton();
                if ( clicked == yesButton) 
                {
                    // connect
                    button = 0;
                }
                else if (clicked == noButton) 
                {
                    button = 1;
                }
                else if (clicked == yesAllButton) 
                {
                    button = 2;
                }
            }

            if(button == 0)
            {
                // Set the client attributes, and set the 'fromDefault' flag
                // to false in the call to AddOperator, so that the operator 
                // knows to initialize the atts from client rather than the 
                // ususal default atts. 
                GetViewerMethods()->AddInitializedOperator(operatorType);
            }
            else if (button == 2)
            {
                // Make it so no confirmation is needed.
                GlobalAttributes *globalAtts = GetViewerState()->GetGlobalAttributes();
                globalAtts->SetAutomaticallyAddOperator(true);
                globalAtts->Notify();

                // Set the client attributes, and set the 'fromDefault' flag
                // to false in the call to AddOperator, so that the operator 
                // knows to initialize the atts from client rather than the 
                // ususal default atts. 
                GetViewerMethods()->AddInitializedOperator(operatorType);
            }
        }
        else
            GetViewerMethods()->SetOperatorOptions(operatorType);
    }
}