- if ( ( id == 1 || id == 2 ) && myEditCurrentArgument != 0 )
- {
- myEditCurrentArgument->setText("");
- myX->setText( "" );
- myY->setText( "" );
- myZ->setText( "" );
- myRefPoint = myEdge = GEOM::GEOM_Object::_nil();
- }
-
- if ( IObjectCount() == 1 )
- {
- Standard_Boolean aRes = Standard_False;
- GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
- if ( !CORBA::is_nil( aSelectedObject ) && aRes )
- {
- if ( id == 0 )
- {
- // get CORBA reference to data object
- TopoDS_Shape aShape = myGeometryGUI->GetShapeReader().GetShape( myGeometryGUI->GetGeomGen(), aSelectedObject );
- if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
- {
- gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
- GroupXYZ->SpinBox_DX->SetValue( aPnt.X() );
- GroupXYZ->SpinBox_DY->SetValue( aPnt.Y() );
- GroupXYZ->SpinBox_DZ->SetValue( aPnt.Z() );
- }
- }
- else if ( id == 1 )
- {
- myRefPoint = aSelectedObject;
- GroupRefPoint->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
- }
- else if ( id == 2 )
- {
- myEdge = aSelectedObject;
- GroupOnCurve->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
- }
- }
+ if ( ( id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF ) && myEditCurrentArgument != 0 )
+ {
+ myEditCurrentArgument->setText( "" );
+ myX->setText( "" );
+ myY->setText( "" );
+ myZ->setText( "" );
+ myRefPoint = myEdge = myFace = GEOM::GEOM_Object::_nil();
+ } else if ( id == GEOM_POINT_INTINT ) {
+ myEditCurrentArgument->setText( "" );
+ if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 )
+ myLine1 = GEOM::GEOM_Object::_nil();
+ else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 )
+ myLine2 = GEOM::GEOM_Object::_nil();
+ }
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ SALOME_ListIO aSelList;
+ aSelMgr->selectedObjects(aSelList);
+
+ if (aSelList.Extent() == 1) {
+ Standard_Boolean aRes = Standard_False;
+ Handle(SALOME_InteractiveObject) anIO = aSelList.First();
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
+ if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
+ QString aName = GEOMBase::GetName(aSelectedObject);
+ TopoDS_Shape aShape;
+ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
+ if ( id == GEOM_POINT_XYZ || id == GEOM_POINT_REF)
+ myNeedType = TopAbs_VERTEX;
+ else if ( id == GEOM_POINT_EDGE )
+ myNeedType = TopAbs_EDGE;
+ else if ( id == GEOM_POINT_SURF )
+ myNeedType = TopAbs_FACE;
+
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(anIO, aMap);
+ if ( aMap.Extent() == 1 ) { // Local Selection
+ int anIndex = aMap( 1 );
+ if ( myNeedType == TopAbs_FACE )
+ aName += QString( ":face_%1" ).arg( anIndex );
+ else if ( myNeedType == TopAbs_WIRE )
+ aName += QString( ":wire_%1" ).arg( anIndex );
+ else if ( myNeedType == TopAbs_EDGE )
+ aName += QString( ":edge_%1" ).arg( anIndex );
+ else if ( myNeedType == TopAbs_VERTEX )
+ aName += QString( ":vertex_%1" ).arg( anIndex );
+
+ //Find SubShape Object in Father
+ GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+ GEOM::GEOM_IShapesOperations_var aShapesOp =
+ getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ else {
+ aSelectedObject = aFindedObject; // get Object from study
+ }
+ GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE );
+ }
+ else { // Global Selection
+ if ( aShape.ShapeType() != myNeedType ) {
+ aSelectedObject = GEOM::GEOM_Object::_nil();
+ aName = "";
+ if ( id == GEOM_POINT_XYZ ) return;
+ }
+ }
+ }
+
+ if ( aShape.IsNull() || aShape.ShapeType() != myNeedType)
+ return;
+
+ if ( id == GEOM_POINT_XYZ ) {
+ gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
+ GroupXYZ->SpinBox_DX->setValue( aPnt.X() );
+ GroupXYZ->SpinBox_DY->setValue( aPnt.Y() );
+ GroupXYZ->SpinBox_DZ->setValue( aPnt.Z() );
+ }
+ else if ( id == GEOM_POINT_REF ) {
+ myRefPoint = aSelectedObject;
+ GroupRefPoint->LineEdit1->setText( aName );
+ }
+ else if ( id == GEOM_POINT_EDGE ) {
+ myEdge = aSelectedObject;
+ GroupOnCurve->LineEdit1->setText( aName );
+ }
+ else if ( id == GEOM_POINT_INTINT ) {
+ myEditCurrentArgument->setText( aName );
+ if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) {
+ myLine1 = aSelectedObject;
+ if ( !myLine1->_is_nil() && myLine2->_is_nil() ) {
+ GroupLineIntersection->PushButton2->setMenu( 0 );
+ GroupLineIntersection->PushButton2->click();
+ GroupLineIntersection->PushButton2->setDown(true);
+ GroupLineIntersection->PushButton2->setMenu( myBtnPopup );
+ }
+ }
+ else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) {
+ myLine2 = aSelectedObject;
+ if ( !myLine2->_is_nil() && myLine1->_is_nil() ) {
+ GroupLineIntersection->PushButton1->setMenu( 0 );
+ GroupLineIntersection->PushButton1->click();
+ GroupLineIntersection->PushButton1->setDown(true);
+ GroupLineIntersection->PushButton1->setMenu( myBtnPopup );
+ }
+ }
+ }
+ else if ( id == GEOM_POINT_SURF )
+ {
+ myFace = aSelectedObject;
+ GroupOnSurface->LineEdit1->setText( aName );
+ }