]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
NPAL 18363
authordmv <dmv@opencascade.com>
Wed, 19 Dec 2007 14:15:59 +0000 (14:15 +0000)
committerdmv <dmv@opencascade.com>
Wed, 19 Dec 2007 14:15:59 +0000 (14:15 +0000)
src/TransformationGUI/TransformationGUI_MirrorDlg.cxx
src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx
src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx
src/TransformationGUI/TransformationGUI_RotationDlg.cxx
src/TransformationGUI/TransformationGUI_ScaleDlg.cxx
src/TransformationGUI/TransformationGUI_TranslationDlg.cxx

index b5d2df706207d98b55fa42db5ca98e6045a9b105..ce2b0a94fc2d6a8b6240c23ded150cb81138031e 100644 (file)
@@ -241,11 +241,19 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
       if(!testResult || CORBA::is_nil( myArgument ))
        return;
 
+      aName = GEOMBase::GetName( aSelectedObject );
+
       if ( testResult && !aSelectedObject->_is_nil() )
        {
          TopoDS_Shape aShape;
          if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
            {
+             TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+             if (getConstructorId() == 1)
+               aNeedType = TopAbs_EDGE;
+             else if (getConstructorId() == 2)
+               aNeedType = TopAbs_FACE;
+             
              LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
              TColStd_IndexedMapOfInteger aMap;
              aSelMgr->GetIndexes( firstIObject(), aMap );
@@ -254,15 +262,23 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
                    GEOM::GEOM_IShapesOperations_var aShapesOp =
                      getGeomEngine()->GetIShapesOperations( getStudyId() );
                    int anIndex = aMap( 1 );
-                   TopTools_IndexedMapOfShape aShapes;
-                   TopExp::MapShapes( aShape, aShapes );
-                   aShape = aShapes.FindKey( anIndex );
+                   int id = getConstructorId();
+                   if (aNeedType == TopAbs_VERTEX)
+                     aName += QString(":vertex_%1").arg(anIndex);
+                   else
+                     aName += QString(":edge_%1").arg(anIndex);
+
                    myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex);
                    aSelMgr->clearSelected();
-                 }
+               }
+             else {
+               if (aShape.ShapeType() != aNeedType) {
+                 myArgument = GEOM::GEOM_Object::_nil();
+                 aName = "";
+               }
+             }
            }
        }
-      aName = GEOMBase::GetName( aSelectedObject );
     }
   myEditCurrentArgument->setText( aName );
    
@@ -293,10 +309,10 @@ void TransformationGUI_MirrorDlg::LineEditReturnPressed()
 void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
+  globalSelection();
   
   if(send == GroupPoints->PushButton1){
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    globalSelection();
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
@@ -304,15 +320,12 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
       {
       case 0:
        {
-         //      globalSelection( GEOM_POINT );
          localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
          break;
        }
       case 1:
        {
-         //globalSelection( GEOM_LINE );
-         GEOM::GEOM_Object_var anObj;
-         localSelection( anObj, TopAbs_EDGE );
+         localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
          break;
        }
       case 2:
index 1b6f1c3b46c6158bac657e36079eeb52956f5eca..f01324aa80b1ebb9b36cb5da949c214835c59bbb 100644 (file)
@@ -288,6 +288,8 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
   if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject))
     return;
 
+  QString aName = GEOMBase::GetName( aSelectedObject );
+
   if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
       myEditCurrentArgument == GroupDimensions->LineEdit1)
     myBase = aSelectedObject;
@@ -297,6 +299,7 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
        {
          TopoDS_Shape aShape;
          
+         
          if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
            {
              LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@@ -307,18 +310,22 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
                    GEOM::GEOM_IShapesOperations_var aShapesOp =
                      getGeomEngine()->GetIShapesOperations( getStudyId() );
                    int anIndex = aMap( 1 );
-                   TopTools_IndexedMapOfShape aShapes;
-                   TopExp::MapShapes( aShape, aShapes );
-                   aShape = aShapes.FindKey( anIndex );
+                   aName += QString(":edge_%1").arg(anIndex);              
                    myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
                    aSelMgr->clearSelected();
                  }
-               else
+               else {
+                 if (aShape.ShapeType() != TopAbs_EDGE) {
+                   aSelectedObject = GEOM::GEOM_Object::_nil();
+                   aName = "";
+                 }
                  myVector = aSelectedObject;
+               }
+               
            }
        }
   }
-  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  myEditCurrentArgument->setText( aName );
 
   displayPreview();
 }
@@ -331,26 +338,21 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
 void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
+  globalSelection( GEOM_ALLSHAPES );
 
   if(send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    globalSelection( GEOM_ALLSHAPES );
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    //    globalSelection( GEOM_LINE  );
-    GEOM::GEOM_Object_var anObj;
-    localSelection( anObj, TopAbs_EDGE );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
   else if(send == GroupDimensions->PushButton1) {
     myEditCurrentArgument = GroupDimensions->LineEdit1;
-    globalSelection( GEOM_ALLSHAPES );
   }
   else if(send == GroupDimensions->PushButton2) {
     myEditCurrentArgument = GroupDimensions->LineEdit2;
-    //    globalSelection( GEOM_LINE  );
-    GEOM::GEOM_Object_var anObj;
-    localSelection( anObj, TopAbs_EDGE );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
 
   myEditCurrentArgument->setFocus();
index 3b5e094bc7f8062462b2069010b30d0ff1b4903d..f017e899f66beb66f2f50250f9da0cd5003cb9b7 100644 (file)
@@ -305,6 +305,8 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
   if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) )
     return;
 
+  QString aName = GEOMBase::GetName( aSelectedObject );
+
   if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
       myEditCurrentArgument == GroupDimensions->LineEdit1)
     myBase = aSelectedObject;
@@ -325,25 +327,27 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
                    GEOM::GEOM_IShapesOperations_var aShapesOp =
                      getGeomEngine()->GetIShapesOperations( getStudyId() );
                    int anIndex = aMap( 1 );
-                   TopTools_IndexedMapOfShape aShapes;
-                   TopExp::MapShapes( aShape, aShapes );
-                   aShape = aShapes.FindKey( anIndex );
-                   aSelMgr->clearSelected();
+                   aName += QString(":edge_%1").arg(anIndex);
                    if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
                      myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
                    else
                      myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
                  }
-               else
+               else {
+                 if (aShape.ShapeType() != TopAbs_EDGE) {
+                   aSelectedObject = GEOM::GEOM_Object::_nil();
+                   aName = "";
+                 }
                  if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
                    myVectorV = aSelectedObject;
                  else
                    myVectorU = aSelectedObject;
+               }
            }
        }
     }
 
-  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  myEditCurrentArgument->setText( aName );
 
   displayPreview();    
 }
@@ -356,32 +360,25 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
 void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
+  globalSelection( GEOM_ALLSHAPES );
 
   if(send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    globalSelection( GEOM_ALLSHAPES );
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    //    globalSelection( GEOM_LINE  );
-    GEOM::GEOM_Object_var anObj;
-    localSelection( anObj, TopAbs_EDGE );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
   else if(send == GroupDimensions->PushButton1) {
     myEditCurrentArgument = GroupDimensions->LineEdit1;
-    globalSelection( GEOM_ALLSHAPES );
   }
   else if(send == GroupDimensions->PushButton2) {
     myEditCurrentArgument = GroupDimensions->LineEdit2;
-    //    globalSelection( GEOM_LINE  );
-    GEOM::GEOM_Object_var anObj;
-    localSelection( anObj, TopAbs_EDGE );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
   else if(send == GroupDimensions->PushButton3) {
     myEditCurrentArgument = GroupDimensions->LineEdit3;
-    //    globalSelection( GEOM_LINE  );
-    GEOM::GEOM_Object_var anObj;
-    localSelection( anObj, TopAbs_EDGE );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
 
   myEditCurrentArgument->setFocus();
index 5f2a52909a812f510a831670e5e8ee49e9973b88..0aca76c0162a1b8b80ee26b8ccc99ff6400f5bc5 100644 (file)
@@ -273,6 +273,10 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
       TopoDS_Shape aShape;
       if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
        {
+         TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+         if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
+           aNeedType = TopAbs_EDGE;
+
          LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
          TColStd_IndexedMapOfInteger aMap;
          aSelMgr->GetIndexes( firstIObject(), aMap );
@@ -281,12 +285,19 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
              GEOM::GEOM_IShapesOperations_var aShapesOp =
                getGeomEngine()->GetIShapesOperations( getStudyId() );
              int anIndex = aMap( 1 );
-             TopTools_IndexedMapOfShape aShapes;
-             TopExp::MapShapes( aShape, aShapes );
-             aShape = aShapes.FindKey( anIndex );
+             if (aNeedType == TopAbs_EDGE)
+               aName += QString(":edge_%1").arg(anIndex);
+             else
+               aName += QString(":vertex_%1").arg(anIndex);
              aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
              aSelMgr->clearSelected();
            }
+         else {
+           if (aShape.ShapeType() != aNeedType) {
+             aSelectedObject = GEOM::GEOM_Object::_nil();
+             aName = "";
+           }
+         }
        }
      
       if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
@@ -312,18 +323,15 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
 void TransformationGUI_RotationDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
+  globalSelection();
 
   if(send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    globalSelection();
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    if (getConstructorId() == 0) {
-      //globalSelection( GEOM_LINE );
-      GEOM::GEOM_Object_var anObj;
-      localSelection( anObj, TopAbs_EDGE );
-    }
+    if (getConstructorId() == 0)
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
     else
       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
index e24173dcfaa30a8b25cec36343ae16fbd2e01b7f..5db7a9f8d312fe2e4df13d78a851466bf298fd22 100644 (file)
@@ -214,12 +214,16 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
              GEOM::GEOM_IShapesOperations_var aShapesOp =
                      getGeomEngine()->GetIShapesOperations( getStudyId() );
              int anIndex = aMap( 1 );
-             TopTools_IndexedMapOfShape aShapes;
-             TopExp::MapShapes( aShape, aShapes );
-             aShape = aShapes.FindKey( anIndex );
+             aName += QString(":vertex_%1").arg(anIndex);
              aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
              aSelMgr->clearSelected();
            }
+         else {
+           if (aShape.ShapeType() != TopAbs_VERTEX) {
+             aSelectedObject = GEOM::GEOM_Object::_nil();
+             aName = "";
+           }
+         }
        }
 
       myPoint = aSelectedObject;
@@ -257,10 +261,10 @@ void TransformationGUI_ScaleDlg::LineEditReturnPressed()
 void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
+  globalSelection();
 
   if(send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    globalSelection();
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
index 24dc59016a9e3433ac251c7efeb6f7ab5db37c9d..f41b0eb7cac5174bf5cde8f7f2a3c335b222afad 100644 (file)
@@ -287,6 +287,10 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
     aName = GEOMBase::GetName( aSelectedObject );
     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
       {
+       TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+       if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
+         aNeedType = TopAbs_EDGE;
+
        LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
        TColStd_IndexedMapOfInteger aMap;
        aSelMgr->GetIndexes( firstIObject(), aMap );
@@ -294,13 +298,19 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
          {
            GEOM::GEOM_IShapesOperations_var aShapesOp =
              getGeomEngine()->GetIShapesOperations( getStudyId() );
-                   int anIndex = aMap( 1 );
-                   TopTools_IndexedMapOfShape aShapes;
-                   TopExp::MapShapes( aShape, aShapes );
-                   aShape = aShapes.FindKey( anIndex );
-                   aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-                   aSelMgr->clearSelected();
-         }
+           int anIndex = aMap( 1 );
+           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+           if (aNeedType == TopAbs_EDGE)
+             aName += QString(":edge_%1").arg(anIndex);
+           else
+             aName += QString(":vertex_%1").arg(anIndex);
+         } else // Global Selection
+           {
+             if (aShape.ShapeType() != aNeedType) {
+               aSelectedObject = GEOM::GEOM_Object::_nil();
+               aName = "";
+             }
+           }
       }
     
     if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
@@ -338,10 +348,10 @@ void TransformationGUI_TranslationDlg::LineEditReturnPressed()
 void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
+  globalSelection();
 
   if (send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    globalSelection();
   }
   else if (send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;