void VisuGUI::createPreferences()
{
+ // TAB: "MED import"
+ int importTab = addPreference( tr( "MED import" ) );
+
+ // group: "MED files import"
+ int importGr = addPreference( tr( "MED files import" ), importTab );
+ setPreferenceProperty( importGr, "columns", 1 );
+ addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
+ addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
+ addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
+ addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
+ addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
+ addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
+ addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
+
// TAB: "Scalar Bar"
int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
int scalarBarGr = addPreference( tr( "Scalar bars default position" ), sbarTab );
addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
- int srangeTab = addPreference( tr( "Sweep, MED import" ) );
+ // TAB: "CutLines"
+ int cutLineTab = addPreference( tr( "CutLines" ) );
+
+ // group: "CutLines preferences"
+ int cutLineGr = addPreference( tr( "VISU_CUTLINE_PREF" ), cutLineTab );
+ setPreferenceProperty( cutLineGr, "columns", 1 );
+ addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
+ addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
+ addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
+ addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
+ addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
+ // TAB: "Sweep, Animation"
+ int srangeTab = addPreference( tr( "Sweep, Animation" ) );
+
// group: "Sweeping preferences"
int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab );
setPreferenceProperty( sweepGr, "columns", 1 );
setPreferenceProperty( nbcycles, "max", 100 );
setPreferenceProperty( nbsteps, "max", 200 );
- // group: "CutLines preferences"
- int cutLineTab = addPreference( tr( "CutLines" ) );
- int cutLineGr = addPreference( tr( "VISU_CUTLINE_PREF" ), cutLineTab );
- setPreferenceProperty( cutLineGr, "columns", 1 );
- addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
- addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
- addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
- addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
- addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
+ // group: "Animation preferences"
+ int animationGr = addPreference( tr( "Animation preferences" ), srangeTab );
+ setPreferenceProperty( animationGr, "columns", 1 );
- // group: "MED files import"
- int importGr = addPreference( tr( "MED files import" ), srangeTab );
- setPreferenceProperty( importGr, "columns", 1 );
- addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
- addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
- addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
- addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
- addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
- addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
- addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
+ int speed = addPreference( tr( "Speed" ), animationGr, LightApp_Preferences::IntSpin, "VISU", "speed" );
+ addPreference( tr( "Cycled animation" ), animationGr, LightApp_Preferences::Bool, "VISU", "cycled_animation" );
+ addPreference( tr( "Use proportional timing" ), animationGr, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
+ addPreference( tr( "Clean memory at each frame" ), animationGr, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
+
+ setPreferenceProperty( speed, "min", 1 );
+ setPreferenceProperty( speed, "max", 99 );
// TAB: Representation ; group: "Representation properties"
int representationTab = addPreference( tr( "Representation" ) );
myStudy = theStudy;
myIsActive = false;
myFrame = 0;
- mySpeed = 1;
- myProportional = false;
+ mySpeed = VISU::GetResourceMgr()->integerValue("VISU", "speed", 1);
+ myProportional = VISU::GetResourceMgr()->booleanValue("VISU", "use_proportional_timing", false);
myView = 0;
if (!CORBA::is_nil(theView3D)) {
myTimeMin = 0;
myTimeMax = 0;
myLastError = "";
- myCycling = false;
- myCleaningMemoryAtEachFrame = false;
+ myCycling = VISU::GetResourceMgr()->booleanValue("VISU", "cycled_animation", false);
+ myCleaningMemoryAtEachFrame = VISU::GetResourceMgr()->booleanValue("VISU", "clean_memory_at_each_frame", false);
myAnimEntry = "";
}
myFrame = 0;
myLastError += QString(" timestamp(s) cannot be created.");
- emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
+ myFrame, myFieldsLst[0].myTiming[myFrame]));
myView->Repaint();
return aNoError;
}
}
//------------------------------------------------------------------------
-void VISU_TimeAnimation::visibilityOff(int num_field, int num_frame) {
+void VISU_TimeAnimation::_visibilityOff(int num_field, int num_frame) {
FieldData& aData = myFieldsLst[num_field];
VISU_Actor* aActor = aData.myActors[num_frame];
if (! myCleaningMemoryAtEachFrame) {
//
// Delete the actor
aActor->RemoveFromRender(myView->getRenderer());
- //aActor->Delete();
// Re-create the actor
aActor = aData.myPrs[num_frame]->CreateActor();
myView->AddActor(aActor);
}
}
+//------------------------------------------------------------------------
+void VISU_TimeAnimation::visibilityOff(int num_field, int num_frame)
+{
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,int,int>
+ (this,&VISU_TimeAnimation::_visibilityOff,num_field,num_frame));
+}
+
//------------------------------------------------------------------------
void VISU_TimeAnimation::_stopAnimation() {
myIsActive = false;
int i;
for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
- //myFieldsLst[i].myActors[myFrame]->VisibilityOff();
visibilityOff(i, myFrame);
myFrame++;
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOn();
- emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
+ myFrame, myFieldsLst[0].myTiming[myFrame]));
myView->Repaint();
}
}
int i;
for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
- //myFieldsLst[i].myActors[myFrame]->VisibilityOff();
visibilityOff(i, myFrame);
myFrame--;
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOn();
- emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
+ myFrame, myFieldsLst[0].myTiming[myFrame]));
myView->Repaint();
}
}
for (i = 0; i < getNbFields(); i++)
if(!myFieldsLst[i].myActors.empty())
if (myFieldsLst[i].myActors[myFrame] != 0)
- //myFieldsLst[i].myActors[myFrame]->VisibilityOff();
visibilityOff(i, myFrame);
myFrame = 0;
for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOn();
if(!myFieldsLst[0].myTiming.empty()){
- emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
+ myFrame, myFieldsLst[0].myTiming[myFrame]));
myView->Repaint();
}
}
int i;
for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
- //myFieldsLst[i].myActors[myFrame]->VisibilityOff();
visibilityOff(i, myFrame);
myFrame = myFieldsLst[0].myNbFrames-1;
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOn();
- emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
+ myFrame, myFieldsLst[0].myTiming[myFrame]));
myView->Repaint();
}
if ((theFrame < 0) || (theFrame > (getNbFrames()-1)))
return;
stopAnimation();
- //qApp->lock();
- //qApp->syncX();
int i;
for (i = 0; i < getNbFields(); i++)
if (myFieldsLst[i].myActors[myFrame] != 0)
- //myFieldsLst[i].myActors[myFrame]->VisibilityOff();
visibilityOff(i, myFrame);
myFrame = theFrame;
if (myFieldsLst[i].myActors[myFrame] != 0)
myFieldsLst[i].myActors[myFrame]->VisibilityOn();
- emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
+ myFrame, myFieldsLst[0].myTiming[myFrame]));
myView->Repaint();
- //qApp->flushX();
- //qApp->processEvents(3);
- //qApp->unlock();
}
//------------------------------------------------------------------------
(this,&VISU_TimeAnimation::_gotoFrame,theFrame));
}
+//------------------------------------------------------------------------
+void VISU_TimeAnimation::_emitFrameChanged(long theNewFrame, double theTime)
+{
+ emit frameChanged(theNewFrame, theTime);
+}
+
+//------------------------------------------------------------------------
+void VISU_TimeAnimation::_emitStopped()
+{
+ emit stopped();
+}
//------------------------------------------------------------------------
VISU::ColoredPrs3d_ptr VISU_TimeAnimation::getPresentation(CORBA::Long theField, CORBA::Long theFrame) {
int aNbFiles = 0;
QValueList<int> anIndexList;
- qApp->lock();
while (myIsActive) {
- emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]);
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<VISU_TimeAnimation,long,double>(this, &VISU_TimeAnimation::_emitFrameChanged,
+ myFrame, myFieldsLst[0].myTiming[myFrame]));
if(!(myFieldsLst[0].myField))
break;
for (int i = 0; i < getNbFields(); i++) {
FieldData& aData = myFieldsLst[i];
if (myFrame > 0) {
if (aData.myActors[myFrame-1] != 0)
- //aData.myActors[myFrame-1]->VisibilityOff();
visibilityOff(i, myFrame-1);
} else {
if (aData.myActors[aData.myNbFrames-1] != 0)
- //aData.myActors[aData.myNbFrames-1]->VisibilityOff();
visibilityOff(i, aData.myNbFrames-1);
}
if (aData.myActors[myFrame] != 0) {
- aData.myActors[myFrame]->VisibilityOn();
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_Actor>(aData.myActors[myFrame],
+ &VISU_Actor::VisibilityOn));
}
}
- myView->Repaint(false);
+ bool repainArg = false;
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<SVTK_ViewWindow,bool>(myView,
+ &SVTK_ViewWindow::Repaint,
+ repainArg));
k = 1;
if (myProportional) {
// We must unlock mutex for some time before grabbing to allow view updating
delay = 1;
}
- qApp->unlock();
msleep(delay);
if (!myIsActive) {
- emit stopped();
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(this,&VISU_TimeAnimation::_emitStopped));
return;
}
- qApp->lock();
if (isDumping) {
// We must unlock mutex for some time before grabbing to allow view updating
- qApp->unlock();
msleep(delay);
if (!myIsActive) { // this check was taken from WP_DEB branch
- emit stopped();
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(this,&VISU_TimeAnimation::_emitStopped));
return;
}
- qApp->lock();
if(!(myFieldsLst[0].myField)) // break, if field was deleted.
break;
if (myDumpFormat.compare("AVI") != 0) {
aFile += aName;
aFile += ".";
aFile += myDumpFormat.lower();
- myView->dumpViewToFormat(aFile,myDumpFormat);
+ ProcessEvent(new TMemFun2ArgEvent<SVTK_ViewWindow,bool,const QString&,const QString&>
+ (myView,&SVTK_ViewWindow::dumpViewToFormat,aFile,myDumpFormat));
} else {
QFileInfo aFileInfo(myDumpPath);
QString aDirPath = aFileInfo.dirPath(true);
myView->dumpViewToFormat(aFile,"JPEG");
*/
SUIT_ViewWindow* aView = myView;
- QImage img = aView->dumpView();
+ QImage img = ProcessEvent(new TMemFunEvent<SUIT_ViewWindow,QImage>(aView,&SUIT_ViewWindow::dumpView));
if (!img.isNull()) {
int width = img.width(); width = (width/16)*16;
int height = img.height(); height = (height/16)*16;
system(aCmd.latin1());
}
- emit stopped();
- qApp->unlock();
+ ProcessVoidEvent(new TVoidMemFunEvent<VISU_TimeAnimation>(this,&VISU_TimeAnimation::_emitStopped));
QThread::exit();
}