#include <gnuplotanim.h>
Public Member Functions | |
~GnuPlotAnim () | |
void | setGnuPlotAnim (string strPrefix, string strSufIn, string termOptions="") |
void | setFileSufix (string strSufix) |
void | NextScene () |
void | Draw () |
Static Public Member Functions | |
static GnuPlotAnim & | getGnuPlotAnim () |
Private Member Functions | |
GnuPlotAnim (string strPrefix="SCREEN", string strSufIn="png", string termOptions="") | |
Private Attributes | |
long | m_iScreen |
string | m_sufIn |
string | m_prefix |
string | m_terminal |
string | m_out |
int | m_iDelay |
Static Private Attributes | |
static GnuPlotAnim * | plotSingleton |
Definition at line 14 of file gnuplotanim.h.
GnuPlotAnim::GnuPlotAnim | ( | string | strPrefix = "SCREEN" , |
|
string | strSufIn = "png" , |
|||
string | termOptions = "" | |||
) | [private] |
Definition at line 10 of file gnuplotanim.cpp.
00011 { 00012 00013 char aux[100]; 00014 m_iScreen = 0; 00015 m_sufIn = strSufIn; 00016 m_prefix = strPrefix; 00017 00018 //configura terminal 00019 if (m_sufIn == "eps") 00020 { 00021 m_terminal = "postscript eps " + termOptions; 00022 m_terminal = "anim.eps"; 00023 } 00024 else if (m_sufIn == "png") 00025 { 00026 m_terminal = "png " + termOptions; 00027 m_out = "anim.mng"; 00028 } 00029 else if (m_sufIn == "pdf") 00030 m_terminal = "pdf " + termOptions; 00031 else if (m_sufIn == "jpg" || m_sufIn == "jpeg") 00032 { 00033 m_terminal = "jpeg " + termOptions; 00034 m_out = "anim.mpg"; 00035 m_sufIn = "jpeg"; 00036 } 00037 00038 sprintf(aux,"rm %s/*.%s ",m_dir.c_str(),m_sufIn.c_str()); 00039 runSystemCommand(aux); 00040 00041 fprintf(m_file,"set term %s;\n set output \"%s/%s%06ld.%s\";\n",m_terminal.c_str(),m_dir.c_str(),m_prefix.c_str(),m_iScreen++,m_sufIn.c_str()); 00042 m_iDelay = 20; 00043 }
GnuPlotAnim::~GnuPlotAnim | ( | ) |
Definition at line 135 of file gnuplotanim.cpp.
void GnuPlotAnim::Draw | ( | ) |
Reimplemented from GnuPlot.
Definition at line 101 of file gnuplotanim.cpp.
00102 { 00103 char str_aux[200]; 00104 00105 cout << "Gerando Animacao ... "<< endl; 00106 00107 GnuPlot::Draw(); 00108 00109 //runSystemCommand(str_aux); 00110 //sprintf(str_aux,"rm -f \"%s/%s%06ld.%s\" ;rm DAT* -f\n" ,m_dir.c_str(),m_prefix.c_str(),m_iScreen-1,m_sufIn.c_str()); 00111 if (m_sufIn == "png") 00112 { 00113 sprintf(str_aux,"convert -delay %d %s/*.%s %s/%s",m_iDelay,m_dir.c_str(),m_sufIn.c_str(),m_dir.c_str(),m_out.c_str()); 00114 runSystemCommand(str_aux); 00115 } 00116 else if (m_sufIn == "jpeg") 00117 { 00118 sprintf(str_aux,"convert -delay %d %s/*.%s %s/%s",m_iDelay,m_dir.c_str(),m_sufIn.c_str(),m_dir.c_str(),m_out.c_str()); 00119 runSystemCommand(str_aux); 00120 } 00121 else if (m_sufIn == "eps") 00122 { 00123 sprintf(str_aux,"epsmerge -o %s/%s %s/*.eps",m_dir.c_str(),m_out.c_str(),m_dir.c_str()); 00124 runSystemCommand(str_aux); 00125 } 00126 00127 00128 00129 cout << "done ! " << endl; 00130 00131 00132 }
GnuPlotAnim & GnuPlotAnim::getGnuPlotAnim | ( | ) | [static] |
Definition at line 140 of file gnuplotanim.cpp.
00141 { 00142 if (plotSingleton == NULL) 00143 { 00144 plotSingleton = new GnuPlotAnim("SCREEN","png","size 860,640"); 00145 } 00146 return *plotSingleton; 00147 }
void GnuPlotAnim::NextScene | ( | ) |
Reimplemented from GnuPlot.
Definition at line 85 of file gnuplotanim.cpp.
00086 { 00087 if (m_bPlot || m_bPlot3D) 00088 { 00089 m_bPlot = false; 00090 m_bPlot3D = false; 00091 fprintf(m_file,";\n"); 00092 fprintf(m_file,"set output \"%s/%s%06ld.%s\";\n",m_dir.c_str(),m_prefix.c_str(),m_iScreen++,m_sufIn.c_str()); 00093 } 00094 00095 else 00096 { 00097 fprintf(m_file,"set output \"%s/%s%06ld.%s\";\n",m_dir.c_str(),m_prefix.c_str(),m_iScreen++,m_sufIn.c_str()); 00098 //std::cerr <<"(GnuPlotAnim::NextScene) empty graph!!"; 00099 } 00100 }
void GnuPlotAnim::setFileSufix | ( | string | strSufix | ) | [inline] |
Definition at line 35 of file gnuplotanim.h.
00035 {m_sufIn=strSufix;}
void GnuPlotAnim::setGnuPlotAnim | ( | string | strPrefix, | |
string | strSufIn, | |||
string | termOptions = "" | |||
) |
Definition at line 45 of file gnuplotanim.cpp.
00046 { 00047 00048 char aux[100]; 00049 m_iScreen = 0; 00050 m_sufIn = strSufIn; 00051 m_prefix = strPrefix; 00052 00053 //configura terminal 00054 if (m_sufIn == "eps") 00055 { 00056 m_terminal = "postscript eps " + termOptions; 00057 m_out = "anim.eps"; 00058 } 00059 else if (m_sufIn == "png") 00060 { 00061 m_terminal = "png small " + termOptions; 00062 m_out = "anim.mng"; 00063 } 00064 else if (m_sufIn == "jpg" || m_sufIn == "jpeg") 00065 { 00066 m_terminal = "jpeg " + termOptions; 00067 m_out = "anim.mpg"; 00068 m_sufIn = "jpg"; 00069 } 00070 else 00071 { 00072 cout << "Invalid Format\nQuitting..." << endl; 00073 exit(0); 00074 } 00075 sprintf(aux,"rm %s/*.%s ",m_dir.c_str(),m_sufIn.c_str()); 00076 runSystemCommand(aux); 00077 00078 fprintf(m_file,"set term %s;\n set output \"%s/%s%06ld.%s\";\n",m_terminal.c_str(),m_dir.c_str(),m_prefix.c_str(),m_iScreen++,m_sufIn.c_str()); 00079 m_iDelay = 20; 00080 }
int GnuPlotAnim::m_iDelay [private] |
Definition at line 22 of file gnuplotanim.h.
long GnuPlotAnim::m_iScreen [private] |
Definition at line 17 of file gnuplotanim.h.
string GnuPlotAnim::m_out [private] |
Definition at line 21 of file gnuplotanim.h.
string GnuPlotAnim::m_prefix [private] |
Definition at line 19 of file gnuplotanim.h.
string GnuPlotAnim::m_sufIn [private] |
Definition at line 18 of file gnuplotanim.h.
string GnuPlotAnim::m_terminal [private] |
Definition at line 20 of file gnuplotanim.h.
GnuPlotAnim * GnuPlotAnim::plotSingleton [static, private] |
Definition at line 26 of file gnuplotanim.h.