your animation with proportional periods of time between every frame
(not depending on the time stamps).
<br><br>
+<b>Time stamp frequency</b> spin box: this option is available if
+<b>Save animation to AVI file</b> mode is turned on. It provides a
+possibility to capture only timestamps with indices divisable by the
+specified frequency, that allows to generate less voluminous films.
+<br><br>
<b>Clean memory at each frame</b> - this option allows to optimize the
performance of the operation.
*/
string setDumpFormat(in string theFormat);
+ /*! Set frequency of timestamps used to generate AVI file.
+ * \param theFrequency The frequency of timestamps to use.
+ */
+ void setTimeStampFrequency(in long theFrequency);
+
+ /*! Get frequency of timestamps used to generate AVI file.
+ * \return The frequency of timestamps to use.
+ */
+ long getTimeStampFrequency();
+
/*! Returns True, if the playback of the animation is cycling.
*/
boolean isCycling();
<parameter name="cycled_animation" value="false"/>
<parameter name="use_proportional_timing" value="false"/>
<parameter name="clean_memory_at_each_frame" value="false"/>
+ <parameter name="dump_mode" value="0"/>
+ <parameter name="time_stamp_frequency" value="1"/>
<parameter name="mouse_behaviour" value="0" />
<parameter name="speed_increment" value="10" />
<parameter name="spacemouse_func1_btn" value="1" />
<source>VISU_DISP_ONLY</source>
<translation>Display only on creation</translation>
</message>
+ <message>
+ <source>VISU_DUMP_MODE</source>
+ <translation>Dump mode</translation>
+ </message>
+ <message>
+ <source>VISU_DUMP_PICTURES</source>
+ <translation>Save pictures to directory</translation>
+ </message>
+ <message>
+ <source>VISU_DUMP_VIDEO</source>
+ <translation>Save animation to AVI file</translation>
+ </message>
<message>
<source>VISU_EDGE_COLOR</source>
<translation>Edge Color</translation>
<source>VISU_NB_STEPS</source>
<translation>Number of steps</translation>
</message>
+ <message>
+ <source>VISU_NO_DUMP</source>
+ <translation>No dump</translation>
+ </message>
<message>
<source>VISU_ORIENTATION</source>
<translation>Orientation</translation>
<source>VISU_SWEEPING_PREF</source>
<translation>Sweeping preferences</translation>
</message>
+ <message>
+ <source>VISU_TIME_STAMP_FREQUENCY</source>
+ <translation>Time stamp frequency (for AVI generation)</translation>
+ </message>
<message>
<source>VISU_TIME_STEP</source>
<translation>Time step(second)</translation>
// group: "Animation preferences"
{
int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
- setPreferenceProperty( animationGroup, "columns", 3 );
+ setPreferenceProperty( animationGroup, "columns", 1 );
int speed = addPreference( tr( "Speed" ), animationGroup,
LightApp_Preferences::IntSpin, "VISU", "speed" );
setPreferenceProperty( speed, "min", 1 );
setPreferenceProperty( speed, "max", 99 );
+
+ int dump_mode = addPreference( tr( "VISU_DUMP_MODE" ), animationGroup,
+ LightApp_Preferences::Selector, "VISU", "dump_mode" );
+
+ modes.clear();
+ modes.append( tr( "VISU_NO_DUMP" ) );
+ modes.append( tr( "VISU_DUMP_PICTURES" ) );
+ modes.append( tr( "VISU_DUMP_VIDEO" ) );
+ setPreferenceProperty( dump_mode, "strings", modes );
+
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ indices.append( 2 );
+ setPreferenceProperty( dump_mode, "indexes", indices );
+
+ int time_stamp_frequency = addPreference( tr( "VISU_TIME_STAMP_FREQUENCY" ), animationGroup,
+ LightApp_Preferences::IntSpin, "VISU", "time_stamp_frequency" );
+ setPreferenceProperty( time_stamp_frequency, "min", 1 );
+ setPreferenceProperty( time_stamp_frequency, "max", 100 );
}
// group: "Sweeping preferences"
#include <QGroupBox>
#include <QPushButton>
#include <QLabel>
+#include <QSpinBox>
#include <qwt_wheel.h>
this, SLOT( onBrowseAVI() ));
aSaveLay->addWidget(myBrowseAVIBtn, 4, 2);
+ myFrequencyLbl = new QLabel("Time stamp frequency:", aSaveBox);
+ myFrequencyLbl->setEnabled(false);
+ aSaveLay->addWidget(myFrequencyLbl, 5, 0, 1, 2);
+
+ myFrequencySpin = new QSpinBox(aSaveBox);
+ myFrequencySpin->setRange(1, 100);
+ myFrequencySpin->setValue(myAnimator->getTimeStampFrequency());
+ myFrequencySpin->setEnabled(false);
+ aSaveLay->addWidget(myFrequencySpin, 5, 2);
+
mySaveAVICheck->setChecked(false);
//mySaveAVICheck->setEnabled(myAnimator->checkAVIMaker());
+ int aDumpMode = myAnimator->getDumpMode();
+ if(aDumpMode == VISU_TimeAnimation::DM_Picture)
+ mySaveCheck->setChecked(true);
+ else if(aDumpMode == VISU_TimeAnimation::DM_Video && myAnimator->checkAVIMaker())
+ mySaveAVICheck->setChecked(true);
+
TopLayout->addWidget(aSaveBox, 7, 0, 1, 4);
QCheckBox* aCleanMemCheck = new QCheckBox("Clean memory at each frame",myPlayFrame);
} else if (mySaveAVICheck->isChecked()) {
myAnimator->setDumpFormat("AVI");
myAnimator->dumpTo(myPathAVIEdit->text().toLatin1().data());
+ myAnimator->setTimeStampFrequency(myFrequencySpin->value());
} else {
myAnimator->dumpTo("");
}
myPathAVILbl->setEnabled(true);
myPathAVIEdit->setEnabled(true);
myBrowseAVIBtn->setEnabled(true);
+ myFrequencyLbl->setEnabled(true);
+ myFrequencySpin->setEnabled(true);
}
}
else {
myPathAVILbl->setEnabled(false);
myPathAVIEdit->setEnabled(false);
myBrowseAVIBtn->setEnabled(false);
+ myFrequencyLbl->setEnabled(false);
+ myFrequencySpin->setEnabled(false);
}
mySaveCheck->setEnabled(!mySaveAVICheck->isChecked());
}
class QComboBox;
class QGroupBox;
class QToolButton;
+class QSpinBox;
/*!
* Auxilliary class for presentations definition
QLineEdit* myPathAVIEdit;
QLabel* myPathAVILbl;
QPushButton* myBrowseAVIBtn;
+ QLabel* myFrequencyLbl;
+ QSpinBox* myFrequencySpin;
QPushButton* myPublishBtn;
QPushButton* mySaveBtn;
myDumpPath = "";
myAVIMaker = "jpeg2yuv";
+
+ myDumpMode = VISU::GetResourceMgr()->integerValue("VISU", "dump_mode", 0);
+ myTimeStampFrequency = VISU::GetResourceMgr()->integerValue("VISU", "time_stamp_frequency", 1);
}
QString aDirPath = aFileInfo.absolutePath();
QString aBaseName = aFileInfo.fileName();
+ if( myTimeStampFrequency > 1 && myFrame % myTimeStampFrequency != 0 )
+ return;
+
switch (myFrame) {
case 0:
break;
// make AVI file if need
if (isDumping && myDumpFormat.compare("AVI") == 0 && myExecutionState->IsActive()) {
- double aFPS = 17.3 * mySpeed;
+ double aFPS = 17.3 * mySpeed / myTimeStampFrequency;
QFileInfo aFileInfo(myDumpPath);
QString aDirPath = aFileInfo.absolutePath();
return myDumpFormat.toLatin1().data();
}
+//------------------------------------------------------------------------
+void VISU_TimeAnimation::setTimeStampFrequency(CORBA::Long theFrequency)
+{
+ myTimeStampFrequency = theFrequency;
+}
+
//------------------------------------------------------------------------
bool VISU_TimeAnimation::checkAVIMaker() const
{
return CORBA::string_dup(aDumpFormat.c_str());
}
+void VISU_TimeAnimation_i::setTimeStampFrequency(CORBA::Long theFrequency)
+{
+ myAnim->setTimeStampFrequency(theFrequency);
+}
+
+CORBA::Long VISU_TimeAnimation_i::getTimeStampFrequency()
+{
+ return myAnim->getTimeStampFrequency();
+}
+
CORBA::Boolean VISU_TimeAnimation_i::isCycling()
{
return myAnim->isCycling();
{
Q_OBJECT;
+ public:
+ enum DumpMode { DM_None = 0, DM_Picture, DM_Video };
+
protected:
CORBA::Boolean _generateFrames();
void _connectView();
void dumpTo(const char* thePath) { myDumpPath = thePath; }
std::string setDumpFormat(const char* theFormat);
+
+ void setTimeStampFrequency(CORBA::Long theFrequency);
+ CORBA::Long getTimeStampFrequency() { return myTimeStampFrequency; }
+
+ int getDumpMode() const { return myDumpMode; }
+
bool checkAVIMaker() const;
QString getLastErrorMsg() { return myLastError; }
long myFileIndex;
SVTK_ViewWindow* myView;
+ int myDumpMode;
+ int myTimeStampFrequency;
+
QString myAnimEntry;
static int myNBAnimations;
virtual void dumpTo(const char* thePath);
virtual char* setDumpFormat(const char* theFormat);
+ virtual void setTimeStampFrequency(CORBA::Long theFrequency);
+ virtual CORBA::Long getTimeStampFrequency();
+
virtual CORBA::Boolean isCycling();
virtual CORBA::Boolean isCleaningMemoryAtEachFrame();