NPAL18363: EDF635: We can now select any object in all window.

This commit is contained in:
jfa 2007-12-19 12:21:31 +00:00
parent e8b2a375db
commit 582aab65e3
9 changed files with 555 additions and 512 deletions

View File

@ -161,8 +161,8 @@ void BasicGUI_ArcDlg::Init()
connect(Group3Pnts2->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int))); connect(Group3Pnts2->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int)));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_ARC" )); initName( tr( "GEOM_ARC" ));
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
@ -181,6 +181,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked (int constructorId)
{ {
case 0: case 0:
{ {
globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes
Group3Pnts->show(); Group3Pnts->show();
@ -197,6 +198,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked (int constructorId)
} }
case 1: case 1:
{ {
globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes
Group3Pnts->hide(); Group3Pnts->hide();
@ -247,7 +249,6 @@ bool BasicGUI_ArcDlg::ClickOnApply()
return true; return true;
} }
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case // purpose : Called when selection as changed or other case
@ -287,22 +288,30 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) if (!CORBA::is_nil(aSelectedObject) && aRes)
{ {
QString aName = GEOMBase::GetName(aSelectedObject);
// Get Selected object if selected subshape // Get Selected object if selected subshape
TopoDS_Shape aShape; TopoDS_Shape aShape;
QString aName = GEOMBase::GetName( aSelectedObject );
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();
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(firstIObject(), aMap); aSelMgr->GetIndexes(firstIObject(), aMap);
if ( aMap.Extent() == 1 ) if (aMap.Extent() == 1) // Local Selection
{ {
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap(1); int anIndex = aMap(1);
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected(); aSelMgr->clearSelected(); // ???
aName.append( ":vertex_" + QString::number( anIndex ) );
aName += QString(":vertex_%1").arg(anIndex);
}
else // Global Selection
{
if (aShape.ShapeType() != TopAbs_VERTEX) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
} }
} }
@ -330,7 +339,6 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
displayPreview(); displayPreview();
} }
//================================================================================= //=================================================================================
// function : LineEditReturnPressed() // function : LineEditReturnPressed()
// purpose : // purpose :

View File

@ -113,8 +113,9 @@ void BasicGUI_CurveDlg::Init()
myPoints = new GEOM::ListOfGO(); myPoints = new GEOM::ListOfGO();
myPoints->length( 0 ); myPoints->length( 0 );
// globalSelection( GEOM_POINT ); globalSelection(GEOM_POINT);
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //globalSelection(); // close local contexts, if any
//localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
/* signals and slots connections */ /* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
@ -128,7 +129,7 @@ void BasicGUI_CurveDlg::Init()
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
initName( tr( "GEOM_CURVE" ) ); initName( tr( "GEOM_CURVE" ) );
@ -233,6 +234,7 @@ static int isPointInList(list<GEOM::GEOM_Object_var>& thePoints,
return -1; return -1;
} }
//================================================================================= //=================================================================================
/*! function : removeUnnecessaryPnt() /*! function : removeUnnecessaryPnt()
* purpose : Remove unnecessary points from list \a theOldPoints * purpose : Remove unnecessary points from list \a theOldPoints
@ -374,13 +376,12 @@ void BasicGUI_CurveDlg::SelectionIntoArgument()
void BasicGUI_CurveDlg::ActivateThisDialog() void BasicGUI_CurveDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); this, SLOT(SelectionIntoArgument()));
// myGeomGUI->SetState( 0 ); globalSelection(GEOM_POINT);
//globalSelection(); // close local contexts, if any
// globalSelection( GEOM_POINT ); //localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }

View File

@ -108,12 +108,11 @@ void BasicGUI_EllipseDlg::Init()
{ {
/* init variables */ /* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
myPoint = myDir = GEOM::GEOM_Object::_nil(); myPoint = myDir = GEOM::GEOM_Object::_nil();
// myGeomGUI->SetState( 0 );
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
@ -143,16 +142,17 @@ void BasicGUI_EllipseDlg::Init()
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
GroupPoints->SpinBox_DY, SLOT(SetStep(double)));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
initName( tr( "GEOM_ELLIPSE" ) ); initName( tr( "GEOM_ELLIPSE" ) );
} }
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
@ -163,7 +163,6 @@ void BasicGUI_EllipseDlg::ClickOnOk()
ClickOnCancel(); ClickOnCancel();
} }
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
@ -180,7 +179,9 @@ bool BasicGUI_EllipseDlg::ClickOnApply()
GroupPoints->LineEdit1->setText( "" ); GroupPoints->LineEdit1->setText( "" );
GroupPoints->LineEdit2->setText( "" ); GroupPoints->LineEdit2->setText( "" );
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection( GEOM_POINT ); //globalSelection(GEOM_POINT);
globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
return true; return true;
} }
@ -210,29 +211,42 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
} }
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = firstIObject();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) if (!CORBA::is_nil(aSelectedObject) && aRes)
{ {
QString aName = GEOMBase::GetName(aSelectedObject);
// Get Selected object if selected subshape // Get Selected object if selected subshape
TopoDS_Shape aShape; TopoDS_Shape aShape;
QString 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)
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(anIO, aMap);
if (aMap.Extent() == 1) if (aMap.Extent() == 1)
{ {
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap(1); int anIndex = aMap(1);
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) aSelMgr->clearSelected(); // ???
aName.append( ":edge_" + QString::number( anIndex ) );
if (aNeedType == TopAbs_EDGE)
aName += QString(":edge_%1").arg(anIndex);
else else
aName.append( ":vertex_" + QString::number( anIndex ) ); aName += QString(":vertex_%1").arg(anIndex);
aSelMgr->clearSelected(); }
else // Global Selection
{
if (aShape.ShapeType() != aNeedType) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
} }
} }
@ -259,6 +273,7 @@ void BasicGUI_EllipseDlg::SetEditCurrentArgument()
else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2; else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
globalSelection(); // close local contexts, if any
if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
else else
@ -289,8 +304,8 @@ void BasicGUI_EllipseDlg::LineEditReturnPressed()
void BasicGUI_EllipseDlg::ActivateThisDialog() void BasicGUI_EllipseDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); this, SLOT(SelectionIntoArgument()));
GroupPoints->LineEdit1->setFocus(); GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
@ -299,7 +314,9 @@ void BasicGUI_EllipseDlg::ActivateThisDialog()
GroupPoints->LineEdit2->setText( "" ); GroupPoints->LineEdit2->setText( "" );
myPoint = myDir = GEOM::GEOM_Object::_nil(); myPoint = myDir = GEOM::GEOM_Object::_nil();
globalSelection( GEOM_POINT ); //globalSelection( GEOM_POINT );
globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
} }
//================================================================================= //=================================================================================

View File

@ -101,7 +101,6 @@ BasicGUI_LineDlg::BasicGUI_LineDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
Init(); Init();
} }
//================================================================================= //=================================================================================
// function : ~BasicGUI_LineDlg() // function : ~BasicGUI_LineDlg()
// purpose : Destroys the object and frees any allocated resources // purpose : Destroys the object and frees any allocated resources
@ -110,7 +109,6 @@ BasicGUI_LineDlg::~BasicGUI_LineDlg()
{ {
} }
//================================================================================= //=================================================================================
// function : Init() // function : Init()
// purpose : // purpose :
@ -118,12 +116,10 @@ BasicGUI_LineDlg::~BasicGUI_LineDlg()
void BasicGUI_LineDlg::Init() void BasicGUI_LineDlg::Init()
{ {
/* init variables */ /* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1; //myEditCurrentArgument = GroupPoints->LineEdit1;
//myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); //globalSelection(); // close local contexts, if any
//localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
// myGeomGUI->SetState( 0 );
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
/* signals and slots connections */ /* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
@ -144,14 +140,13 @@ void BasicGUI_LineDlg::Init()
connect(GroupFaces->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupFaces->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupFaces->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupFaces->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); this, SLOT(SelectionIntoArgument()));
ConstructorsClicked(0); ConstructorsClicked(0);
initName( tr("GEOM_LINE") ); initName( tr("GEOM_LINE") );
} }
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
@ -162,10 +157,10 @@ void BasicGUI_LineDlg::ClickOnOk()
ClickOnCancel(); ClickOnCancel();
} }
//======================================================================= //=================================================================================
// function : ClickOnCancel() // function : ClickOnCancel()
// purpose : // purpose :
//======================================================================= //=================================================================================
void BasicGUI_LineDlg::ClickOnCancel() void BasicGUI_LineDlg::ClickOnCancel()
{ {
GEOMBase_Skeleton::ClickOnCancel(); GEOMBase_Skeleton::ClickOnCancel();
@ -179,14 +174,9 @@ bool BasicGUI_LineDlg::ClickOnApply()
{ {
if ( !onAccept() ) if ( !onAccept() )
return false; return false;
GroupPoints->LineEdit1->setText( "" );
GroupPoints->LineEdit2->setText( "" );
GroupFaces->LineEdit1->setText( "" );
GroupFaces->LineEdit2->setText( "" );
myPoint1 = myPoint2 = myFace1 = myFace2 = GEOM::GEOM_Object::_nil();
myEditCurrentArgument = GroupPoints->LineEdit1;
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select vertex on all shapes
initName(); initName();
ConstructorsClicked(getConstructorId());
return true; return true;
} }
@ -200,8 +190,9 @@ void BasicGUI_LineDlg::ConstructorsClicked(int constructorId)
{ {
case 0: case 0:
{ {
globalSelection(GEOM_POINT); // to break previous local selection globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
myPoint1 = GEOM::GEOM_Object::_nil(); myPoint1 = GEOM::GEOM_Object::_nil();
@ -212,8 +203,9 @@ void BasicGUI_LineDlg::ConstructorsClicked(int constructorId)
} }
case 1: case 1:
{ {
globalSelection(GEOM_PLANE); // to break previous local selection globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
myEditCurrentArgument = GroupFaces->LineEdit1; myEditCurrentArgument = GroupFaces->LineEdit1;
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
myFace1 = GEOM::GEOM_Object::_nil(); myFace1 = GEOM::GEOM_Object::_nil();
@ -251,28 +243,40 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) if (!CORBA::is_nil(aSelectedObject) && aRes)
{ {
TopoDS_Shape aShape;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
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 == GroupFaces->LineEdit1 ||
myEditCurrentArgument == GroupFaces->LineEdit2)
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);
if ( aMap.Extent() == 1 ) if (aMap.Extent() == 1) // Local Selection
{ {
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 ); int anIndex = aMap( 1 );
if ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
myEditCurrentArgument == GroupFaces->LineEdit2 )
aName.append( ":face_" + QString::number( anIndex ) );
else
aName.append( ":vertex_" + QString::number( anIndex ) );
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected(); aSelMgr->clearSelected(); // ???
if (aNeedType == TopAbs_FACE)
aName += QString(":face_%1").arg(anIndex);
else
aName += QString(":vertex_%1").arg(anIndex);
}
else // Global Selection
{
if (aShape.ShapeType() != aNeedType) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
} }
} }
}
myEditCurrentArgument->setText(aName); myEditCurrentArgument->setText(aName);
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject;
@ -284,7 +288,6 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
displayPreview(); displayPreview();
} }
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -300,7 +303,6 @@ void BasicGUI_LineDlg::SetEditCurrentArgument()
SelectionIntoArgument(); SelectionIntoArgument();
} }
//================================================================================= //=================================================================================
// function : LineEditReturnPressed() // function : LineEditReturnPressed()
// purpose : // purpose :
@ -316,7 +318,6 @@ void BasicGUI_LineDlg::LineEditReturnPressed()
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
@ -324,20 +325,10 @@ void BasicGUI_LineDlg::LineEditReturnPressed()
void BasicGUI_LineDlg::ActivateThisDialog() void BasicGUI_LineDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); this, SLOT(SelectionIntoArgument()));
// myGeomGUI->SetState( 0 ); ConstructorsClicked(getConstructorId());
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setFocus();
GroupPoints->LineEdit1->setText( "" );
GroupPoints->LineEdit2->setText( "" );
GroupFaces->LineEdit1->setText( "" );
GroupFaces->LineEdit2->setText( "" );
myPoint1 = myPoint2 = myFace1 = myFace2 = GEOM::GEOM_Object::_nil();
} }
//================================================================================= //=================================================================================
@ -346,7 +337,6 @@ void BasicGUI_LineDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void BasicGUI_LineDlg::DeactivateActiveDialog() void BasicGUI_LineDlg::DeactivateActiveDialog()
{ {
// myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog(); GEOMBase_Skeleton::DeactivateActiveDialog();
} }
@ -420,4 +410,3 @@ void BasicGUI_LineDlg::closeEvent( QCloseEvent* e )
{ {
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );
} }

View File

@ -124,7 +124,6 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th
Init(); Init();
} }
//================================================================================= //=================================================================================
// function : ~BasicGUI_MarkerDlg() // function : ~BasicGUI_MarkerDlg()
// purpose : Destroys the object and frees any allocated resources // purpose : Destroys the object and frees any allocated resources
@ -133,7 +132,6 @@ BasicGUI_MarkerDlg::~BasicGUI_MarkerDlg()
{ {
} }
//================================================================================= //=================================================================================
// function : Init() // function : Init()
// purpose : // purpose :
@ -166,7 +164,7 @@ void BasicGUI_MarkerDlg::Init()
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( onOk() ) ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( onOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) ); connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) );
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
initName( tr( "LCS_NAME" ) ); initName( tr( "LCS_NAME" ) );
@ -190,7 +188,6 @@ void BasicGUI_MarkerDlg::Init()
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
//@ //@
/* /*
QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()-> QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()->
@ -217,6 +214,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId )
{ {
if ( myConstructorId == constructorId && myConstructorId == 0 ) if ( myConstructorId == constructorId && myConstructorId == 0 )
{ {
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
activate( GEOM_MARKER ); activate( GEOM_MARKER );
displayPreview(); displayPreview();
@ -225,7 +223,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId )
myConstructorId = constructorId; myConstructorId = constructorId;
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
switch (constructorId) switch (constructorId)
{ {
@ -235,6 +233,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId )
Group2->hide(); Group2->hide();
resize(0, 0); resize(0, 0);
aMainGrp->show(); aMainGrp->show();
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
activate( GEOM_MARKER ); activate( GEOM_MARKER );
break; break;
@ -258,6 +257,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId )
//PAL6669: resize(0, 0); //PAL6669: resize(0, 0);
Group2->show(); Group2->show();
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
myEditCurrentArgument = Group2->LineEdit1; myEditCurrentArgument = Group2->LineEdit1;
Group2->LineEdit1->setText(""); Group2->LineEdit1->setText("");
@ -267,8 +267,8 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId )
} }
} }
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone())); this, SLOT(onSelectionDone()));
onSelectionDone(); onSelectionDone();
} }
@ -356,13 +356,13 @@ void BasicGUI_MarkerDlg::onSelectionDone0()
{ {
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(anIO, aMap); aSelMgr->GetIndexes(anIO, aMap);
if ( aMap.Extent() == 1 ) if (aMap.Extent() == 1) // Local Selection
{ {
int anIndex = aMap(1); int anIndex = aMap(1);
TopTools_IndexedMapOfShape aShapes; TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes(aShape, aShapes); TopExp::MapShapes(aShape, aShapes);
aShape = aShapes.FindKey(anIndex); aShape = aShapes.FindKey(anIndex);
aSelMgr->clearSelected(); aSelMgr->clearSelected(); // ???
} }
if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX) if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX)
@ -380,7 +380,6 @@ void BasicGUI_MarkerDlg::onSelectionDone0()
displayPreview(); displayPreview();
} }
//================================================================================= //=================================================================================
// function : onSelectionDone() // function : onSelectionDone()
// purpose : Called when selection as changed or other case // purpose : Called when selection as changed or other case
@ -393,7 +392,6 @@ void BasicGUI_MarkerDlg::onSelectionDone()
} }
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aName;
if (IObjectCount() == 1) { if (IObjectCount() == 1) {
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
@ -401,7 +399,7 @@ void BasicGUI_MarkerDlg::onSelectionDone()
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
if (!CORBA::is_nil(aSelectedObj) && aRes) { if (!CORBA::is_nil(aSelectedObj) && aRes) {
aName = GEOMBase::GetName( aSelectedObj ); QString aName = GEOMBase::GetName(aSelectedObj);
if (getConstructorId() == 1) { // by shape position if (getConstructorId() == 1) { // by shape position
// Get shape's position // Get shape's position
@ -441,8 +439,11 @@ void BasicGUI_MarkerDlg::onSelectionDone()
} }
else if (getConstructorId() == 2) { // by point and two vectors else if (getConstructorId() == 2) { // by point and two vectors
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) { if (GEOMBase::GetShape(aSelectedObj, aShape, TopAbs_SHAPE))
GEOM::short_array anIndexes; {
TopAbs_ShapeEnum aNeedType = TopAbs_EDGE;
if (myEditCurrentArgument == Group2->LineEdit1)
aNeedType = TopAbs_VERTEX;
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@ -453,6 +454,11 @@ void BasicGUI_MarkerDlg::onSelectionDone()
TopTools_IndexedMapOfShape aShapes; TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes(aShape, aShapes); TopExp::MapShapes(aShape, aShapes);
aShape = aShapes.FindKey(anIndex); aShape = aShapes.FindKey(anIndex);
if (aNeedType == TopAbs_EDGE)
aName += QString("_edge_%1").arg(anIndex);
else
aName += QString("_vertex_%1").arg(anIndex);
} }
if (myEditCurrentArgument == Group2->LineEdit1) { if (myEditCurrentArgument == Group2->LineEdit1) {
@ -557,16 +563,19 @@ void BasicGUI_MarkerDlg::SetEditCurrentArgument()
} }
else if (send == Group2->PushButton1) { else if (send == Group2->PushButton1) {
myEditCurrentArgument = Group2->LineEdit1; myEditCurrentArgument = Group2->LineEdit1;
globalSelection( GEOM_POINT ); //globalSelection( GEOM_POINT );
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
} }
else if (send == Group2->PushButton2) { else if (send == Group2->PushButton2) {
myEditCurrentArgument = Group2->LineEdit2; myEditCurrentArgument = Group2->LineEdit2;
globalSelection( GEOM_LINE ); //globalSelection( GEOM_LINE );
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} }
else if (send == Group2->PushButton3) { else if (send == Group2->PushButton3) {
myEditCurrentArgument = Group2->LineEdit3; myEditCurrentArgument = Group2->LineEdit3;
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} }
@ -593,8 +602,8 @@ void BasicGUI_MarkerDlg::LineEditReturnPressed()
void BasicGUI_MarkerDlg::onActivate() void BasicGUI_MarkerDlg::onActivate()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); this, SLOT(onSelectionDone()));
ConstructorsClicked(getConstructorId()); ConstructorsClicked(getConstructorId());
} }
@ -666,8 +675,8 @@ bool BasicGUI_MarkerDlg::isValid( QString& msg )
//================================================================================= //=================================================================================
bool BasicGUI_MarkerDlg::execute( ObjectList& objects ) bool BasicGUI_MarkerDlg::execute( ObjectList& objects )
{ {
GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow( GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow(getOperation())->
getOperation() )->MakeMarker( myData[ X ]->GetValue(), myData[ Y ]->GetValue(), myData[ Z ]->GetValue(), MakeMarker(myData[ X ]->GetValue(), myData[ Y ]->GetValue(), myData[ Z ]->GetValue(),
myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue(), myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue(),
myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue()); myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue());

View File

@ -183,7 +183,7 @@ void BasicGUI_PlaneDlg::Init()
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Pnts->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Pnts->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupFace->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupFace->SpinBox_DX, SLOT(SetStep(double)));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_PLANE" ) ); initName( tr( "GEOM_PLANE" ) );
@ -199,7 +199,7 @@ void BasicGUI_PlaneDlg::Init()
//================================================================================= //=================================================================================
void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
{ {
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil(); myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil();
switch (constructorId) switch (constructorId)
@ -216,7 +216,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
GroupPntDir->LineEdit2->setText(tr("")); GroupPntDir->LineEdit2->setText(tr(""));
/* for the first argument */ /* for the first argument */
globalSelection( GEOM_POINT ); // to break previous local selection globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
break; break;
} }
@ -233,7 +233,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
Group3Pnts->LineEdit3->setText(""); Group3Pnts->LineEdit3->setText("");
/* for the first argument */ /* for the first argument */
globalSelection( GEOM_POINT ); // to break previous local selection globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
break; break;
} }
@ -248,7 +248,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
GroupFace->LineEdit1->setText(tr("")); GroupFace->LineEdit1->setText(tr(""));
/* for the first argument */ /* for the first argument */
globalSelection( GEOM_PLANE ); //globalSelection( GEOM_PLANE );
TColStd_MapOfInteger aMap; TColStd_MapOfInteger aMap;
aMap.Add( GEOM_PLANE ); aMap.Add( GEOM_PLANE );
aMap.Add( GEOM_MARKER ); aMap.Add( GEOM_MARKER );
@ -258,11 +258,10 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); this, SLOT(SelectionIntoArgument()));
} }
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
@ -273,7 +272,6 @@ void BasicGUI_PlaneDlg::ClickOnOk()
ClickOnCancel(); ClickOnCancel();
} }
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
@ -321,28 +319,43 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) if (!CORBA::is_nil(aSelectedObject) && aRes)
{ {
TopoDS_Shape aShape;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
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 == GroupPntDir->LineEdit2)
aNeedType = TopAbs_EDGE;
else if (myEditCurrentArgument == GroupFace->LineEdit1)
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);
if ( aMap.Extent() == 1 ) if (aMap.Extent() == 1) // Local Selection
{ {
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap(1); int anIndex = aMap(1);
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) aSelMgr->clearSelected(); // ???
aName.append( ":edge_" + QString::number( anIndex ) );
else
aName.append( ":vertex_" + QString::number( anIndex ) );
aSelMgr->clearSelected(); if (aNeedType == TopAbs_EDGE)
aName += QString(":edge_%1").arg(anIndex);
else if (aNeedType == TopAbs_FACE)
aName += QString(":face_%1").arg(anIndex);
else
aName += QString(":vertex_%1").arg(anIndex);
}
else // Global Selection
{
if (aShape.ShapeType() != aNeedType) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
} }
} }
}
myEditCurrentArgument->setText(aName); myEditCurrentArgument->setText(aName);
if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject; if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject;
@ -352,6 +365,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject; else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = aSelectedObject;
else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = aSelectedObject; else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = aSelectedObject;
} }
displayPreview(); displayPreview();
} }
@ -374,22 +388,24 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument()
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) if (myEditCurrentArgument == GroupPntDir->LineEdit2) {
globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
}
else if (myEditCurrentArgument == GroupFace->LineEdit1) { else if (myEditCurrentArgument == GroupFace->LineEdit1) {
globalSelection( GEOM_PLANE );
TColStd_MapOfInteger aMap; TColStd_MapOfInteger aMap;
aMap.Add( GEOM_PLANE ); aMap.Add( GEOM_PLANE );
aMap.Add( GEOM_MARKER ); aMap.Add( GEOM_MARKER );
globalSelection( aMap ); globalSelection( aMap );
} }
else else { // 3 Pnts
globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
}
SelectionIntoArgument(); SelectionIntoArgument();
} }
//================================================================================= //=================================================================================
// function : LineEditReturnPressed() // function : LineEditReturnPressed()
// purpose : // purpose :
@ -409,7 +425,6 @@ void BasicGUI_PlaneDlg::LineEditReturnPressed()
} }
} }
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
@ -417,10 +432,8 @@ void BasicGUI_PlaneDlg::LineEditReturnPressed()
void BasicGUI_PlaneDlg::ActivateThisDialog() void BasicGUI_PlaneDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); this, SLOT(SelectionIntoArgument()));
// myGeomGUI->SetState( 0 );
ConstructorsClicked(getConstructorId()); ConstructorsClicked(getConstructorId());
} }
@ -431,7 +444,6 @@ void BasicGUI_PlaneDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void BasicGUI_PlaneDlg::DeactivateActiveDialog() void BasicGUI_PlaneDlg::DeactivateActiveDialog()
{ {
// myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog(); GEOMBase_Skeleton::DeactivateActiveDialog();
} }

View File

@ -140,7 +140,6 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren
Init(); Init();
} }
//================================================================================= //=================================================================================
// function : ~BasicGUI_PointDlg() // function : ~BasicGUI_PointDlg()
// purpose : Destructor // purpose : Destructor
@ -149,7 +148,6 @@ BasicGUI_PointDlg::~BasicGUI_PointDlg()
{ {
} }
//================================================================================= //=================================================================================
// function : Init() // function : Init()
// purpose : // purpose :
@ -213,34 +211,41 @@ void BasicGUI_PointDlg::Init()
connect(GroupRefPoint->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupRefPoint->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupRefPoint->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupRefPoint->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupOnCurve->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DX, SLOT(SetStep(double))); GroupOnCurve->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DY, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DZ, SLOT(SetStep(double))); GroupXYZ->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DY, SLOT(SetStep(double))); GroupXYZ->SpinBox_DY, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
GroupXYZ->SpinBox_DZ, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
GroupRefPoint->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
GroupRefPoint->SpinBox_DY, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)),
GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double)));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); this, SLOT(SelectionIntoArgument()));
initName( tr("GEOM_VERTEX") ); initName( tr("GEOM_VERTEX") );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
//================================================================================= //=================================================================================
// function : ConstructorsClicked() // function : ConstructorsClicked()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void BasicGUI_PointDlg::ConstructorsClicked (int constructorId) void BasicGUI_PointDlg::ConstructorsClicked (int constructorId)
{ {
globalSelection(); // close local contexts, if any
switch (constructorId) switch (constructorId)
{ {
case 0: case 0:
{ {
globalSelection( GEOM_POINT); // to break previous local selection
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
GroupRefPoint->hide(); GroupRefPoint->hide();
@ -255,7 +260,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
myEditCurrentArgument = GroupRefPoint->LineEdit1; myEditCurrentArgument = GroupRefPoint->LineEdit1;
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
myRefPoint = GEOM::GEOM_Object::_nil(); myRefPoint = GEOM::GEOM_Object::_nil();
globalSelection( GEOM_POINT); // to break previous local selection
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
GroupXYZ->hide(); GroupXYZ->hide();
@ -270,7 +275,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
myEditCurrentArgument = GroupOnCurve->LineEdit1; myEditCurrentArgument = GroupOnCurve->LineEdit1;
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
myEdge = GEOM::GEOM_Object::_nil(); myEdge = GEOM::GEOM_Object::_nil();
globalSelection( GEOM_LINE); // to break previous local selection
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
GroupXYZ->hide(); GroupXYZ->hide();
@ -287,7 +292,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
GroupLineIntersection->LineEdit2->setText(""); GroupLineIntersection->LineEdit2->setText("");
myLine1 = GEOM::GEOM_Object::_nil(); myLine1 = GEOM::GEOM_Object::_nil();
myLine2 = GEOM::GEOM_Object::_nil(); myLine2 = GEOM::GEOM_Object::_nil();
globalSelection( GEOM_EDGE); // to break previous local selection
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
GroupXYZ->hide(); GroupXYZ->hide();
@ -310,7 +315,6 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
SelectionIntoArgument(); SelectionIntoArgument();
} }
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
@ -321,7 +325,6 @@ void BasicGUI_PointDlg::ClickOnOk()
ClickOnCancel(); ClickOnCancel();
} }
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
@ -336,7 +339,6 @@ bool BasicGUI_PointDlg::ClickOnApply()
return true; return true;
} }
//================================================================================= //=================================================================================
// function : ClickOnCancel() // function : ClickOnCancel()
// purpose : // purpose :
@ -346,7 +348,6 @@ void BasicGUI_PointDlg::ClickOnCancel()
GEOMBase_Skeleton::ClickOnCancel(); GEOMBase_Skeleton::ClickOnCancel();
} }
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
// purpose : Called when selection as changed (for constructors not using local context) // purpose : Called when selection as changed (for constructors not using local context)
@ -369,36 +370,45 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = firstIObject(); Handle(SALOME_InteractiveObject) anIO = firstIObject();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
QString aName = GEOMBase::GetName( aSelectedObject );
if (!CORBA::is_nil(aSelectedObject) && aRes) if (!CORBA::is_nil(aSelectedObject) && aRes)
{ {
QString aName = GEOMBase::GetName(aSelectedObject);
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 (id == 2 || id == 3)
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);
if ( aMap.Extent() == 1 ) if (aMap.Extent() == 1) // Local Selection
{ {
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap(1); int anIndex = aMap(1);
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if ( id == 2 || id == 3 ) aSelMgr->clearSelected(); // ???
aName.append( ":edge_" + QString::number( anIndex ) );
if (aNeedType == TopAbs_EDGE)
aName += QString(":edge_%1").arg(anIndex);
else else
aName.append( ":vertex_" + QString::number( anIndex ) ); aName += QString(":vertex_%1").arg(anIndex);
aSelMgr->clearSelected(); }
else // Global Selection
{
if (aShape.ShapeType() != aNeedType) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
if (id == 0) return;
}
} }
} }
if (id == 0) if (id == 0)
{ {
GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ); if (aShape.IsNull()) return;
if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX )
return;
gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
GroupXYZ->SpinBox_DX->SetValue( aPnt.X() ); GroupXYZ->SpinBox_DX->SetValue( aPnt.X() );
GroupXYZ->SpinBox_DY->SetValue( aPnt.Y() ); GroupXYZ->SpinBox_DY->SetValue( aPnt.Y() );
@ -418,11 +428,11 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
{ {
if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) { if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) {
myLine1 = aSelectedObject; myLine1 = aSelectedObject;
GroupLineIntersection->LineEdit1->setText( aName ); myEditCurrentArgument->setText(aName);
} }
else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) { else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) {
myLine2 = aSelectedObject; myLine2 = aSelectedObject;
GroupLineIntersection->LineEdit2->setText( aName ); myEditCurrentArgument->setText(aName);
} }
} }
} }
@ -431,7 +441,6 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
displayPreview(); displayPreview();
} }
//================================================================================= //=================================================================================
// function : LineEditReturnPressed() // function : LineEditReturnPressed()
// purpose : // purpose :
@ -447,13 +456,14 @@ void BasicGUI_PointDlg::LineEditReturnPressed()
} }
} }
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
//================================================================================= //=================================================================================
void BasicGUI_PointDlg::SetEditCurrentArgument() void BasicGUI_PointDlg::SetEditCurrentArgument()
{ {
globalSelection(); // close local contexts, if any
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
globalSelection( GEOM_POINT); // to break previous local selection globalSelection( GEOM_POINT); // to break previous local selection
@ -497,7 +507,6 @@ void BasicGUI_PointDlg::enterEvent(QEvent* e)
ActivateThisDialog(); ActivateThisDialog();
} }
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
@ -509,7 +518,6 @@ void BasicGUI_PointDlg::ActivateThisDialog( )
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }
//================================================================================= //=================================================================================
// function : DeactivateActiveDialog() // function : DeactivateActiveDialog()
// purpose : public slot to deactivate if active // purpose : public slot to deactivate if active
@ -520,7 +528,6 @@ void BasicGUI_PointDlg::DeactivateActiveDialog()
GEOMBase_Skeleton::DeactivateActiveDialog(); GEOMBase_Skeleton::DeactivateActiveDialog();
} }
//================================================================================= //=================================================================================
// function : ValueChangedInSpinBox() // function : ValueChangedInSpinBox()
// purpose : // purpose :

View File

@ -160,7 +160,7 @@ void BasicGUI_VectorDlg::Init()
connect(GroupDimensions->CheckBox1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int))); connect(GroupDimensions->CheckBox1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int)));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr("GEOM_VECTOR") ); initName( tr("GEOM_VECTOR") );
@ -176,7 +176,7 @@ void BasicGUI_VectorDlg::Init()
//================================================================================= //=================================================================================
void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId ) void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId )
{ {
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myPoint1 = GEOM::GEOM_Object::_nil(); myPoint1 = GEOM::GEOM_Object::_nil();
myPoint2 = GEOM::GEOM_Object::_nil(); myPoint2 = GEOM::GEOM_Object::_nil();
@ -192,8 +192,9 @@ void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId )
GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit2->setText(""); GroupPoints->LineEdit2->setText("");
globalSelection(); // close local contexts, if any
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
break; break;
} }
@ -276,24 +277,32 @@ void BasicGUI_VectorDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) if (!CORBA::is_nil(aSelectedObject) && aRes)
{ {
TopoDS_Shape aShape;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
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();
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(firstIObject(), aMap); aSelMgr->GetIndexes(firstIObject(), aMap);
if ( aMap.Extent() == 1 ) if (aMap.Extent() == 1) // Local Selection
{ {
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap(1); int anIndex = aMap(1);
aName.append( ":vertex_" + QString::number( anIndex ) );
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected(); aSelMgr->clearSelected(); // ???
aName += QString(":vertex_%1").arg(anIndex);
}
else // Global Selection
{
if (aShape.ShapeType() != TopAbs_VERTEX) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
} }
} }
}
myEditCurrentArgument->setText(aName); myEditCurrentArgument->setText(aName);
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject;
@ -303,7 +312,6 @@ void BasicGUI_VectorDlg::SelectionIntoArgument()
displayPreview(); displayPreview();
} }
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -331,7 +339,6 @@ void BasicGUI_VectorDlg::LineEditReturnPressed()
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
@ -339,8 +346,8 @@ void BasicGUI_VectorDlg::LineEditReturnPressed()
void BasicGUI_VectorDlg::ActivateThisDialog() void BasicGUI_VectorDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); this, SLOT(SelectionIntoArgument()));
ConstructorsClicked(getConstructorId()); ConstructorsClicked(getConstructorId());
} }
@ -351,7 +358,6 @@ void BasicGUI_VectorDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void BasicGUI_VectorDlg::DeactivateActiveDialog() void BasicGUI_VectorDlg::DeactivateActiveDialog()
{ {
// myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog(); GEOMBase_Skeleton::DeactivateActiveDialog();
} }
@ -441,4 +447,3 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects )
return res; return res;
} }

View File

@ -316,7 +316,8 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
if (myEditCurrentArgument == Group1->LineEdit1) if (myEditCurrentArgument == Group1->LineEdit1)
myFace = aSelectedObject; myFace = aSelectedObject;
else if(myEditCurrentArgument == Group2->LineEdit1 || myEditCurrentArgument == Group2->LineEdit2) { else if (myEditCurrentArgument == Group2->LineEdit1 || myEditCurrentArgument == Group2->LineEdit2)
{
if ( aRes && !aSelectedObject->_is_nil() ) if ( aRes && !aSelectedObject->_is_nil() )
{ {
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -333,7 +334,7 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
TopTools_IndexedMapOfShape aShapes; TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes ); TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex ); aShape = aShapes.FindKey( anIndex );
aName = aName + " Edge_" + QString::number( anIndex ); aName = aName + ":edge_" + QString::number( anIndex );
if(myEditCurrentArgument == Group2->LineEdit1) if(myEditCurrentArgument == Group2->LineEdit1)
myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex); myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex);
else else
@ -355,7 +356,6 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
updateWPlane(); updateWPlane();
} }
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -383,7 +383,6 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument()
SelectionIntoArgument(); SelectionIntoArgument();
} }
//================================================================================= //=================================================================================
// function : LineEditReturnPressed() // function : LineEditReturnPressed()
// purpose : // purpose :
@ -397,7 +396,6 @@ void BasicGUI_WorkingPlaneDlg::LineEditReturnPressed()
} }
} }
//================================================================================= //=================================================================================
// function : onReverse() // function : onReverse()
// purpose : // purpose :
@ -407,7 +405,6 @@ void BasicGUI_WorkingPlaneDlg::onReverse()
updateWPlane(); updateWPlane();
} }
//================================================================================= //=================================================================================
// function : ActivateThisDialog() // function : ActivateThisDialog()
// purpose : // purpose :
@ -421,21 +418,19 @@ void BasicGUI_WorkingPlaneDlg::ActivateThisDialog( )
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }
//================================================================================= //=================================================================================
// function : DeactivateActiveDialog() // function : DeactivateActiveDialog()
// purpose : public slot to deactivate if active // purpose : public slot to deactivate if active
//================================================================================= //=================================================================================
void BasicGUI_WorkingPlaneDlg::DeactivateActiveDialog() void BasicGUI_WorkingPlaneDlg::DeactivateActiveDialog()
{ {
// myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog(); GEOMBase_Skeleton::DeactivateActiveDialog();
} }
//======================================================================= //=================================================================================
// function : ClickOnCancel() // function : ClickOnCancel()
// purpose : // purpose :
//======================================================================= //=================================================================================
void BasicGUI_WorkingPlaneDlg::ClickOnCancel() void BasicGUI_WorkingPlaneDlg::ClickOnCancel()
{ {
GEOMBase_Skeleton::ClickOnCancel(); GEOMBase_Skeleton::ClickOnCancel();
@ -460,7 +455,6 @@ void BasicGUI_WorkingPlaneDlg::closeEvent( QCloseEvent* e )
GEOMBase_Skeleton::closeEvent( e ); GEOMBase_Skeleton::closeEvent( e );
} }
//================================================================================= //=================================================================================
// function : updateWPlane // function : updateWPlane
// purpose : // purpose :
@ -498,8 +492,8 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview )
showError( "Wrong shape selected (has to be a planar face)" ); showError( "Wrong shape selected (has to be a planar face)" );
return false; return false;
} }
}
} else if (id == 1) { // by two vectors (Ox & Oz) else if (id == 1) { // by two vectors (Ox & Oz)
if ( CORBA::is_nil( myVectX ) || CORBA::is_nil( myVectZ ) ) { if ( CORBA::is_nil( myVectX ) || CORBA::is_nil( myVectZ ) ) {
if(!showPreview) if(!showPreview)
showError( "Two vectors have to be selected" ); showError( "Two vectors have to be selected" );
@ -555,8 +549,8 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview )
} }
myWPlane = gp_Ax3(BRep_Tool::Pnt(VX1), aDirZ, aDirX); myWPlane = gp_Ax3(BRep_Tool::Pnt(VX1), aDirZ, aDirX);
}
} else if (id == 2) { // by selection from standard (OXY or OYZ, or OZX) else if (id == 2) { // by selection from standard (OXY or OYZ, or OZX)
gp_Ax2 anAx2; gp_Ax2 anAx2;
if (aOriginType == 1) anAx2 = gp::XOY(); if (aOriginType == 1) anAx2 = gp::XOY();
@ -564,8 +558,8 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview )
else if (aOriginType == 0) anAx2 = gp::ZOX(); else if (aOriginType == 0) anAx2 = gp::ZOX();
myWPlane = gp_Ax3(anAx2); myWPlane = gp_Ax3(anAx2);
}
} else { else {
return false; return false;
} }
@ -578,7 +572,8 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview )
if (showPreview) if (showPreview)
{ {
GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations(getStudyId()); GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations(getStudyId());
GEOM::GEOM_Object_var anObj = aBasicOp->MakeMarker( myWPlane.Location().X(), myWPlane.Location().Y(), myWPlane.Location().Z(), GEOM::GEOM_Object_var anObj = aBasicOp->MakeMarker
(myWPlane.Location().X() , myWPlane.Location().Y() , myWPlane.Location().Z(),
myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(), myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(),
myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z()); myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z());
displayPreview(anObj); displayPreview(anObj);