Salome HOME
Unicode support
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Make2DFrom3DOp.cxx
index b0fba16247a1bfa04f92c9d1a612e1c9a19a4f40..f03216cbe343847b62b0818843895251ec3f15b0 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // 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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -238,7 +238,7 @@ void SMESHGUI_Make2DFrom3DOp::startOperation()
   if( !myDlg )
     myDlg = new SMESHGUI_Make2DFrom3DDlg( desktop() );
 
-  myHelpFileName = "make_2dmesh_from_3d_page.html";
+  myHelpFileName = "make_2dmesh_from_3d.html";
 
   SMESHGUI_SelectionOp::startOperation();
 
@@ -302,10 +302,9 @@ void SMESHGUI_Make2DFrom3DOp::selectionDone()
       bool isMesh = true;
       for ( int i = 0; i < ids.count() && isMesh; ++i )
       {
-        _PTR(SObject) sobj =
-          SMESHGUI::activeStudy()->studyDS()->FindObjectID( ids[i].toLatin1().constData() );
+        _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( ids[i].toUtf8().constData() );
         mySrcMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( sobj );  
-        isMesh = !mySrcMesh->_is_nil();
+        //isMesh = !mySrcMesh->_is_nil(); // EAP - it's sometimes necessary to copy to a new mesh
       }
       myDlg->setNewMeshEnabled( isMesh );
     }
@@ -356,7 +355,7 @@ bool SMESHGUI_Make2DFrom3DOp::isValid( QString& msg ) const
     for ( int i = 0; i < entries.count(); ++i )
     {
       SMESH::SMESH_GroupBase_var grp;
-      if ( _PTR(SObject) sobj = SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[i].toLatin1().constData() ))
+      if ( _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entries[i].toUtf8().constData() ))
         grp = SMESH::SObjectToInterface<SMESH::SMESH_GroupBase>( sobj );
       if ( grp->_is_nil() ) {
         msg = tr( "SMESH_NOT_ONLY_GROUPS" );
@@ -370,11 +369,11 @@ bool SMESHGUI_Make2DFrom3DOp::isValid( QString& msg ) const
   for ( int i = 0; i < entries.count(); ++i )
   {
     SMESH::SMESH_IDSource_var idSource;
-    if ( _PTR(SObject) sobj = SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[i].toLatin1().constData() ))
+    if ( _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entries[i].toUtf8().constData() ))
       idSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( sobj );
     if ( !idSource->_is_nil() ) {
       SMESH::array_of_ElementType_var types = idSource->GetTypes();
-      for ( int j = 0; j < types->length(); ++j )
+      for ( int j = 0; j < (int) types->length(); ++j )
         if ( types[j] == SMESH::VOLUME )
           hasVolumes = true;
         else if ( types[j] == SMESH::FACE )
@@ -428,8 +427,7 @@ bool SMESHGUI_Make2DFrom3DOp::compute2DMesh( QStringList& theEntryList )
       groups->length( entries.count() );
       for ( int i = 0; i < entries.count(); ++i )
       {
-        _PTR(SObject) sobj =
-          SMESHGUI::activeStudy()->studyDS()->FindObjectID( entries[i].toLatin1().constData() );
+        _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID( entries[i].toUtf8().constData() );
         SMESH::SMESH_IDSource_var grp = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( sobj );  
         SMESH::array_of_ElementType_var types = grp->GetTypes();
         if ( types->length() < 1 || types[0] != goodType )
@@ -452,8 +450,8 @@ bool SMESHGUI_Make2DFrom3DOp::compute2DMesh( QStringList& theEntryList )
       SMESH::SMESH_Group_var newGrp;
       SMESH::SMESH_Mesh_var newMesh;
       CORBA::Long nbAdded = aMeshEditor->MakeBoundaryElements( mode,
-                                                               groupName.toLatin1().constData(),
-                                                               meshName.toLatin1().constData(),
+                                                               groupName.toUtf8().constData(),
+                                                               meshName.toUtf8().constData(),
                                                                copyAll,
                                                                groups,
                                                                newMesh.out(),
@@ -466,19 +464,11 @@ bool SMESHGUI_Make2DFrom3DOp::compute2DMesh( QStringList& theEntryList )
       if ( !newMesh->_is_nil() ) {
         if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) )
           theEntryList.append( aSObject->GetID().c_str() );
-#ifdef WITHGENERICOBJ
-        newMesh->UnRegister();
-#endif
-      }
-      if ( !newGrp->_is_nil() ) {
-#ifdef WITHGENERICOBJ
-        newGrp->UnRegister();
-#endif
       }
       ok = true;
 
       for ( int i = 0; i < entries.count(); ++i )
-        if ( SMESH_Actor* actor = SMESH::FindActorByEntry( entries[i].toLatin1().constData() ))
+        if ( SMESH_Actor* actor = SMESH::FindActorByEntry( entries[i].toUtf8().constData() ))
           SMESH::Update(actor->getIO(),actor->GetVisibility());
       SMESH::RepaintCurrentView();
     }
@@ -490,7 +480,7 @@ bool SMESHGUI_Make2DFrom3DOp::compute2DMesh( QStringList& theEntryList )
 
 bool SMESHGUI_Make2DFrom3DOp::onApply()
 {
-  if ( isStudyLocked() )
+  if ( SMESHGUI::isStudyLocked() )
     return false;
 
   QString msg;