NPAL 18363

This commit is contained in:
dmv 2007-12-19 14:15:59 +00:00
parent 156fe6ad40
commit 0d45320fe4
6 changed files with 95 additions and 61 deletions

View File

@ -241,11 +241,19 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
if(!testResult || CORBA::is_nil( myArgument )) if(!testResult || CORBA::is_nil( myArgument ))
return; return;
aName = GEOMBase::GetName( aSelectedObject );
if ( testResult && !aSelectedObject->_is_nil() ) if ( testResult && !aSelectedObject->_is_nil() )
{ {
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) 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(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes( firstIObject(), aMap ); aSelMgr->GetIndexes( firstIObject(), aMap );
@ -254,15 +262,23 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() ); getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 ); int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes; int id = getConstructorId();
TopExp::MapShapes( aShape, aShapes ); if (aNeedType == TopAbs_VERTEX)
aShape = aShapes.FindKey( anIndex ); aName += QString(":vertex_%1").arg(anIndex);
else
aName += QString(":edge_%1").arg(anIndex);
myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex); myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected(); aSelMgr->clearSelected();
} }
else {
if (aShape.ShapeType() != aNeedType) {
myArgument = GEOM::GEOM_Object::_nil();
aName = "";
}
}
} }
} }
aName = GEOMBase::GetName( aSelectedObject );
} }
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
@ -293,10 +309,10 @@ void TransformationGUI_MirrorDlg::LineEditReturnPressed()
void TransformationGUI_MirrorDlg::SetEditCurrentArgument() void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
globalSelection();
if(send == GroupPoints->PushButton1){ if(send == GroupPoints->PushButton1){
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection();
} }
else if(send == GroupPoints->PushButton2) { else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
@ -304,15 +320,12 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
{ {
case 0: case 0:
{ {
// globalSelection( GEOM_POINT );
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
break; break;
} }
case 1: case 1:
{ {
//globalSelection( GEOM_LINE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
break; break;
} }
case 2: case 2:

View File

@ -288,6 +288,8 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject)) if (!testResult || CORBA::is_nil(aSelectedObject) || !GEOMBase::IsShape(aSelectedObject))
return; return;
QString aName = GEOMBase::GetName( aSelectedObject );
if (myEditCurrentArgument == GroupPoints->LineEdit1 || if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
myEditCurrentArgument == GroupDimensions->LineEdit1) myEditCurrentArgument == GroupDimensions->LineEdit1)
myBase = aSelectedObject; myBase = aSelectedObject;
@ -297,6 +299,7 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
{ {
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
{ {
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@ -307,18 +310,22 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() ); getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 ); int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes; aName += QString(":edge_%1").arg(anIndex);
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex); myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected(); aSelMgr->clearSelected();
} }
else else {
if (aShape.ShapeType() != TopAbs_EDGE) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
myVector = aSelectedObject; myVector = aSelectedObject;
} }
} }
} }
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); }
myEditCurrentArgument->setText( aName );
displayPreview(); displayPreview();
} }
@ -331,26 +338,21 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
globalSelection( GEOM_ALLSHAPES );
if(send == GroupPoints->PushButton1) { if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection( GEOM_ALLSHAPES );
} }
else if(send == GroupPoints->PushButton2) { else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
// globalSelection( GEOM_LINE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
} }
else if(send == GroupDimensions->PushButton1) { else if(send == GroupDimensions->PushButton1) {
myEditCurrentArgument = GroupDimensions->LineEdit1; myEditCurrentArgument = GroupDimensions->LineEdit1;
globalSelection( GEOM_ALLSHAPES );
} }
else if(send == GroupDimensions->PushButton2) { else if(send == GroupDimensions->PushButton2) {
myEditCurrentArgument = GroupDimensions->LineEdit2; myEditCurrentArgument = GroupDimensions->LineEdit2;
// globalSelection( GEOM_LINE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();

View File

@ -305,6 +305,8 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) ) if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) )
return; return;
QString aName = GEOMBase::GetName( aSelectedObject );
if (myEditCurrentArgument == GroupPoints->LineEdit1 || if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
myEditCurrentArgument == GroupDimensions->LineEdit1) myEditCurrentArgument == GroupDimensions->LineEdit1)
myBase = aSelectedObject; myBase = aSelectedObject;
@ -325,16 +327,17 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() ); getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 ); int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes; aName += QString(":edge_%1").arg(anIndex);
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
aSelMgr->clearSelected();
if ( myEditCurrentArgument == GroupDimensions->LineEdit3 ) if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex); myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
else else
myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex); myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
} }
else else {
if (aShape.ShapeType() != TopAbs_EDGE) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
if ( myEditCurrentArgument == GroupDimensions->LineEdit3 ) if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
myVectorV = aSelectedObject; myVectorV = aSelectedObject;
else else
@ -342,8 +345,9 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
} }
} }
} }
}
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); myEditCurrentArgument->setText( aName );
displayPreview(); displayPreview();
} }
@ -356,32 +360,25 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
globalSelection( GEOM_ALLSHAPES );
if(send == GroupPoints->PushButton1) { if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection( GEOM_ALLSHAPES );
} }
else if(send == GroupPoints->PushButton2) { else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
// globalSelection( GEOM_LINE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
} }
else if(send == GroupDimensions->PushButton1) { else if(send == GroupDimensions->PushButton1) {
myEditCurrentArgument = GroupDimensions->LineEdit1; myEditCurrentArgument = GroupDimensions->LineEdit1;
globalSelection( GEOM_ALLSHAPES );
} }
else if(send == GroupDimensions->PushButton2) { else if(send == GroupDimensions->PushButton2) {
myEditCurrentArgument = GroupDimensions->LineEdit2; myEditCurrentArgument = GroupDimensions->LineEdit2;
// globalSelection( GEOM_LINE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
} }
else if(send == GroupDimensions->PushButton3) { else if(send == GroupDimensions->PushButton3) {
myEditCurrentArgument = GroupDimensions->LineEdit3; myEditCurrentArgument = GroupDimensions->LineEdit3;
// globalSelection( GEOM_LINE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();

View File

@ -273,6 +273,10 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) 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(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes( firstIObject(), aMap ); aSelMgr->GetIndexes( firstIObject(), aMap );
@ -281,12 +285,19 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() ); getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 ); int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes; if (aNeedType == TopAbs_EDGE)
TopExp::MapShapes( aShape, aShapes ); aName += QString(":edge_%1").arg(anIndex);
aShape = aShapes.FindKey( anIndex ); else
aName += QString(":vertex_%1").arg(anIndex);
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected(); aSelMgr->clearSelected();
} }
else {
if (aShape.ShapeType() != aNeedType) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
}
} }
if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
@ -312,18 +323,15 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
void TransformationGUI_RotationDlg::SetEditCurrentArgument() void TransformationGUI_RotationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
globalSelection();
if(send == GroupPoints->PushButton1) { if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection();
} }
else if(send == GroupPoints->PushButton2) { else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
if (getConstructorId() == 0) { if (getConstructorId() == 0)
//globalSelection( GEOM_LINE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE );
}
else else
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
} }

View File

@ -214,12 +214,16 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() ); getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 ); int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes; aName += QString(":vertex_%1").arg(anIndex);
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected(); aSelMgr->clearSelected();
} }
else {
if (aShape.ShapeType() != TopAbs_VERTEX) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
}
} }
myPoint = aSelectedObject; myPoint = aSelectedObject;
@ -257,10 +261,10 @@ void TransformationGUI_ScaleDlg::LineEditReturnPressed()
void TransformationGUI_ScaleDlg::SetEditCurrentArgument() void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
globalSelection();
if(send == GroupPoints->PushButton1) { if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection();
} }
else if(send == GroupPoints->PushButton2) { else if(send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;

View File

@ -287,6 +287,10 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
aName = GEOMBase::GetName( aSelectedObject ); aName = GEOMBase::GetName( aSelectedObject );
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) 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(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes( firstIObject(), aMap ); aSelMgr->GetIndexes( firstIObject(), aMap );
@ -295,11 +299,17 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() ); getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 ); int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex );
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected(); 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 = "";
}
} }
} }
@ -338,10 +348,10 @@ void TransformationGUI_TranslationDlg::LineEditReturnPressed()
void TransformationGUI_TranslationDlg::SetEditCurrentArgument() void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
globalSelection();
if (send == GroupPoints->PushButton1) { if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection();
} }
else if (send == GroupPoints->PushButton2) { else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;