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 SetOperatorOptionsAction::Execute() { // // Set the operator attributes. // int oper = args.GetOperatorType(); bool applyToAllWindows = GetViewerState()->GetGlobalAttributes()->GetApplyWindow(); bool applyOperatorToAllPlots = GetViewerState()->GetGlobalAttributes()->GetApplyOperator(); if( applyToAllWindows ) { for( int i=0; i<windowMgr->GetNumWindows(); ++i ) { windowMgr->GetWindow(i)->GetPlotList()-> SetPlotOperatorAtts(oper, windowMgr->GetWindow(i)==window, applyToAllWindows, applyOperatorToAllPlots); } } else // Just the active window { window->GetPlotList()-> SetPlotOperatorAtts(oper, true, applyToAllWindows, applyOperatorToAllPlots); } }
DatabaseCorrelation * ViewerDatabaseCorrelationMethods::GetMostSuitableCorrelation(const stringVector &dbs) const { // // Score the correlations as to how many of the input databases they // contain. // std::map<std::string,int> scores; for(int i = 0; i < GetViewerState()->GetDatabaseCorrelationList()->GetNumCorrelations(); ++i) { const DatabaseCorrelation &c = GetViewerState()->GetDatabaseCorrelationList()-> GetCorrelations(i); scores[c.GetName()] = 0; for(size_t j = 0; j < dbs.size(); ++j) { if(c.UsesDatabase(dbs[j])) ++scores[c.GetName()]; } } #if 0 debug3 << "Scores: " << endl; for(std::map<std::string,int>::const_iterator sIt = scores.begin(); sIt != scores.end(); ++sIt) debug3 << "\t" << sIt->first << ", score= " << sIt->second << endl; #endif // // Look for any databases with a score of dbs.size() and then go down // to the correlation with the next highest score. // std::string correlationName; int score = 0; for(int desiredScore = (int)dbs.size(); desiredScore > 1 && score == 0; --desiredScore) { for(std::map<std::string,int>::const_iterator pos = scores.begin(); pos != scores.end(); ++pos) { if(pos->second == desiredScore) { score = desiredScore; correlationName = pos->first; break; } } } // // If the score matches the number of databases then return that // correlation. It's okay to return that correlation if score > 1 // since it means that it is not a trivial correlation. // DatabaseCorrelation *retval = 0; if((int)dbs.size() == score || score > 1) retval = GetViewerState()->GetDatabaseCorrelationList()->FindCorrelation(correlationName); return retval; }
void ViewerDatabaseCorrelationMethods::CreateNode(DataNode *parentNode, const std::map<std::string, std::string> &dbToSource, bool detailed) { // Create a copy of the database correlation list. DatabaseCorrelationList dbcl(*GetViewerState()->GetDatabaseCorrelationList()); dbcl.ClearCorrelations(); for(int i = 0; i < GetViewerState()->GetDatabaseCorrelationList()->GetNumCorrelations(); ++i) { const DatabaseCorrelation &corr = GetViewerState()->GetDatabaseCorrelationList()->GetCorrelations(i); // Let's only save out correlations that have more than 1 db. if(corr.GetNumDatabases() > 1) { // Map database names to source names. const stringVector &dbNames = corr.GetDatabaseNames(); stringVector sourceIds; for(size_t j = 0; j < dbNames.size(); ++j) { std::map<std::string, std::string>::const_iterator pos = dbToSource.find(dbNames[j]); if(pos == dbToSource.end()) sourceIds.push_back(dbNames[j]); else sourceIds.push_back(pos->second); } // Create a copy of the correlation but override its database // names with source ids. Also, note that we're not using a // copy constructor because we want most of the correlation // information to be absent so we can repopulate it on session read // in case a new database is chosen. DatabaseCorrelation modCorr; if(corr.GetMethod() != DatabaseCorrelation::UserDefinedCorrelation) { modCorr.SetName(corr.GetName()); modCorr.SetNumStates(corr.GetNumStates()); modCorr.SetMethod(corr.GetMethod()); } else { // A user-defined correlation should be saved mostly as-is. modCorr = corr; } modCorr.SetDatabaseNames(sourceIds); // Add the modified correlation to the list. dbcl.AddCorrelations(modCorr); } } // Add the database correlation list information to the session. dbcl.CreateNode(parentNode, detailed, false); }
void ViewerDatabaseCorrelationMethods::RemoveDatabaseCorrelation(const std::string &cName) { // Remove the correlation if(GetViewerState()->GetDatabaseCorrelationList()->RemoveCorrelation(cName)) { debug4 << "\tDeleted database correlation for " << cName.c_str() << endl; GetViewerState()->GetDatabaseCorrelationList()->Notify(); } }
void GetProcInfoAction::Execute() { ProcessAttributes tmpAtts; std::string componentName = VisItInit::ComponentIDToName(args.GetIntArg1()); if (componentName == "engine") { const std::string &hostName = args.GetProgramHost(); const std::string &simName = args.GetProgramSim(); GetViewerEngineManager()->GetProcInfo(EngineKey(hostName, simName), tmpAtts); } else if (componentName == "viewer") { #if defined(_WIN32) int pid = _getpid(); int ppid = -1; #else int pid = getpid(); int ppid = getppid(); #endif char myHost[256]; gethostname(myHost, sizeof(myHost)); std::vector<int> tmpPids; tmpPids.push_back(pid); std::vector<int> tmpPpids; tmpPpids.push_back(ppid); std::vector<std::string> tmpHosts; tmpHosts.push_back(myHost); tmpAtts.SetPids(tmpPids); tmpAtts.SetPpids(tmpPpids); tmpAtts.SetHosts(tmpHosts); tmpAtts.SetIsParallel(false); // would be better to check for threads } else { GetViewerMessaging()->Warning( TR("Currently, GetProcessAttributes() works only for " "\"engine\" or \"viewer\"")); return; } *GetViewerState()->GetProcessAttributes() = tmpAtts; GetViewerState()->GetProcessAttributes()->SelectAll(); GetViewerState()->GetProcessAttributes()->Notify(); }
void SimEngineManager::UpdateEngineList() { EngineList newEL; EngineProperties props(engine->GetEngineProperties()); newEL.GetEngineName().push_back(engineKey.HostName()); newEL.GetSimulationName().push_back(engineKey.SimName()); newEL.AddProperties(props); // Send the engine list to the viewer's client. *(GetViewerState()->GetEngineList()) = newEL; GetViewerState()->GetEngineList()->Notify(); }
void QvisKeyframeWindow::stateKFClicked() { QModelIndex index(kv->currentIndex()); if(!index.isValid()) return; int state = dbStateLineEdit->text().toInt(); if (state < 0) { Error(tr("Cannot set state index to less than zero\n")); return; } int dt = index.data(KeyframeDataModel::DelegateTypeRole).toInt(); int pos = index.data(KeyframeDataModel::CurrentIndexRole).toInt(); int plotId = -1; if(dt == KeyframeDataModel::PlotDelegate || dt == KeyframeDataModel::PlotAttsDelegate || dt == KeyframeDataModel::PlotStateDelegate) { plotId = index.data(KeyframeDataModel::GetIdRole).toInt(); } if(plotId != -1) GetViewerMethods()->SetPlotDatabaseState(plotId, pos, state); else { int nPlots = GetViewerState()->GetPlotList()->GetNumPlots(); for(int i = 0; i < nPlots; ++i) GetViewerMethods()->SetPlotDatabaseState(i, pos, state); } dbStateLineEdit->clear(); }
void ViewerMessagingUI::SetStatusAttributesMessage(const ViewerText &message) { QString qmsg(QStringFromViewerText(message)); StatusAttributes_SetStatusMessage(*GetViewerState()->GetStatusAttributes(), qmsg, true); }
void ViewerMessagingUI::SetMessageAttributesText(const ViewerText &message) { QString qmsg(QStringFromViewerText(message)); MessageAttributes_SetText(*GetViewerState()->GetMessageAttributes(), qmsg, true); }
void SetActivePlotsAction::Execute() { // // Set the active plots through the window manager. // const intVector &activePlots = args.GetActivePlotIds(); const intVector &activeOperators = args.GetActiveOperatorIds(); const intVector &expandedPlots = args.GetExpandedPlotIds(); bool moreThanPlotsValid = args.GetBoolFlag(); bool applyToAllWindows = GetViewerState()->GetGlobalAttributes()->GetApplyWindow(); if( applyToAllWindows ) { for( int i=0; i<windowMgr->GetNumWindows(); ++i ) { windowMgr->GetWindow(i)->GetPlotList()-> SetActivePlots(activePlots, activeOperators, expandedPlots, moreThanPlotsValid); } } else // Just the active window { window->GetPlotList()-> SetActivePlots(activePlots, activeOperators, expandedPlots, moreThanPlotsValid); } if (window->GetInteractionMode() == ZONE_PICK || window->GetInteractionMode() == NODE_PICK || window->GetInteractionMode() == DDT_PICK) ViewerQueryManager::Instance()->ActivePlotsChanged(); }
void QvisPostableWindowSimpleObserver::makeDefaultHelper() { if(makeDefaultConfirm) { QString msg(tr("Do you really want to make these the default attributes?")); // Ask the user if he really wants to set the defaults int button = QMessageBox::warning(0, "VisIt", msg, tr("Ok"), tr("Cancel"), tr("Yes, Do not prompt again"), 0, 1); if(button == 0) { // The user actually chose to set the defaults. makeDefault(); } else if(button == 2) { // Make it so no confirmation is needed. makeDefaultConfirm = false; GlobalAttributes *globalAtts = GetViewerState()->GetGlobalAttributes(); globalAtts->SetMakeDefaultConfirm(false); globalAtts->Notify(); makeDefault(); } } else makeDefault(); }
void AddPlotAction::Execute() { bool replacePlots = GetViewerState()->GetGlobalAttributes()->GetReplacePlots(); bool applyOperator = GetViewerState()->GetGlobalAttributes()->GetApplyOperator(); bool applySelection = GetViewerState()->GetGlobalAttributes()->GetApplySelection(); bool inheritSILRestriction = GetViewerState()->GetGlobalAttributes()-> GetNewPlotsInheritSILRestriction(); // // Try and create the plot. // window->GetPlotList()->AddPlot(args.GetPlotType(), args.GetVariable().c_str(), replacePlots, applyOperator, inheritSILRestriction, applySelection); }
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); } }
void RemoveAllOperatorsAction::Execute() { bool applyToAllWindows = GetViewerState()->GetGlobalAttributes()->GetApplyWindow(); bool applyOperatorToAllPlots = GetViewerState()->GetGlobalAttributes()->GetApplyOperator(); if( applyToAllWindows ) { for( int i=0; i<windowMgr->GetNumWindows(); ++i ) { windowMgr->GetWindow(i)->GetPlotList()-> RemoveAllOperators(applyOperatorToAllPlots); } } else // Just the active window { window->GetPlotList()-> RemoveAllOperators(applyOperatorToAllPlots); } }
bool SimEngineManager::DefineVirtualDatabase(const EngineKey &/*ek*/, const std::string &format, const std::string &dbName, const std::string &path, const stringVector &files, int time) { // NOTE: This is pretty much the same as Executors.h. We could make this a proper // method of NetworkManager to reduce code duplication. engine->GetNetMgr()->GetDatabasePluginManager()->PluginAvailable(format); avtDatabaseFactory::SetCreateMeshQualityExpressions(GetViewerState()-> GetGlobalAttributes()->GetCreateMeshQualityExpressions()); avtDatabaseFactory::SetCreateTimeDerivativeExpressions(GetViewerState()-> GetGlobalAttributes()->GetCreateTimeDerivativeExpressions()); engine->GetNetMgr()->DefineDB(dbName, path, files, time, format); return true; }
std::string ViewerDatabaseCorrelationMethods::CreateNewCorrelationName() const { int index = 0; char newName[100]; do { index++; SNPRINTF(newName, 100, "Correlation%02d", index); } while(GetViewerState()->GetDatabaseCorrelationList()->FindCorrelation(newName) != 0); return std::string(newName); }
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); } } }
// This method causes the code to block until the viewer has // caught up with the client. void Synchronize() { GetViewerState()->GetSyncAttributes()->SetSyncTag(syncTag); GetViewerState()->GetSyncAttributes()->Notify(); sync_data s; s.syncTag = syncTag; s.waitForSync = true; ObserverToCallback *sync = new ObserverToCallback( GetViewerState()->GetSyncAttributes(), CheckSync, (void*)&s); // An event loop while(s.waitForSync) { if(viewer->GetWriteConnection()->NeedsRead(true)) viewer->ProcessInput(); } delete sync; ++syncTag; }
void SetPlotSILRestrictionAction::Execute() { // // Tell the plot list set the current SIL restriction for the // selected plots. // bool applyToAllWindows = GetViewerState()->GetGlobalAttributes()->GetApplyWindow(); bool applySelectionToAllPlots = GetViewerState()->GetGlobalAttributes()->GetApplySelection(); if( applyToAllWindows ) { for( int i=0; i<windowMgr->GetNumWindows(); ++i ) { windowMgr->GetWindow(i)->GetPlotList()-> SetPlotSILRestriction(applySelectionToAllPlots); } } else // Just the active window { window->GetPlotList()->SetPlotSILRestriction(applySelectionToAllPlots); } }
void ViewerDatabaseCorrelationMethods::UpdateDatabaseCorrelation(const std::string &cName) { DatabaseCorrelation *c = GetViewerState()->GetDatabaseCorrelationList()->FindCorrelation(cName); if(c != 0) { DatabaseCorrelation *replacementCorrelation = CreateDatabaseCorrelation( c->GetName(), c->GetDatabaseNames(), (int)c->GetMethod()); if(replacementCorrelation != 0) { // Copy over the old database correlation. *c = *replacementCorrelation; } } }
virtual void Work() { // Open a database GetViewerMethods()->InvertBackgroundColor(); GetViewerMethods()->OpenDatabase("/usr/gapps/visit/data/noise.silo"); Synchronize(); // Create a plot and draw it. int plotType = PlotIndex("Pseudocolor"); if(plotType != INVALID_PLUGIN_INDEX) { debug1 << "Plot type = " << plotType << endl; GetViewerMethods()->AddPlot(plotType, "hardyglobal"); int threeSlice = OperatorIndex("ThreeSlice"); if(threeSlice != INVALID_PLUGIN_INDEX) GetViewerMethods()->AddOperator(threeSlice); GetViewerMethods()->DrawPlots(); } Synchronize(); // Save an image. GetViewerMethods()->SaveWindow(); // Set some pseudocolor plot attributes using the base class' // SetValue methods. AttributeSubject *pcAtts = GetViewerState()->GetPlotAttributes(plotType); if(pcAtts != 0) { pcAtts->SetValue("min", 1.5); pcAtts->SetValue("minFlag", true); pcAtts->SetValue("max", 4.5); pcAtts->SetValue("maxFlag", true); pcAtts->SetValue("colorTableName", "calewhite"); pcAtts->Notify(); GetViewerMethods()->SetPlotOptions(plotType); } // Save an image. GetViewerMethods()->SaveWindow(); // Enter an event loop so the program keeps running and we can // interact with the viewer. EventLoop(); }
void DrawPlotsAction::Execute() { bool applyToAllWindows = GetViewerState()->GetGlobalAttributes()->GetApplyWindow(); if( applyToAllWindows ) { for( int i=0; i<windowMgr->GetNumWindows(); ++i ) { windowMgr->GetWindow(i)->GetPlotList()-> RealizePlots(args.GetBoolFlag()); } } else // Just the active window { window->GetPlotList()->RealizePlots(args.GetBoolFlag()); } }
QvisSpreadsheetPlotWindow::QvisSpreadsheetPlotWindow(const int type, SpreadsheetAttributes *subj, const QString &caption, const QString &shortName, QvisNotepadArea *notepad) : QvisPostableWindowObserver(subj, caption, shortName, notepad) { plotType = type; atts = subj; normal = 0; // We will observe the SILRestriction attributes too so we can display // the available subsets in the window. silTopSet = -1; silNumSets = -1; silNumCollections = -1; GetViewerState()->GetSILRestrictionAttributes()->Attach(this); }
void ResetOperatorOptionsAction::Execute() { // // Get the rpc arguments. // int oper = args.GetOperatorType(); // // Update the client so it has the default attributes. // GetOperatorFactory()->SetClientAttsFromDefault(oper); // // Perform the rpc. // bool applyToAll = GetViewerState()->GetGlobalAttributes()->GetApplyOperator(); GetWindow()->GetPlotList()->SetPlotOperatorAtts(oper, applyToAll); }
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); } }
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 = GetViewerState()->GetGlobalAttributes()->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); if(!resultsPlot) return; 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; }
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 = GetViewerState()->GetGlobalAttributes()->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); if(!resultsPlot) return; resultsPlot->SetSILRestriction(originatingPlot->GetSILRestriction()); // // Variables with implied operators will already have an operator applied. // int nExistingOperators = resultsPlot->GetNOperators(); // // Copy operator attributes from the originating plot to the results // (curve) plot. We may need to add the operators too. // 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"); } // Just add operators that were not already on the plot when it was created. if(j >= nExistingOperators) 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(); }
void ReadHostProfilesFromDirectoryAction::Execute() { GetViewerStateManager()->ReadHostProfilesFromDirectory(args.GetDatabase(), args.GetBoolFlag()); GetViewerState()->GetHostProfileList()->Notify(); }
void ViewerDatabaseCorrelationMethods::SetFromNode(DataNode *parentNode, const std::map<std::string,std::string> &sourceToDB, const std::string &configVersion) { GetViewerState()->GetDatabaseCorrelationList()->ClearCorrelations(); // Load the correlations DataNode *cLNode = parentNode->GetNode("DatabaseCorrelationList"); if(cLNode != 0) { // Read the database correlation list into a temporary. DatabaseCorrelationList dbcl; dbcl.ProcessOldVersions(parentNode, configVersion.c_str()); dbcl.SetFromNode(parentNode); // Since the database correlations in the temporary may // not have complete information, let's recreate the // database correlations. GetViewerState()->GetDatabaseCorrelationList()->ClearCorrelations(); for(int i = 0; i < dbcl.GetNumCorrelations(); ++i) { const DatabaseCorrelation &corr = dbcl[i]; if(corr.GetMethod() != DatabaseCorrelation::UserDefinedCorrelation) { // Translate the source names in the database correlation into // database names using the sourceToDB map. stringVector dbNames; const stringVector &sourceNames = corr.GetDatabaseNames(); for(size_t j = 0; j < sourceNames.size(); ++j) { std::map<std::string,std::string>::const_iterator pos = sourceToDB.find(sourceNames[j]); if(pos != sourceToDB.end()) dbNames.push_back(pos->second); else dbNames.push_back(sourceNames[j]); } // Create a new database correlation based on the inputs for the // one that we read from the session file. DatabaseCorrelation *newCorr = CreateDatabaseCorrelation( corr.GetName(), dbNames, corr.GetMethod(), -1); // If we were able to create a database correlation then add it // to the database correlation list. if(newCorr != 0) { GetViewerState()->GetDatabaseCorrelationList()->AddCorrelations(*newCorr); delete newCorr; } } else { // We read in a user-defined database correlation. // Don't mess with it. GetViewerState()->GetDatabaseCorrelationList()->AddCorrelations(corr); } } // // Now that the correlation list contains valid correlations, // notify clients. // GetViewerState()->GetDatabaseCorrelationList()->Notify(); } }