Salome HOME
Merge remote branch 'origin/V7_dev'
[modules/geom.git] / src / EntityGUI / EntityGUI_SketcherDlg.cxx
index bd2ddf62c0829c143cd05e3cd0d1e7e7c791072f..45ecde755367553265afef8e73554dcc21f271a8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  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
@@ -6,7 +6,7 @@
 // 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
@@ -47,6 +47,7 @@
 #include <SalomeApp_Application.h>
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
+#include "utilities.h"
 
 #include <DlgRef.h>
 
@@ -64,6 +65,7 @@
 
 #include <SalomeApp_Study.h>
 #include <SalomeApp_Tools.h>
+#include "utilities.h"
 
 #include <gp_Pln.hxx>
 
@@ -539,7 +541,7 @@ void EntityGUI_SketcherDlg::InitClick()
   Group4Spin->hide();
   GroupRect->hide();
   globalSelection(); // close local selection to clear it
-  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+  localSelection( TopAbs_VERTEX );
 }
 
 
@@ -630,15 +632,14 @@ void EntityGUI_SketcherDlg::RectClicked()
        SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
   
   GroupRect->show();
-  
   myX1=0;
-  myX2=10;
-  myY1=0;
-  myY2=10;
-
   GroupRect->SpinBox_DX1->setValue(myX1); 
+  myY1=0;
   GroupRect->SpinBox_DY1->setValue(myY1);
+  myX2=10;
   GroupRect->SpinBox_DX2->setValue(myX2);
+  myY2=10;
   GroupRect->SpinBox_DY2->setValue(myY2);
   
   resize( minimumSizeHint() );
@@ -941,13 +942,13 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
       else if ( constructorId == 0 ) {  // X
         mySketchType = DIR_ANGLE_X;
         initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" );
-        Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_X3" ) );
+        Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_X2" ) );
         Group2Spin->SpinBox_DY->setValue( myX );
       }
       else if ( constructorId == 1 ) {  // Y
         mySketchType = DIR_ANGLE_Y;
         initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" );        
-        Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y3" ) );
+        Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
         Group2Spin->SpinBox_DY->setValue( myY );
       }
     }
@@ -962,12 +963,12 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
       }
       else if ( constructorId == 0 ) {  // X
         mySketchType = DIR_PER_X;
-        Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X3" ) );
+        Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
         Group1Spin->SpinBox_DX->setValue( myX );
       }
       else if ( constructorId == 1 ) {  // Y
         mySketchType = DIR_PER_Y;
-        Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y3" ) );
+        Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y2" ) );
         Group1Spin->SpinBox_DX->setValue( myY );
       }
     }
@@ -982,12 +983,12 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
       }
       else if ( constructorId == 0 ) {  // X
         mySketchType = DIR_TAN_X;
-        Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X3" ) );
+        Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
         Group1Spin->SpinBox_DX->setValue( myX );
       }
       else if ( constructorId == 1 ) {  // Y
         mySketchType = DIR_TAN_Y;
-        Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y3" ) );
+        Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y2" ) );
         Group1Spin->SpinBox_DX->setValue( myY );
       }
     }
@@ -1009,12 +1010,12 @@ void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
       }
       else if ( constructorId == 0 ) { // X
         mySketchType = DIR_DXDY_X;
-        Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_X3" ) );
+        Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_X2" ) );
         Group3Spin->SpinBox_DZ->setValue( myX );
       }
       else if ( constructorId == 1 ) {  // Y
         mySketchType = DIR_DXDY_Y;
-        Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Y3" ) );
+        Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Y2" ) );
         Group3Spin->SpinBox_DZ->setValue( myY );
       }
     }
@@ -1142,7 +1143,7 @@ void EntityGUI_SketcherDlg::ClickOnEnd()
     }
 
     QString Command = myCommand.join( "" );
-    Sketcher_Profile aProfile = Sketcher_Profile( Command.toAscii() );
+    Sketcher_Profile aProfile = Sketcher_Profile( Command.toLatin1() );
     bool isDone = false;
     TopoDS_Shape myShape = aProfile.GetShape( &isDone );
     if ( isDone ) {
@@ -1570,7 +1571,7 @@ void EntityGUI_SketcherDlg::SetEditCurrentArgument()
     selButton->setDown(true);
   }
   globalSelection(); // close local selection to clear it
-  localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+  localSelection( myNeedType );
 }
 
 
@@ -2258,7 +2259,7 @@ QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters )
                                   + ":TT " + QString::number( myX2, Format, DigNum) + " " + QString::number( myY1, Format, DigNum)
                                   + ":WW";
                           
-      theParameters = myX1Str + ":" + myY1Str + ":" + myX2Str + ":" + myY2Str ;
+      theParameters = myX1Str + ":" + myY1Str + ":" + myX1Str + ":" + myY2Str + ":" + myX2Str + ":" + myY2Str + ":" + myX2Str + ":" + myY1Str;
     }
   return myNewCommand;
 }
@@ -2340,12 +2341,12 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
 
     //Last Shape
     QString Command1 = myCommand.join( "" );
-    Sketcher_Profile aProfile1( Command1.toAscii() );
+    Sketcher_Profile aProfile1( Command1.toLatin1() );
     myShape1 = aProfile1.GetShape();
 
     //Current Shape
     QString Command2 = Command1 + GetNewCommand( aParameters );
-    Sketcher_Profile aProfile2( Command2.toAscii() );
+    Sketcher_Profile aProfile2( Command2.toLatin1() );
     myShape2 = aProfile2.GetShape( &isDone, &error );
 
     //Error Message