From: vsr Date: Mon, 4 Oct 2010 14:41:18 +0000 (+0000) Subject: Merge from BR_WIN_INDUS_514 04/10/2010 X-Git-Tag: V5_1_5a1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b9ff2049f52c5fe6fe5e0be8fd8f07aeff97f563;p=modules%2Fvisu.git Merge from BR_WIN_INDUS_514 04/10/2010 --- diff --git a/src/OBJECT/VISU_IsoSurfActor.cxx b/src/OBJECT/VISU_IsoSurfActor.cxx index 769563a9..52785d4c 100644 --- a/src/OBJECT/VISU_IsoSurfActor.cxx +++ b/src/OBJECT/VISU_IsoSurfActor.cxx @@ -122,8 +122,8 @@ void VISU_IsoSurfActor::AddToRender(vtkRenderer* theRenderer) //---------------------------------------------------------------------------- void VISU_IsoSurfActor::RemoveFromRender(vtkRenderer* theRenderer) { - VISU_ScalarMapAct::RemoveFromRender(theRenderer); theRenderer->RemoveActor(myLabels); + VISU_ScalarMapAct::RemoveFromRender(theRenderer); } //From vtkFollower diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 56c18d93..7b17138d 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -442,7 +442,7 @@ bool VISU_OpenGLPointSpriteMapper::InitExtensions() if( this->ExtensionsInitialized ) return true; - InitializeARB(); + IsARBInitialized = InitializeARB(); char* ext = (char*)glGetString( GL_EXTENSIONS ); //cout << "OpenGL extensions : " << ext << endl; diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index 32819889..ac20efeb 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -3101,6 +3101,11 @@ Please select another field. USE_COLOR_BTN Use Color + + STREAM_MEMORY_ALERT + Presentation can't be built using the initial parameters because of memory lack. +Some parameters has been changed. Don you want to continue anyway? + VisuGUI_SweepPrefDlg diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index e1028449..bd7f27e2 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -147,7 +147,7 @@ namespace VISU if( anEnlargeType == VISU::ColoredPrs3dCache::IMPOSSIBLE ) { size_t aMb = 1024 * 1024; - double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*aMb)) / double(aMb); + double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*(double)aMb)) / double(aMb); CORBA::Float aNecessaryMemory = aRequiredMemory - aFreeMemory - anUsedMemory; SUIT_MessageBox::warning(GetDesktop(theModule), diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx index 02a4c5f7..3e771585 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx @@ -73,7 +73,8 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule) : VisuGUI_ScalarBarBaseDlg(theModule), - myVisuGUI(theModule) + myVisuGUI(theModule), + myStatus(false) { setWindowTitle(tr("DLG_TITLE")); setSizeGripEnabled(TRUE); @@ -230,7 +231,7 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule) std::numeric_limits::min(), std::numeric_limits::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))); @@ -399,76 +400,9 @@ void VisuGUI_StreamLinesDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs, } 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().Copy(myPrsCopy, thePrs); - - return anIsOk; + return myStatus; } /*! @@ -547,6 +481,78 @@ void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) { } +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(); @@ -554,6 +560,24 @@ VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QStri 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(); } diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.h b/src/VISUGUI/VisuGUI_StreamLinesDlg.h index a0eebdf9..5667480d 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.h +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.h @@ -63,6 +63,7 @@ public: protected: virtual QString GetContextHelpFilePath(); + void storeToPrsCopy(); protected slots: void accept(); @@ -103,6 +104,7 @@ private: _PTR(SObject) mySelectionObj; SALOME::GenericObjPtr myPrsCopy; SalomeApp_Module* myVisuGUI; + bool myStatus; private slots: //void setVColor(); diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index 0dcddc75..82ae9dfd 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -356,7 +356,7 @@ VISU::ColoredPrs3dCache_i theRequiredMemory = int( aMemoryUsed + aMemoryNeeded ) + 1; size_t aMb = 1024 * 1024; - double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*aMb)) / double(aMb); + double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*(double)aMb)) / double(aMb); anEnlargeType = aMemoryNeeded < aFreeMemory ? VISU::ColoredPrs3dCache::ENLARGE : VISU::ColoredPrs3dCache::IMPOSSIBLE; } @@ -460,7 +460,7 @@ VISU::ColoredPrs3dCache_i return; size_t aMb = 1024 * 1024; - double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*aMb)) / double(aMb); + double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*(double)aMb)) / double(aMb); CORBA::Float aMemoryUsed = GetDeviceMemorySize(); CORBA::Float aMemoryNeeded = theMemorySize - aMemoryUsed; if( aMemoryNeeded > aFreeMemory ) diff --git a/src/VISU_I/VISU_ResultUtils.cc b/src/VISU_I/VISU_ResultUtils.cc index 55b14d55..ea918c29 100644 --- a/src/VISU_I/VISU_ResultUtils.cc +++ b/src/VISU_I/VISU_ResultUtils.cc @@ -649,16 +649,36 @@ namespace VISU 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; }