Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CmdAnimate.C

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: CmdAnimate.C,v $
00013  *      $Author: johns $        $Locker:  $                $State: Exp $
00014  *      $Revision: 1.53 $      $Date: 2019/01/17 21:20:58 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  * 
00019  * Command objects for doing animation.
00020  *
00021  ***************************************************************************/
00022 
00023 #include <string.h>
00024 #include <stdlib.h>
00025 #include <ctype.h>
00026 
00027 #include "config.h"
00028 #include "CmdAnimate.h"
00029 #include "MoleculeList.h"
00030 #include "CommandQueue.h"
00031 #include "utilities.h"
00032 #include "Inform.h"
00033 #include "VMDApp.h"
00034 #include "CoorPluginData.h"
00035 
00036 // The following uses the Cmdtypes:
00037 //      ANIM_DIRECTION, ANIM_JUMP, ANIM_SKIP, ANIM_STYLE, ANIM_SPEED,
00038 //      ANIM_READ, ANIM_WRITE, ANIM_DELETE, ANIM_READ_DELETE_FILE
00039 
00040 
00041 void CmdAnimDir::create_text(void) {
00042   *cmdText << "animate ";
00043   if(newDir == Animation::ANIM_REVERSE)
00044     *cmdText << "reverse";
00045   else if(newDir == Animation::ANIM_REVERSE1)
00046     *cmdText << "prev";
00047   else if(newDir == Animation::ANIM_FORWARD)
00048     *cmdText << "forward";
00049   else if(newDir == Animation::ANIM_FORWARD1)
00050     *cmdText << "next";
00051   else if(newDir == Animation::ANIM_PAUSE)
00052     *cmdText << "pause";
00053   *cmdText << ends;
00054 }
00055 
00056 CmdAnimDir::CmdAnimDir(Animation::AnimDir ad)
00057   : Command(Command::ANIM_DIRECTION) {
00058   newDir = ad;
00059 }
00060 
00061 
00062 void CmdAnimStyle::create_text(void) {
00063   *cmdText << "animate style " << animationStyleName[newStyle] << ends;
00064 }
00065 
00066 CmdAnimStyle::CmdAnimStyle(Animation::AnimStyle as)
00067   : Command(Command::ANIM_STYLE) {
00068   newStyle = as;
00069 }
00070 
00071 void CmdAnimJump::create_text(void) {
00072   *cmdText << "animate goto " << newFrame << ends;
00073 }
00074 
00075 CmdAnimJump::CmdAnimJump(int newval)
00076   : Command(Command::ANIM_JUMP) {
00077   newFrame = newval;
00078 }
00079 
00080 void CmdAnimSkip::create_text(void) {
00081   *cmdText << "animate skip " << newSkip << ends;
00082 }
00083 
00084 CmdAnimSkip::CmdAnimSkip(int newval)
00085   : Command(Command::ANIM_SKIP) {
00086   newSkip = newval;
00087 }
00088 
00089 void CmdAnimSpeed::create_text(void) {
00090   *cmdText << "animate speed " << newSpeed << ends;
00091 }
00092 
00093 CmdAnimSpeed::CmdAnimSpeed(float newval)
00094   : Command(Command::ANIM_SPEED) {
00095   newSpeed = newval;
00096 }
00097 
00098 void CmdAnimWriteFile::create_text(void) {
00099   *cmdText << "animate write " << fileType << " {" << fileName << "}";
00100   *cmdText << " beg " << begFrame;
00101   *cmdText << " end " << endFrame;
00102   *cmdText << " skip " << frameSkip;
00103   if(whichMol >= 0)
00104     *cmdText << " " << whichMol;
00105   *cmdText << ends;
00106 }
00107 
00108 CmdAnimWriteFile::CmdAnimWriteFile(int m,const char *n,const char *t,
00109        int bf,int ef,int fs) 
00110 : Command(Command::ANIM_WRITE) {
00111   whichMol = m;
00112   fileType = stringdup(t);
00113   begFrame = bf;
00114   endFrame = ef;
00115   frameSkip = fs;
00116   fileName = stringdup(n);
00117 }
00118 
00119 CmdAnimWriteFile::~CmdAnimWriteFile(void) {
00120   delete [] fileName;
00121   delete [] fileType;
00122 }
00123 
00124 
00125 void CmdAnimDelete::create_text(void) {
00126   *cmdText << "animate delete ";
00127   if(begFrame < 0 && endFrame < 0 && frameSkip < 0) {
00128     *cmdText << "all";
00129   } else {
00130     *cmdText << " beg " << begFrame;
00131     *cmdText << " end " << endFrame;
00132     *cmdText << " skip " << frameSkip;
00133   }
00134   if(whichMol >= 0)
00135     *cmdText << " " << whichMol;
00136   *cmdText << ends;
00137 }
00138 
00139 CmdAnimDelete::CmdAnimDelete(int m, int bf, int ef, int fs) 
00140 : Command(Command::ANIM_DELETE) {
00141   whichMol = m;
00142   begFrame = bf;
00143   endFrame = ef;
00144   frameSkip = fs;
00145 }
00146 
00147 void CmdAnimDup::create_text(void)
00148 {
00149   *cmdText << "animate dup";
00150   if (whichFrame == -1) {
00151     *cmdText << " frame now";
00152   } else if (whichFrame < 0) {
00153     *cmdText << " frame null";
00154   } else {
00155     *cmdText << " frame " << whichFrame;
00156   }
00157   if (whichMol >= 0) {
00158     *cmdText << " " << whichMol;
00159   }
00160   *cmdText << ends;
00161 }
00162 CmdAnimDup::CmdAnimDup(int frame, int molid) 
00163 : Command(Command::ANIM_DUP) {
00164   whichFrame = frame;
00165   whichMol = molid;
00166 }
00167 

Generated on Wed Oct 9 02:41:59 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002