Salome HOME
0021787: [CEA 621] Desactivate preview for partition and boolean operations in prefer...
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI.cxx
index 05259bf29461815a486f7667182178168a0ca20f..68d4cefd7c956cbb882b0ece4313a8c9e7ad7f86 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -18,6 +18,7 @@
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 // GEOM GEOMGUI : GUI for Geometry component
 // File   : GEOMBase_Tools.cxx
@@ -373,6 +374,12 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
   case GEOMOp::OpIsosWidth:
     OnIsosWidth();
     break;
+  case GEOMOp::OpBringToFront:
+    OnBringToFront();
+    break;
+  case GEOMOp::OpClsBringToFront:
+    OnClsBringToFront();
+     break;
   default:
     SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
     break;
@@ -640,6 +647,42 @@ bool GEOMToolsGUI::Import()
       CORBA::String_var fileN = fileName.toLatin1().constData();
       CORBA::String_var fileT = aCurrentType.toLatin1().constData();
 
+      // jfa 21.08.2012 for mantis issue 21511 (STEP file units)
+      CORBA::String_var aUnits = aInsOp->ReadValue(fileN, fileT, "LEN_UNITS");
+      TCollection_AsciiString aUnitsStr (aUnits.in());
+      bool needConvert = true;
+      if (aUnitsStr.IsEmpty() || aUnitsStr == "UNIT_M")
+        needConvert = false;
+
+      if (needConvert) {
+        if (igesAnswer == SUIT_MessageBox::NoToAll) {
+          // converting for all files is already approved
+          fileT = (aCurrentType + "_SCALE").toLatin1().constData();
+        }
+        else if (igesAnswer != SUIT_MessageBox::YesToAll) {
+          SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No;
+          if (i < fileNames.count() - 1) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll;
+          igesAnswer = SUIT_MessageBox::question(app->desktop(),
+                                                 "Question",//tr("WRN_WARNING"),
+                                                 tr("GEOM_SCALE_DIMENSIONS"),
+                                                 btns | SUIT_MessageBox::Cancel,
+                                                 SUIT_MessageBox::No);
+          switch (igesAnswer) {
+          case SUIT_MessageBox::Cancel:
+            return false;                // cancel (break) import operation
+          case SUIT_MessageBox::Yes:
+          case SUIT_MessageBox::YesToAll:
+            break;                       // scaling is confirmed
+          case SUIT_MessageBox::No:
+          case SUIT_MessageBox::NoAll:
+            fileT = (aCurrentType + "_SCALE").toLatin1().constData();
+          default:
+            break;                       // scaling is rejected
+          } // switch ( igesAnswer )
+        } // if ( igeAnswer != NoToAll )
+      } // if ( needConvert )
+
+      /*
       // skl 29.05.2009
       if ( aCurrentType == "IGES" ) {
         GEOM::GEOM_Object_var anObj = aInsOp->ImportFile( fileN, "IGES_UNIT" );
@@ -677,6 +720,9 @@ bool GEOMToolsGUI::Import()
         } // if ( needConvert )
       } // if ( aCurrentType == "IGES" )
       else if ( aCurrentType == "ACIS" ) {
+      */
+
+      if ( aCurrentType == "ACIS" ) {
         if ( acisAnswer != SUIT_MessageBox::YesToAll && acisAnswer != SUIT_MessageBox::NoToAll ) {
           SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No;
           if ( i < fileNames.count()-1 ) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll;
@@ -690,6 +736,7 @@ bool GEOMToolsGUI::Import()
         } // if ( acisAnswer != YesToAll && acisAnswer != NoToAll )
       } // else if ( aCurrentType == "ACIS" )
 
+      // IMPORT
       GEOM::GEOM_Object_var anObj = aInsOp->ImportFile( fileN, fileT );
 
       if ( !anObj->_is_nil() && aInsOp->IsDone() ) {