// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : VisuGUI_TimeAnimation.cxx
{
theAnimator->generatePresentations(theFieldId);
FieldData& aFieldData = theAnimator->getFieldData(theFieldId);
-
-
+
+
int aRefFieldId = ( theAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) ? theFieldId : 0;
if(VISU::ColoredPrs3d_i* aInitialPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(theAnimator->getFieldData(aRefFieldId).myPrs[0])){
for (long aFrameId = 0; aFrameId < aFieldData.myNbFrames; aFrameId++) {
VISU::ColoredPrs3d_i* aColoredPrs3d = aFieldData.myPrs[aFrameId];
-
+
// Special case for DeformedShape And ScalarMap presentation
// Restore time stamp number for all presentations
VISU::DeformedShapeAndScalarMap_i* aDeformedAndScalPrs = dynamic_cast<VISU::DeformedShapeAndScalarMap_i*>(aColoredPrs3d);
int aTimeStampNum = -1;
if(aDeformedAndScalPrs){
aTimeStampNum = aDeformedAndScalPrs->GetScalarTimeStampNumber();
- }
+ }
aColoredPrs3d->SameAs(aInitialPrs3d);
-
+
if(aDeformedAndScalPrs){
aDeformedAndScalPrs->SetScalarField(aDeformedAndScalPrs->GetScalarEntity(),
aDeformedAndScalPrs->GetScalarFieldName(),
aTimeStampNum);
}
-
+
std::string aTitle = aColoredPrs3d->GetCTitle();
if ( aFrameId != 0 && theAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) {
aColoredPrs3d->SetTitle(aTitle.c_str());
myFieldLst->setCurrentRow(0);
}
-ArrangeDlg::ArrangeDlg(QWidget* theParent,
+ArrangeDlg::ArrangeDlg(QWidget* theParent,
const SalomeApp_Module* theModule,
SVTK_ViewWindow* theViewWindow)
: QDialog(theParent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
- myAnimator(NULL),
+ myAnimator(NULL),
myViewWindow(theViewWindow)
{
setModal( true );
QGroupBox* aBtnGB = new QGroupBox( this );
QHBoxLayout* aHBLay = new QHBoxLayout( aBtnGB );
aMainLayout->addWidget(aBtnGB);
-
+
QRadioButton* aAutoBtn = new QRadioButton("Auto", aBtnGB);
aHBLay->addWidget( aAutoBtn );
aBtnGrp->addButton(aAutoBtn, AutoMode);
// AUTO Pane
QWidget* aAutoPane = new QWidget(myStackWgt);
- QVBoxLayout* aAutoLay = new QVBoxLayout( aAutoPane );
+ QVBoxLayout* aAutoLay = new QVBoxLayout( aAutoPane );
aAutoLay->setSpacing(5);
// Axis Group
aHLay->addWidget( new QLabel("Relative Distance", aDistPane) );
myDistVal = new QtxDoubleSpinBox (-10,10, 0.5, aDistPane);
myDistVal->setValue(1);
- aHLay->addWidget( myDistVal );
+ aHLay->addWidget( myDistVal );
aAutoLay->addWidget( aDistPane );
//------------------------------------------------------------------------
//------------------------------------------------------------------------
SetupDlg::SetupDlg (QWidget* theParent,
- VisuGUI* theModule,
+ VisuGUI* theModule,
VISU_TimeAnimation* theAnimator) :
- QDialog(theParent,
+ QDialog(theParent,
Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
myAnimator(theAnimator),
myModule(theModule),
double aMaxTime = myAnimator->getMaxTime();
double aMinTime = myAnimator->getMinTime();
double aStep = 1;
- if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL )
+ if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL )
aStep = (aMaxTime - aMinTime) / (myAnimator->getFieldData(0).myNbTimes - 1);
else { // successive animation mode
std::pair<int,long> aLastFieldFrame(myAnimator->getNbFields() - 1,
aRangeLayout->addWidget(aMinLbl);
//myMinVal = new QtxDoubleSpinBox( aMinTime, aMaxTime, aStep, myUseRangeBox );
myMinVal = new QLineEdit(myUseRangeBox);
- myMinVal->setValidator(new QDoubleValidator(aMinTime, aMaxTime, VALPRECISION, myMinVal));
+ myMinVal->setValidator( new QDoubleValidator( myMinVal ) );
if (myUseRangeBox->isChecked())
myMinVal->setText( QString::number(myAnimator->getMinRange()) );
else
// connect(myMinVal, SIGNAL( valueChanged(double)),
// this, SLOT( onMinValue(double) ));
- connect(myMinVal, SIGNAL( editingFinished()),
- this, SLOT( onMinValue() ));
- connect(myMinVal, SIGNAL( textChanged(const QString&)),
- this, SLOT( onMinValueEdit(const QString&) ));
+ connect( myMinVal, SIGNAL( editingFinished() ), this, SLOT( onMinValue() ) );
+// connect( myMinVal, SIGNAL( textChanged(const QString&)),
+// this, SLOT( onMinValueEdit(const QString&) ));
aRangeLayout->addWidget(myMinVal);
QLabel* aMaxLbl = new QLabel("To", myUseRangeBox);
aRangeLayout->addWidget(aMaxLbl);
//myMaxVal = new QtxDoubleSpinBox( aMinTime, aMaxTime, aStep, myUseRangeBox );
myMaxVal = new QLineEdit(myUseRangeBox);
- myMaxVal->setValidator(new QDoubleValidator(aMinTime, aMaxTime, VALPRECISION, myMaxVal));
+ myMaxVal->setValidator( new QDoubleValidator( myMaxVal ) );
if (myUseRangeBox->isChecked())
myMaxVal->setText( QString::number(myAnimator->getMaxRange()) );
else {
}
// connect(myMaxVal, SIGNAL( valueChanged(double)),
// this, SLOT( onMaxValue(double) ));
- connect(myMaxVal, SIGNAL( editingFinished() ),
- this, SLOT( onMaxValue() ));
- connect(myMaxVal, SIGNAL( textChanged(const QString&)),
- this, SLOT( onMaxValueEdit(const QString&) ));
+ connect( myMaxVal, SIGNAL( editingFinished() ), this, SLOT( onMaxValue() ) );
+// connect(myMaxVal, SIGNAL( textChanged(const QString&)),
+// this, SLOT( onMaxValueEdit(const QString&) ));
aRangeLayout->addWidget(myMaxVal);
connect(myUseRangeBox, SIGNAL( toggled(bool)),
QGroupBox* aNamesBox = new QGroupBox("Fields",aPropFrame);
aHPropLayout->addWidget( aNamesBox );
QVBoxLayout* aVBoxLayout = new QVBoxLayout( aNamesBox );
-
+
myFieldLst = new QListWidget(aNamesBox);
aVBoxLayout->addWidget( myFieldLst );
QStringList aFieldNames;
}
}
myFieldLst->addItems(aFieldNames);
-
+
if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) {
myFieldLst->setCurrentRow(0);
connect( myFieldLst, SIGNAL( currentRowChanged(int) ),
}
else if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE )
myFieldLst->setSelectionMode(QAbstractItemView::NoSelection);
-
+
QWidget* aSetupBox = new QWidget(aPropFrame);
aHPropLayout->addWidget( aSetupBox );
aVBoxLayout = new QVBoxLayout( aSetupBox );
QGroupBox* aPropBox = new QGroupBox("Properties", aSetupBox);
aVBoxLayout->addWidget( aPropBox );
QVBoxLayout* aPropVBLay = new QVBoxLayout( aPropBox );
-
+
//QVGroupBox* aPropBox = new QVGroupBox("Properties", aPropFrame);
myTypeCombo = new QComboBox(aPropBox);
aPropVBLay->addWidget( myTypeCombo );
// this, SLOT( onScalarBarDlg() ) );
myPropBtn = new QPushButton("Properties...", aPropBox);
+ myPropBtn->setAutoDefault( false );
aPropVBLay->addWidget( myPropBtn );
// myPropBtn->setEnabled(myAnimator->getFieldData(0).myPrsType != VISU::TSCALARMAP);
connect( myPropBtn, SIGNAL( clicked() ),
QWidget* aBtnBox = new QWidget(this);
QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnBox);
aBtnLayout->setContentsMargins( 5, 5, 0, 5 );
- aBtnLayout->addStretch();
+ // aBtnLayout->addStretch();
- QPushButton* aCloseBtn = new QPushButton(tr("BUT_OK"), aBtnBox);
- aBtnLayout->addWidget( aCloseBtn );
- connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(onClose()));
+ QPushButton* closeBtn = new QPushButton( tr( "BUT_CLOSE" ), aBtnBox );
+ closeBtn->setAutoDefault( false );
+ aBtnLayout->addStretch();
+ aBtnLayout->addWidget( closeBtn );
+ connect( closeBtn, SIGNAL( clicked() ), this, SLOT( onClose() ) );
- aMainLayout->addWidget(aBtnBox);
+ aMainLayout->addWidget( aBtnBox );
}
//------------------------------------------------------------------------
FieldData& aData = myAnimator->getFieldData( 0 );
_PTR(SObject) aField = aData.myField;
- if(!aField) return;
+ if ( !aField )
+ return;
_PTR(ChildIterator) anIter = aStudy->NewChildIterator(aField);
anIter->Next(); // First is reference on support
//------------------------------------------------------------------------
void SetupDlg::onClose()
{
- if( !myUseRangeBox->isChecked() )
+ if ( !myUseRangeBox->isChecked() )
myAnimator->setAnimationRange( 0, 0 );
-
- if( !myUseSequenceBox->isChecked() )
+ else
+ {
+ double min = myMinVal->text().toDouble();
+ double max = myMaxVal->text().toDouble();
+ myAnimator->setAnimationRange( qMin( min, max ), qMax( min, max ) );
+ }
+
+ if ( !myUseSequenceBox->isChecked() )
myAnimator->setAnimationSequence( 0 );
-
+
close();
}
bool anEnableGP = false;
VISU::VISUType aPrsType;
if ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) { // parallel animation mode
-
+
FieldData& aData = myAnimator->getFieldData(theIndex);
_PTR(SObject) aSObject = aData.myField;
VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSObject);
long aNumComp = aRestoringMap["myNumComponent"].toLong();
anEnableItems = (aNumComp > 1);
-
+
long anEntityId = aRestoringMap["myEntityId"].toLong();
anEnableGP = (anEntityId == VISU::CELL);
}
else if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) { // successive animation mode
-
+
for (int i = 0; i < myAnimator->getNbFields(); i++) {
_PTR(SObject) aSO = myAnimator->getFieldData(i).myField;
VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aSO);
long aNumComp = aRestoringMap["myNumComponent"].toLong();
anEnableItems = (aNumComp > 1);
-
+
long anEntityId = aRestoringMap["myEntityId"].toLong();
anEnableGP = (anEntityId == VISU::CELL);
void SetupDlg::onTypeChanged (int theIndex)
{
int aType = myComboId2TypeId[theIndex];
-
+
for (int i = 0; i < myAnimator->getNbFields(); i++) {
FieldData& aData = ( myAnimator->getAnimationMode() == VISU::Animation::PARALLEL ) ?
myAnimator->getFieldData(myFieldLst->currentRow()) :
VISU::Animation::AnimationMode aMode = myAnimator->getAnimationMode();
int aRefFieldId = ( aMode == VISU::Animation::PARALLEL ) ? myFieldLst->currentRow() : 0;
FieldData& aData = myAnimator->getFieldData(aRefFieldId);
- if (aData.myPrs.empty())
+ if (aData.myPrs.empty())
myAnimator->generatePresentations(aRefFieldId);
if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) {
for (int i = 0; i < myAnimator->getNbFields(); i++) {
- if ( i != aRefFieldId && myAnimator->getFieldData(i).myPrs.empty() )
+ if ( i != aRefFieldId && myAnimator->getFieldData(i).myPrs.empty() )
myAnimator->generatePresentations(i);
}
}
aTimeStampNum);
}
-
+
if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE ) {
for (int aFieldId = 1; aFieldId < myAnimator->getNbFields(); aFieldId++) {
FieldData& aFieldData = myAnimator->getFieldData(aFieldId);
}
}
- }
+ }
}
delete aDlg;
}
}
//------------------------------------------------------------------------
-void SetupDlg::onMinValue ()
+void SetupDlg::onMinValue()
{
double aVal = myMinVal->text().toDouble();
- if (aVal > myAnimator->getMaxRange()) {
- myMinVal->setText( QString::number(myAnimator->getMinTime()) );
- myMinVal->setFocus();
- return;
- }
- myAnimator->setAnimationRange(aVal, myAnimator->getMaxRange());
+ aVal = qMax( qMin( aVal, myAnimator->getMaxRange() ), myAnimator->getMinTime() );
+ myAnimator->setAnimationRange( aVal, myAnimator->getMaxRange() );
+ myMinVal->setText( QString::number( aVal ) );
+ myMinVal->setFocus();
setIsRegenerate( true );
}
//------------------------------------------------------------------------
-void SetupDlg::onMaxValue ()
+void SetupDlg::onMaxValue()
{
double aVal = myMaxVal->text().toDouble();
- if (aVal < myAnimator->getMinRange()) {
- myMaxVal->setText( QString::number(myAnimator->getMaxTime()) );
- myMaxVal->setFocus();
- return;
- }
- myAnimator->setAnimationRange(myAnimator->getMinRange(), aVal);
+ aVal = qMin( qMax( aVal, myAnimator->getMinRange() ), myAnimator->getMaxTime() );
+ myAnimator->setAnimationRange( myAnimator->getMinRange(), aVal );
+ myMaxVal->setText( QString::number( aVal ) );
+ myMaxVal->setFocus();
setIsRegenerate( true );
}
+
//------------------------------------------------------------------------
void SetupDlg::onMinValueEdit (const QString& theVal)
{
if ((aVal > myAnimator->getMaxRange()) || (aVal < myAnimator->getMinRange())) {
myMaxVal->setText( QString::number(myAnimator->getMaxTime()) );
myMaxVal->setFocus();
- }
+ }
}
//------------------------------------------------------------------------
myIndices->setPalette(palette);
return;
}
-
+
palette.setColor(myIndices->foregroundRole(), Qt::black);
myIndices->setPalette(palette);
QPalette palette = myIndices->palette();
palette.setColor(myIndices->foregroundRole(), Qt::black);
myIndices->setPalette(palette);
-
+
myIndices->setText( anIndices );
myIndices->blockSignals( false );
VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule,
- _PTR(Study) theStudy,
+ _PTR(Study) theStudy,
VISU::Animation::AnimationMode theMode) :
- QDialog(VISU::GetDesktop(theModule),
+ QDialog(VISU::GetDesktop(theModule),
Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
myModule(theModule),
mySetupDlg(NULL)
if (mySaveCheck->isChecked()) {
onPicsFormatChanged();
onPathChanged();
-
+
} else if (mySaveAVICheck->isChecked()) {
myAnimator->setDumpFormat("AVI");
myAnimator->dumpTo(myPathAVIEdit->text().toLatin1().data());
//------------------------------------------------------------------------
void VisuGUI_TimeAnimationDlg::onSetupDlg()
{
- if (myAnimator->getNbFrames() > 0)
+ if (myAnimator->getNbFrames() > 0)
myAnimator->firstFrame();
mySetupDlg->exec();
myPlayFrame->setEnabled(false);
QString aDir;
if (myPathEdit->text().isEmpty())
aDir = getenv("HOME");
- else
+ else
aDir = myPathEdit->text();
QString aPath = SUIT_FileDlg::getExistingDirectory(this, aDir, "Select path");
if (!aPath.isEmpty())
{
myAnimator->restoreFromStudy(theAnimation);
mySaveBtn->setEnabled(myAnimator->isSavedInStudy());
- if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE )
+ if ( myAnimator->getAnimationMode() == VISU::Animation::SUCCESSIVE )
setWindowTitle(tr("SUCCESSIVE_ANIMATION"));
}