VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
: VisuGUI_ScalarBarBaseDlg(theModule),
- myVisuGUI(theModule)
+ myVisuGUI(theModule),
+ myStatus(false)
{
setWindowTitle(tr("DLG_TITLE"));
setSizeGripEnabled(TRUE);
std::numeric_limits<double>::min(),
std::numeric_limits<double>::max(),
.1,
- "parametric_precision" );
+ "parametric_precision" );
myStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
TopLayout->addWidget(myStepLen, 1, 1);
connect(myStepLen, SIGNAL(valueChanged(double)), this, SLOT(StepLengthChanged(double)));
}
int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
-{
- if(!myInputPane->check() || !GetScalarPane()->check())
- return 0;
-
- int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
- anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
-
- if (anIsOk) {
- myPrsCopy->ShowColored(myUseScalar->isChecked());
- if (!myPrsCopy->IsColored()) {
- SALOMEDS::Color aColor;
- aColor.R = SelColor->color().red()/255.;
- aColor.G = SelColor->color().green()/255.;
- aColor.B = SelColor->color().blue()/255.;
- myPrsCopy->SetColor(aColor);
- }
-
- VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH;
- switch (myDirCombo->currentIndex()) {
- case 0:
- aDirection = VISU::StreamLines::FORWARD;
- break;
- case 1:
- aDirection = VISU::StreamLines::BACKWARD;
- break;
- case 2:
- aDirection = VISU::StreamLines::BOTH;
- }
-
- VISU::Prs3d_var aPrs;
- int aSrcSelection = myUseSrcCombo->currentIndex();
- int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentIndex() : -1;
- if ((aSrcSelection > 0) && (aSrcItem > -1)) {
- VISU::VISUType aType;
- QString aName;
- switch (aSrcSelection) {
- case 1: // Entity
- aPrs = myEntityList[aSrcItem];
- aType = VISU::TENTITY;
- aName = myEntitiesLst[aSrcItem];
- break;
- case 2: // Family
- aPrs = myFamilyList[aSrcItem];
- aType = VISU::TFAMILY;
- aName = myFamilisLst[aSrcItem];
- break;
- case 3: // Group
- aPrs = myGroupList[aSrcItem];
- aType = VISU::TGROUP;
- aName = myGroupsLst[aSrcItem];
- break;
- case 4: // Presentation
- aPrs = myPrsList[aSrcItem];
- break;
- }
- if (CORBA::is_nil(aPrs) && aSrcSelection != 4) {
- aPrs = createMesh(aType, aName);
- }
- }
- anIsOk &= myPrsCopy->SetParams(myIntegStepLen->value(),
- myPropTime->value(),
- myStepLen->value(),
- aPrs,
- myPntPercent->value(),
- aDirection);
- }
-
+{
VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(myPrsCopy, thePrs);
-
- return anIsOk;
+ return myStatus;
}
/*!
}
+void VisuGUI_StreamLinesDlg::storeToPrsCopy() {
+
+ if(!myInputPane->check() || !GetScalarPane()->check()) {
+ myStatus = false;
+ return;
+ }
+
+ myStatus = myInputPane->storeToPrsObject( myPrsCopy );
+ myStatus &= GetScalarPane()->storeToPrsObject( myPrsCopy );
+
+ if (myStatus) {
+ myPrsCopy->ShowColored(myUseScalar->isChecked());
+ if (!myPrsCopy->IsColored()) {
+ SALOMEDS::Color aColor;
+ aColor.R = SelColor->color().red()/255.;
+ aColor.G = SelColor->color().green()/255.;
+ aColor.B = SelColor->color().blue()/255.;
+ myPrsCopy->SetColor(aColor);
+ }
+
+ VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH;
+ switch (myDirCombo->currentIndex()) {
+ case 0:
+ aDirection = VISU::StreamLines::FORWARD;
+ break;
+ case 1:
+ aDirection = VISU::StreamLines::BACKWARD;
+ break;
+ case 2:
+ aDirection = VISU::StreamLines::BOTH;
+ }
+
+ VISU::Prs3d_var aPrs;
+ int aSrcSelection = myUseSrcCombo->currentIndex();
+ int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentIndex() : -1;
+ if ((aSrcSelection > 0) && (aSrcItem > -1)) {
+ VISU::VISUType aType;
+ QString aName;
+ switch (aSrcSelection) {
+ case 1: // Entity
+ aPrs = myEntityList[aSrcItem];
+ aType = VISU::TENTITY;
+ aName = myEntitiesLst[aSrcItem];
+ break;
+ case 2: // Family
+ aPrs = myFamilyList[aSrcItem];
+ aType = VISU::TFAMILY;
+ aName = myFamilisLst[aSrcItem];
+ break;
+ case 3: // Group
+ aPrs = myGroupList[aSrcItem];
+ aType = VISU::TGROUP;
+ aName = myGroupsLst[aSrcItem];
+ break;
+ case 4: // Presentation
+ aPrs = myPrsList[aSrcItem];
+ break;
+ }
+ if (CORBA::is_nil(aPrs) && aSrcSelection != 4) {
+ aPrs = createMesh(aType, aName);
+ }
+ }
+ myStatus &= myPrsCopy->SetParams(myIntegStepLen->value(),
+ myPropTime->value(),
+ myStepLen->value(),
+ aPrs,
+ myPntPercent->value(),
+ aDirection);
+ }
+}
+
+
VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QString theName)
{
return VISU::Mesh::_nil();
void VisuGUI_StreamLinesDlg::accept()
{
+
+ //rnv: To fix the IPAL21920: WinTC5.1.4: parameters of StreamLines are not taken in account.
+ //rnv: Show confirmation message in case if 'Used points' and 'Step length' were re-calculated.
+ //1. Store parameters to the myPrsCopy
+ storeToPrsCopy();
+
+ //2. Check 'Used points' and 'Step length' parameters
+ if( myStepLen->value() > myPrsCopy->GetStepLength() ||
+ myPntPercent->value() > myPrsCopy->GetUsedPoints() ) {
+ QString aWarning = tr("STREAM_MEMORY_ALERT");
+ if( SUIT_MessageBox::warning( this, tr( "WRN_VISU_WARNING" ), aWarning, tr( "BUT_OK" ), tr( "CANCEL" ) ) == 1 ) {
+ // Set re-calculated values
+ myStepLen->setValue(myPrsCopy->GetStepLength());
+ myPntPercent->setValue(myPrsCopy->GetUsedPoints());
+ return;
+ }
+ }
+
VisuGUI_ScalarBarBaseDlg::accept();
}
CopyFile(const std::string& theSourceFileName,
const std::string& theTargetFileName)
{
- QFileInfo aSourceFileInfo(theSourceFileName.c_str());
- QFileInfo aTargetFileInfo(theTargetFileName.c_str());
+ QString aSourcePath = theSourceFileName.c_str();
+#ifdef WNT
+ aSourcePath.replace( QString("/"), QString("\\") );
+ int prevSlash = 0;
+ for ( int ind = 0; ind < aSourcePath.length(); ind ++ )
+ {
+ if ( aSourcePath.at( ind ) == '\\' )
+ prevSlash = ind;
+ if ( aSourcePath.at( ind ) == ' ' )
+ {
+ int nextSlash = aSourcePath.indexOf( '\\', ind);
+ if ( aSourcePath.at( nextSlash - 1 ) != '"' )
+ {
+ aSourcePath.insert( nextSlash, '"');
+ aSourcePath.insert( prevSlash + 1, '"');
+ ind++;
+ }
+ }
+ }
+#endif
+
+ QFileInfo aSourceFileInfo( aSourcePath );
+ QFileInfo aTargetFileInfo( theTargetFileName.c_str() );
if(aSourceFileInfo.absoluteFilePath() == aTargetFileInfo.absoluteFilePath())
return true;
QString aCommand;
- aCommand.sprintf("%s %s %s",
- COPY_COMMAND,
- aSourceFileInfo.filePath().toLatin1().data(),
- aTargetFileInfo.filePath().toLatin1().data());
+ aCommand.sprintf("%s %s %s", COPY_COMMAND,
+ aSourcePath.toLatin1().data(),
+ theTargetFileName.c_str());
return system(aCommand.toLatin1().data()) == 0;
}