Salome HOME
0014047: EDF PAL 334 : Problem to select merged face with Create group window
[modules/geom.git] / src / GEOMBase / GEOMBase.cxx
index 757f212d7772ccac19ccaf3a056cfc6171504ef0..0f7d30cfbc0a98172a58f7da2139b5ca22cde148 100644 (file)
@@ -1,55 +1,51 @@
-//  GEOM GEOMGUI : GUI for Geometry component
+// GEOM GEOMGUI : GUI for Geometry component
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  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.
+// 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.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+// File   : GEOMBase.cxx
+// Author : Damien COQUERET, Open CASCADE S.A.S.
 //
-//
-//  File   : GEOMBase.cxx
-//  Author : Damien COQUERET
-//  Module : GEOM
-//  $Header$
 
 #include "GEOMBase.h"
-#include "GeometryGUI.h"
-#include "GEOMBase_aParameterDlg.h"
 
-#include "GEOM_Client.hxx"
+#include <GeometryGUI.h>
+#include <GEOM_Client.hxx>
 
 ////  SALOME Includes
-#include "GEOM_Actor.h"
-#include "SVTK_ViewModel.h"
-#include "SVTK_ViewWindow.h"
-#include "OCCViewer_ViewPort3d.h"
-#include "OCCViewer_ViewModel.h"
-#include "OCCViewer_ViewWindow.h"
-
-#include "SALOME_ListIO.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-
-#include "SUIT_Desktop.h"
-#include "SUIT_Session.h"
-#include "SUIT_ViewManager.h"
-#include "SUIT_ViewWindow.h"
-#include "SUIT_MessageBox.h"
-#include "SalomeApp_Application.h"
-#include "SalomeApp_Study.h"
+#include <GEOM_Actor.h>
+#include <SVTK_ViewModel.h>
+#include <SVTK_ViewWindow.h>
+#include <OCCViewer_ViewPort3d.h>
+#include <OCCViewer_ViewModel.h>
+#include <OCCViewer_ViewWindow.h>
+
+#include <SALOME_ListIO.hxx>
+#include <SALOME_ListIteratorOfListIO.hxx>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_ViewWindow.h>
+#include <SUIT_MessageBox.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
 
 // // Open CASCADE Includes
 #include <BRep_Tool.hxx>
@@ -63,6 +59,7 @@
 #include <TopAbs.hxx>
 #include <TopExp.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
+#include <TopoDS.hxx>
 
 #include <Precision.hxx>
 
@@ -70,9 +67,6 @@
 
 #include <set>
 
-using namespace std;
-
-
 //=====================================================================================
 // function : GetShapeFromIOR()
 // purpose  : exist also as static method !
@@ -209,55 +203,55 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString&
     {
     case TopAbs_COMPOUND:
       {
-       aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUND").toStdString().c_str());
+       aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUND").toLatin1().constData());
        return true;
       }
     case  TopAbs_COMPSOLID:
       {
-       aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUNDSOLID").toStdString().c_str()) ;
+       aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUNDSOLID").toLatin1().constData()) ;
        return true ;
       }
     case TopAbs_SOLID:
       {
-       aTypeString = CORBA::string_dup(QObject::tr("GEOM_SOLID").toStdString().c_str()) ;
+       aTypeString = CORBA::string_dup(QObject::tr("GEOM_SOLID").toLatin1().constData()) ;
        return true ;
       }
     case TopAbs_SHELL:
       {
-       aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHELL").toStdString().c_str()) ;
+       aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHELL").toLatin1().constData()) ;
        return true ;
       }
     case TopAbs_FACE:
       {
        BRepAdaptor_Surface surf(TopoDS::Face(aShape));
        if(surf.GetType() == GeomAbs_Plane) {
-         aTypeString = CORBA::string_dup(QObject::tr("GEOM_PLANE").toStdString().c_str());
+         aTypeString = CORBA::string_dup(QObject::tr("GEOM_PLANE").toLatin1().constData());
          return true;
        }
        else if(surf.GetType() == GeomAbs_Cylinder) {
-         aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCYLINDER").toStdString().c_str());
+         aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCYLINDER").toLatin1().constData());
          return true;
        }
        else if(surf.GetType() == GeomAbs_Sphere) {
-         aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFSPHERE").toStdString().c_str());
+         aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFSPHERE").toLatin1().constData());
          return true ;
        }
        else if(surf.GetType() == GeomAbs_Torus) {
-         aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFTORUS").toStdString().c_str());
+         aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFTORUS").toLatin1().constData());
          return true ;
        }
        else if(surf.GetType() == GeomAbs_Cone) {
-         aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCONE").toStdString().c_str());
+         aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCONE").toLatin1().constData());
          return true ;
        }
        else {
-         aTypeString = CORBA::string_dup(QObject::tr("GEOM_FACE").toStdString().c_str());
+         aTypeString = CORBA::string_dup(QObject::tr("GEOM_FACE").toLatin1().constData());
          return true;
        }
       }
     case TopAbs_WIRE:
       {
-       aTypeString = CORBA::string_dup(QObject::tr("GEOM_WIRE").toStdString().c_str());
+       aTypeString = CORBA::string_dup(QObject::tr("GEOM_WIRE").toLatin1().constData());
        return true;
       }
     case TopAbs_EDGE:
@@ -265,31 +259,31 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString&
        BRepAdaptor_Curve curv(TopoDS::Edge(aShape));
        if(curv.GetType() == GeomAbs_Line) {
          if((Abs(curv.FirstParameter()) >= 1E6) || (Abs(curv.LastParameter()) >= 1E6))
-           aTypeString = CORBA::string_dup(QObject::tr("GEOM_LINE").toStdString().c_str());
+           aTypeString = CORBA::string_dup(QObject::tr("GEOM_LINE").toLatin1().constData());
          else
-           aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE").toStdString().c_str());
+           aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE").toLatin1().constData());
          return true;
        }
        else if(curv.GetType() == GeomAbs_Circle) {
          if(curv.IsClosed())
-           aTypeString = CORBA::string_dup(QObject::tr("GEOM_CIRCLE").toStdString().c_str());
+           aTypeString = CORBA::string_dup(QObject::tr("GEOM_CIRCLE").toLatin1().constData());
          else
-           aTypeString = CORBA::string_dup(QObject::tr("GEOM_ARC").toStdString().c_str());
+           aTypeString = CORBA::string_dup(QObject::tr("GEOM_ARC").toLatin1().constData());
        return true;
       }
        else {
-         aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE").toStdString().c_str());
+         aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE").toLatin1().constData());
          return true;
        }
       }
     case TopAbs_VERTEX:
       {
-       aTypeString = CORBA::string_dup(QObject::tr("GEOM_VERTEX").toStdString().c_str());
+       aTypeString = CORBA::string_dup(QObject::tr("GEOM_VERTEX").toLatin1().constData());
        return true;
       }
     case TopAbs_SHAPE:
       {
-       aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHAPE").toStdString().c_str());
+       aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHAPE").toLatin1().constData());
        return true;
       }
     }
@@ -743,34 +737,6 @@ bool GEOMBase::LinearEdgeExtremities(const TopoDS_Shape& S,  gp_Pnt& P1, gp_Pnt&
 }
 
 
-//=======================================================================
-// function : Parameter()
-// purpose  : return a parameter (float) from a dialog box
-//
-//  avalue1    : is a float or integer used as a default value displayed
-//  aTitle1    : is the title for aValue1
-//  aTitle     : is the main title
-//  bottom     : maximum value to be entered
-//  top               : minimum value to be entered
-//  decimals   : number of decimals
-//=======================================================================
-double GEOMBase::Parameter(Standard_Boolean& res, const char* aValue1, const char* aTitle1, const char* aTitle, const double bottom, const double top, const int decimals)
-{
-  GEOMBase_aParameterDlg * Dialog = new GEOMBase_aParameterDlg(aValue1, aTitle1, SUIT_Session::session()->activeApplication()->desktop(),
-                                                              aTitle, TRUE, 0, bottom, top, decimals);
-  int r = Dialog->exec();
-  float X = 0.0;
-  if(r == QDialog::Accepted) {
-    res = Standard_True;
-    X = Dialog->getValue();
-  }
-  else
-    res = Standard_False;
-  delete Dialog;
-  return X;
-}
-
-
 //=======================================================================
 // function : SelectionByNameInDialogs()
 // purpose  : Called when user has entered a name of object in a LineEdit.
@@ -806,7 +772,7 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU
 
   _PTR(SObject) theObj ( listSO[0] );
   /* Create a SALOME_InteractiveObject with a SALOME::SObject */
-  char* aCopyobjectUserName = CORBA::string_dup(objectUserName.toStdString().c_str());
+  char* aCopyobjectUserName = CORBA::string_dup(objectUserName.toLatin1().constData());
   Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(theObj->GetID().c_str(), "GEOM", aCopyobjectUserName);
   delete(aCopyobjectUserName);
 
@@ -881,7 +847,7 @@ void GEOMBase::ShowErrorMessage(const char* theErrorCode, const char* theComment
 
   QString aText = "";
   if (!anErrorCode.isEmpty())
-    aText.append("\n" + QObject::tr(anErrorCode.toStdString().c_str()));
+    aText.append("\n" + QObject::tr(anErrorCode.toLatin1().constData()));
   if (!aComment.isEmpty())
     aText.append("\n" + QString(theComment));
 
@@ -947,7 +913,7 @@ QString GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj )
     CORBA::String_var anIOR = SalomeApp_Application::orb()->object_to_string( theObj );
     if ( strcmp(anIOR.in(), "") != 0 )
     {
-      _PTR(SObject) aSObj ( appStudy->studyDS()->FindObjectIOR( string( anIOR ) ) );
+      _PTR(SObject) aSObj ( appStudy->studyDS()->FindObjectIOR( std::string( anIOR ) ) );
 
       _PTR(GenericAttribute) anAttr;