From fc2c25a88ec3db9f4762d3b07a2c94ea865983fa Mon Sep 17 00:00:00 2001 From: epa Date: Tue, 17 Oct 2006 05:54:12 +0000 Subject: [PATCH] PAL13174 - EDF226 VISU: Sweep improvement --- src/VISUGUI/VISU_msg_en.po | 18 ++++++++++++++++++ src/VISUGUI/VisuGUI.cxx | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index eebc49c8..2cc01cee 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -147,6 +147,24 @@ msgstr "Max:" msgid "VISU_SWEEPING_PREF" msgstr "Sweeping preferences" +msgid "VISU_LINEAR_SWEEP" +msgstr "Linear" + +msgid "VISU_U_SWEEP" +msgstr "Periodic" + +msgid "VISU_SWEEPING_MODES" +msgstr "Mode of the sweeping " + +msgid "VISU_IS2PI" +msgstr "Parameter varies:" + +msgid "PERIOD_2PI" +msgstr "From -PI to PI" + +msgid "PERIOD_PI" +msgstr "From 0 to PI" + msgid "VISU_TIME_STEP" msgstr "Time step(second)" diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 8266ce94..64573fb3 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -1608,12 +1608,24 @@ OnSweep() int aCycles = aResourceMgr->integerValue("VISU", "sweeping_number_cycles", 1); int aSteps = aResourceMgr->integerValue("VISU", "sweeping_number_steps", 40); + int aMode = aResourceMgr->integerValue("VISU", "sweeping_modes", 0); + + int is2Pi = aResourceMgr->integerValue("VISU", "sweeping_is2PI", 0); + // Sweep QApplication::setOverrideCursor(Qt::waitCursor); + for (int j = 0; j < aCycles; j++) { for (int i = 0; i <= aSteps; i++) { try { - float aPercents = float(i)/aSteps; + float aPercents; + if( aMode == 1 ){ //if selected Periodic mode of sweeping + float aT = ( is2Pi == 1 ? -PI + 2. * PI * float(i)/aSteps : PI * float(i)/aSteps ); + //This is necessary in order for animation to retrun to the initial picture + aPercents = (1.+sin( aT - PI/2. ))/2.; + } + else //if selected Linear mode of sweeping + aPercents = float(i)/aSteps; aPrsObject->SetMapScale(aPercents); aPrsObject->UpdateActor(aActor); vw->getRenderWindow()->Render(); @@ -3026,6 +3038,16 @@ void VisuGUI::createPreferences() // group: "Sweeping preferences" int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab ); setPreferenceProperty( sweepGr, "columns", 1 ); + + int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGr, LightApp_Preferences::Selector, "VISU", "sweeping_modes" ); + QStringList sweep_modes; + sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) ); + sweep_modes.append( tr( "VISU_U_SWEEP" ) ); + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + setPreferenceProperty( modeSw, "strings", sweep_modes ); + setPreferenceProperty( modeSw, "indexes", indices ); int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr, LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" ); @@ -3033,11 +3055,21 @@ void VisuGUI::createPreferences() LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" ); int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr, LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" ); + int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGr, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" ); + QStringList ranges; + ranges.append( tr( "PERIOD_PI" ) ); + ranges.append( tr( "PERIOD_2PI" ) ); + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + setPreferenceProperty( rangeSw, "strings", ranges ); + setPreferenceProperty( rangeSw, "indexes", indices ); + setPreferenceProperty( timestep, "min", 0.1 ); setPreferenceProperty( timestep, "step", 0.1 ); setPreferenceProperty( timestep, "max", 1000 ); setPreferenceProperty( nbcycles, "max", 100 ); - setPreferenceProperty( nbsteps, "max", 200 ); + setPreferenceProperty( nbsteps, "max", 200 ); // group: "MED files import" int importGr = addPreference( tr( "MED files import" ), srangeTab ); -- 2.39.2