Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

src/aclvis/vizCallbackImpl.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  * This program was prepared by PSI. 
00007  * All rights in the program are reserved by PSI.
00008  * Neither PSI nor the author(s)
00009  * makes any warranty, express or implied, or assumes any liability or
00010  * responsibility for the use of this software
00011  *
00012  * Visit http://www.acl.lanl.gov/POOMS for more details
00013  *
00014  ***************************************************************************/
00015 
00016 // -*- C++ -*-
00017 /***************************************************************************
00018  *
00019  * The IPPL Framework
00020  * 
00021  *
00022  * Visit http://people.web.psi.ch/adelmann/ for more details
00023  *
00024  ***************************************************************************/
00025 
00026 #include "aclvis/aclvis.h"
00027 #include "aclvis/MainWindow.h"
00028 
00029 // step to the next update
00030 void vizStep(VizTool *tool) {
00031   tool->InteractExit();
00032 }
00033 
00034 
00035 // tell the system to update display and hand back control
00036 void vizGo(VizTool *tool) {
00037   tool->InteractGoFlow();
00038   tool->InteractExit();
00039 }
00040 
00041 
00042 // go back to keeping control when next update is done
00043 void vizStop(VizTool *tool) {
00044   tool->InteractStopFlow();
00045   tool->InteractExit();
00046 }
00047 
00048 
00049 // reset the view of the display to center all the graphics objects
00050 void vizResetRenderer(VizTool *tool) {
00051   RenderTool *rendertool = (RenderTool *)(tool->GetSelectedTool(Render));
00052   rendertool->GetRenderer()->ResetCamera();
00053 }
00054 
00055 
00056 // create a new tool - the first argument is the name of the tool,
00057 // while the second is the name of the data object.  Return success.
00058 bool vizCreateTool(VizTool *, MainWindow *win,
00059                    const char *toolname, const char *dataname,
00060                    int numopts, char *optvalues[]) {
00061   return win->CreateNewTool(dataname, toolname, numopts, optvalues);
00062 }
00063 
00064 
00065 // set up the parameters used for writing image dumps.  Return success.
00066 bool vizImageCmd(VizTool *tool, int argc, char **argv) {
00067   // we parse the command here
00068   if (argc > 0) {
00069     for (int i=0; i < argc; ++i) {
00070       if (!strcmp(argv[i], "base") && i < (argc-1)) {
00071         cerr << "Setting image base to '" << argv[i+1] << "' ..." << endl;
00072         tool->SetImageFileBase(argv[++i]);
00073       } else if (!strcmp(argv[i], "ext") && i < (argc-1)) {
00074         cerr << "Setting image ext to '" << argv[i+1] << "' ..." << endl;
00075         tool->SetImageFileExt(argv[++i]);
00076       } else if (!strcmp(argv[i], "num") && i < (argc-1)) {
00077         cerr << "Setting image num to '" << atoi(argv[i+1]) << "' ..." << endl;
00078         tool->SetImageNextNum(atoi(argv[++i]));
00079       } else {
00080         cerr << "Error: bad image param '" << argv[i] << "'." << endl;
00081         return false;
00082       }
00083     }
00084   } else {
00085     // reset to not write image files
00086     tool->SetImageFileBase(0);
00087     tool->SetImageFileExt(0);
00088   }
00089 
00090   return true;
00091 }
00092 
00093 /***************************************************************************
00094  * $RCSfile: vizCallbackImpl.cpp,v $   $Author: adelmann $
00095  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:34 $
00096  * IPPL_VERSION_ID: $Id: vizCallbackImpl.cpp,v 1.1.1.1 2003/01/23 07:40:34 adelmann Exp $ 
00097  ***************************************************************************/

Generated on Fri Nov 2 01:25:54 2007 for IPPL by doxygen 1.3.5