]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Merge from BR_WIN_INDUS_514 04/10/2010 V5_1_5a1 V5_1_main_20101007 V5_1_main_20101008 V5_1_main_20101019 V5_1_main_20101020 V5_1_main_20101021 V5_1_main_20101022 V5_1_main_20101025 V5_1_main_20101101 before_mergefrom_V5_1_5_BR_12Nov10 mergefrom_BR_WIN_INDUS_514_04Oct10 start_PHASE_25_BR
authorvsr <vsr@opencascade.com>
Mon, 4 Oct 2010 14:41:18 +0000 (14:41 +0000)
committervsr <vsr@opencascade.com>
Mon, 4 Oct 2010 14:41:18 +0000 (14:41 +0000)
src/OBJECT/VISU_IsoSurfActor.cxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_StreamLinesDlg.cxx
src/VISUGUI/VisuGUI_StreamLinesDlg.h
src/VISU_I/VISU_ColoredPrs3dCache_i.cc
src/VISU_I/VISU_ResultUtils.cc

index 769563a9482c390f97b0301272e26160ac29741d..52785d4c4b66836df5041e43d7971bc7c1196b53 100644 (file)
@@ -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
index 56c18d9330e6fd8edc590051614fdf6716038156..7b17138d2071d8795247d74e1a165f2d2365b0e0 100755 (executable)
@@ -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;
index 3281988980057bcbe26979cadf6bb9d78dfe8e8d..ac20efebc21ecdde6dfc765414bdec5e0851363a 100644 (file)
@@ -3101,6 +3101,11 @@ Please select another field.</translation>
         <source>USE_COLOR_BTN</source>
         <translation>Use Color</translation>
     </message>
+    <message>
+        <source>STREAM_MEMORY_ALERT</source>
+       <translation>Presentation can't be built using the initial parameters because of memory lack.
+Some parameters has been changed. Don you want to continue anyway?</translation>
+    </message>
 </context>
 <context>
     <name>VisuGUI_SweepPrefDlg</name>
index e1028449e6ed78d46a96dea42873bf61ab5e689e..bd7f27e29acb579e5bcf941f2df1c322770b2574 100644 (file)
@@ -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),
index 02a4c5f756e7c04867e77efd8318743b86d7b98a..3e771585fd1c67fd4cec84bc5cc7cdd38ac022d4 100644 (file)
@@ -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<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)));
@@ -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<VISU::TSTREAMLINES>().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();
 }
 
index a0eebdf936680e8940bf25092a9f9388ab091334..5667480dffec54488bfa9bb244dceb7714f06867 100644 (file)
@@ -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<VISU::StreamLines_i> myPrsCopy;
     SalomeApp_Module* myVisuGUI;
+    bool myStatus;
 
 private slots:
   //void setVColor();
index 0dcddc755b5a94655b99a913a80c2fdaf88b70da..82ae9dfd28b4193c0195e70e2f73affacd220d11 100644 (file)
@@ -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 )
index 55b14d556a9e9323c0ed778556dd4e76149193a4..ea918c298cb5a5d858888b110f40417263e7ce9b 100644 (file)
@@ -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;
   }