Salome HOME
Unicode support
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index c90cb0fa9efe48868146d72afef3b6b371624d3d..493b734bb144759ea436447652610fc438a5af65 100644 (file)
 // of auto-color picking up
 #define SIMPLE_AUTOCOLOR
 
-// REMOVE the code about MPLMathText_Disabler if it does not complite at porting to ParaView-4.1
-#include <vtkMatplotlibMathTextUtilities.h>
-namespace
-{
-  // Creation of this class disables vtkMatplotlibMathTextUtilities
-  struct MPLMathText_Disabler : protected vtkMatplotlibMathTextUtilities
-  {
-    MPLMathText_Disabler()
-    {
-      vtkMatplotlibMathTextUtilities::MPLMathTextAvailable =
-        vtkMatplotlibMathTextUtilities::UNAVAILABLE;
-    }
-  };
-} 
-
 namespace
 {
   // Declarations
@@ -1979,8 +1964,6 @@ SalomeApp_Module( "SMESH" )
 
   /* load resources for all available meshers */
   SMESH::InitAvailableHypotheses();
-
-  MPLMathText_Disabler d; // disable vtkMatplotlibMathTextUtilities
 }
 
 //=============================================================================
@@ -2029,8 +2012,8 @@ bool SMESHGUI::automaticUpdate(unsigned int requestedSize, bool* limitExceeded)
  *
  */
 //=============================================================================
-bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
-                                int* entities, bool* limitExceeded, int* hidden )
+bool SMESHGUI::automaticUpdate( SMESH::SMESH_IDSource_ptr theMesh,
+                                int* entities, bool* limitExceeded, int* hidden, long* nbElements )
 {
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
   if ( !resMgr )
@@ -2040,8 +2023,23 @@ bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
   long updateLimit = resMgr->integerValue( "SMESH", "update_limit", 500000 );
   bool incrementalLimit = resMgr->booleanValue( "SMESH", "incremental_limit", false );
 
-  long requestedSize = theMesh->NbElements();
-
+  SMESH::long_array_var info = theMesh->GetMeshInfo();
+  long nbOdElems = info[SMDSEntity_0D];
+  long nbEdges   = info[SMDSEntity_Edge] + info[SMDSEntity_Quad_Edge];
+  long nbFaces   = info[SMDSEntity_Triangle]   + info[SMDSEntity_Quad_Triangle]   + info[SMDSEntity_BiQuad_Triangle] + 
+                   info[SMDSEntity_Quadrangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle] + 
+                   info[SMDSEntity_Polygon];
+  long nbVolumes = info[SMDSEntity_Tetra]   + info[SMDSEntity_Quad_Tetra] + 
+                   info[SMDSEntity_Hexa]    + info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_TriQuad_Hexa] + 
+                   info[SMDSEntity_Pyramid] + info[SMDSEntity_Quad_Pyramid] + 
+                   info[SMDSEntity_Penta]   + info[SMDSEntity_Quad_Penta] + 
+                   info[SMDSEntity_Polyhedra] + 
+                   info[SMDSEntity_Hexagonal_Prism];
+  long nbBalls   = info[SMDSEntity_Ball];
+
+  long requestedSize = nbOdElems + nbBalls + nbEdges + nbFaces + nbVolumes;
+  *nbElements = requestedSize;
+  
   *entities = SMESH_Actor::eAllEntity;
   *hidden   = 0;
 
@@ -2050,11 +2048,6 @@ bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
   if ( limitExceeded ) *limitExceeded = autoUpdate && exceeded;
 
   if ( incrementalLimit ) {
-    long nbOdElems = theMesh->Nb0DElements();
-    long nbEdges   = theMesh->NbEdges();
-    long nbFaces   = theMesh->NbFaces();
-    long nbVolumes = theMesh->NbVolumes();
-    long nbBalls   = theMesh->NbBalls();
     long total     = 0;
 
     if ( nbOdElems > 0 ) {
@@ -4762,7 +4755,7 @@ void SMESHGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& ti
     _PTR(Study) study = appStudy->studyDS();
     _PTR(SObject) obj = study->FindObjectID( io->getEntry() );
     if ( obj ) {
-      QString aName = QString( obj->GetName().c_str() );
+      QString aName = QString( QString::fromUtf8(obj->GetName().c_str()) );
       while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup
           aName.remove( (aName.length() - 1), 1 );
       title = aName;
@@ -4778,6 +4771,7 @@ LightApp_Selection* SMESHGUI::createSelection() const
 void SMESHGUI::windows( QMap<int, int>& aMap ) const
 {
   aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
+  aMap.insert( SalomeApp_Application::WT_NoteBook, Qt::LeftDockWidgetArea );
   aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
 }
 
@@ -6741,7 +6735,7 @@ void SMESHGUI::message( const QString& msg )
       _PTR(SObject) obj = study->FindObjectID( entry.toLatin1().constData() );
       QString name;
       if ( obj )
-        name = obj->GetName().c_str();
+        name = QString::fromUtf8(obj->GetName().c_str());
       if ( name.isEmpty() )
         return;