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
@ -259,7 +260,7 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
if ( IObjectCount() != 1 ) if (IObjectCount() != 1)
{ {
switch (getConstructorId()) switch (getConstructorId())
{ {
@ -284,29 +285,37 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
// nbSel == 1 // nbSel == 1
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
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();
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{ {
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
TColStd_IndexedMapOfInteger aMap; int anIndex = aMap(1);
aSelMgr->GetIndexes( firstIObject(), aMap ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if ( aMap.Extent() == 1 ) aSelMgr->clearSelected(); // ???
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
aName.append( ":vertex_" + QString::number( anIndex ) );
}
}
myEditCurrentArgument->setText( aName ); aName += QString(":vertex_%1").arg(anIndex);
}
else // Global Selection
{
if (aShape.ShapeType() != TopAbs_VERTEX) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
}
}
myEditCurrentArgument->setText(aName);
switch (getConstructorId()) switch (getConstructorId())
{ {
@ -330,7 +339,6 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
displayPreview(); displayPreview();
} }
//================================================================================= //=================================================================================
// function : LineEditReturnPressed() // function : LineEditReturnPressed()
// purpose : // purpose :

View File

@ -16,7 +16,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -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
@ -346,7 +348,7 @@ void BasicGUI_CurveDlg::SelectionIntoArgument()
int k=0; int k=0;
for (list<GEOM::GEOM_Object_var>::iterator j=aList.begin();j!=aList.end();j++) for (list<GEOM::GEOM_Object_var>::iterator j=aList.begin();j!=aList.end();j++)
myPoints[k++] = *j; myPoints[k++] = *j;
if(IOC == 0) if(IOC == 0)
myOrderedSel.clear(); myOrderedSel.clear();
@ -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

@ -16,7 +16,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -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,8 +179,10 @@ 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,33 +211,46 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
} }
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); Handle(SALOME_InteractiveObject) anIO = firstIObject();
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), 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();
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(anIO, aMap);
if (aMap.Extent() == 1)
{ {
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
TColStd_IndexedMapOfInteger aMap; int anIndex = aMap(1);
aSelMgr->GetIndexes( firstIObject(), aMap ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if ( aMap.Extent() == 1 ) aSelMgr->clearSelected(); // ???
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
aName.append( ":edge_" + QString::number( anIndex ) );
else
aName.append( ":vertex_" + QString::number( anIndex ) );
aSelMgr->clearSelected();
}
}
myEditCurrentArgument->setText( aName ); 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 = "";
}
}
}
myEditCurrentArgument->setText(aName);
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject; if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = aSelectedObject;
@ -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,9 +304,9 @@ 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

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -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();
@ -222,10 +214,10 @@ void BasicGUI_LineDlg::ConstructorsClicked(int constructorId)
GroupFaces->show(); GroupFaces->show();
break; break;
} }
} }
updateGeometry(); updateGeometry();
resize( minimumSize() ); resize(minimumSize());
SelectionIntoArgument(); SelectionIntoArgument();
} }
@ -237,9 +229,9 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
if ( IObjectCount() != 1 ) if (IObjectCount() != 1)
{ {
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) myFace1 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) myFace1 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) myFace2 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) myFace2 = GEOM::GEOM_Object::_nil();
@ -248,32 +240,44 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
// nbSel == 1 // nbSel == 1
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
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 );
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) TopoDS_Shape aShape;
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();
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{ {
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
TColStd_IndexedMapOfInteger aMap; int anIndex = aMap( 1 );
aSelMgr->GetIndexes( firstIObject(), aMap ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if ( aMap.Extent() == 1 ) aSelMgr->clearSelected(); // ???
{
GEOM::GEOM_IShapesOperations_var aShapesOp = if (aNeedType == TopAbs_FACE)
getGeomEngine()->GetIShapesOperations( getStudyId() ); aName += QString(":face_%1").arg(anIndex);
int anIndex = aMap( 1 ); else
if ( myEditCurrentArgument == GroupFaces->LineEdit1 || aName += QString(":vertex_%1").arg(anIndex);
myEditCurrentArgument == GroupFaces->LineEdit2 )
aName.append( ":face_" + QString::number( anIndex ) );
else
aName.append( ":vertex_" + QString::number( anIndex ) );
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
} }
myEditCurrentArgument->setText( aName ); else // Global Selection
{
if (aShape.ShapeType() != aNeedType) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
}
}
myEditCurrentArgument->setText(aName);
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = 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,50 +223,52 @@ 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)
{ {
case 0: case 0:
{ {
Group1->hide(); Group1->hide();
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;
} }
case 1: case 1:
{ {
Group2->hide(); Group2->hide();
aMainGrp->hide(); aMainGrp->hide();
//PAL6669: resize(0, 0); //PAL6669: resize(0, 0);
Group1->show(); Group1->show();
globalSelection( GEOM_ALLGEOM ); globalSelection( GEOM_ALLGEOM );
myEditCurrentArgument = Group1->LineEdit1; myEditCurrentArgument = Group1->LineEdit1;
Group1->LineEdit1->setText(""); Group1->LineEdit1->setText("");
break; break;
}
case 2:
{
aMainGrp->hide();
Group1->show();
//PAL6669: resize(0, 0);
Group2->show();
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
myEditCurrentArgument = Group2->LineEdit1;
Group2->LineEdit1->setText("");
Group2->LineEdit2->setText("");
Group2->LineEdit3->setText("");
break;
}
} }
case 2:
{
aMainGrp->hide();
Group1->show();
//PAL6669: resize(0, 0);
Group2->show();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), globalSelection(); // close local contexts, if any
SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone())); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
myEditCurrentArgument = Group2->LineEdit1;
Group2->LineEdit1->setText("");
Group2->LineEdit2->setText("");
Group2->LineEdit3->setText("");
break;
}
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(onSelectionDone()));
onSelectionDone(); onSelectionDone();
} }
@ -312,26 +312,26 @@ bool BasicGUI_MarkerDlg::onApply()
//================================================================================= //=================================================================================
void BasicGUI_MarkerDlg::onSelectionDone0() void BasicGUI_MarkerDlg::onSelectionDone0()
{ {
if ( IObjectCount() == 1 ) if (IObjectCount() == 1)
{ {
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = firstIObject(); Handle(SALOME_InteractiveObject) anIO = firstIObject();
GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
if ( aRes && !aSelectedObj->_is_nil() ) if (aRes && !aSelectedObj->_is_nil())
{ {
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) if (GEOMBase::GetShape(aSelectedObj, aShape, TopAbs_SHAPE) && !aShape.IsNull())
{ {
// Existing LCS selected // Existing LCS selected
if ( aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE ) if (aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE)
{ {
TopoDS_Face aFace = TopoDS::Face( aShape ); TopoDS_Face aFace = TopoDS::Face(aShape);
Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) ); Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(BRep_Tool::Surface(aFace));
if ( !aPlane.IsNull() ) if (!aPlane.IsNull())
{ {
gp_Ax3 anAx3 = aPlane->Pln().Position(); gp_Ax3 anAx3 = aPlane->Pln().Position();
gp_Pnt aLoc = anAx3.Location(); gp_Pnt aLoc = anAx3.Location();
@ -355,19 +355,19 @@ void BasicGUI_MarkerDlg::onSelectionDone0()
else else
{ {
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)
{ {
gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
myData[ X ]->SetValue( aPnt.X() ); myData[ X ]->SetValue( aPnt.X() );
myData[ Y ]->SetValue( aPnt.Y() ); myData[ Y ]->SetValue( aPnt.Y() );
myData[ Z ]->SetValue( aPnt.Z() ); myData[ Z ]->SetValue( aPnt.Z() );
@ -380,30 +380,28 @@ 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
//================================================================================= //=================================================================================
void BasicGUI_MarkerDlg::onSelectionDone() void BasicGUI_MarkerDlg::onSelectionDone()
{ {
if ( getConstructorId() == 0 ) { if (getConstructorId() == 0) {
onSelectionDone0(); onSelectionDone0();
return; return;
} }
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aName;
if ( IObjectCount() == 1 ) { if (IObjectCount() == 1) {
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = firstIObject(); Handle(SALOME_InteractiveObject) anIO = firstIObject();
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
CORBA::Double Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz, Yx,Yy,Yz; CORBA::Double Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz, Yx,Yy,Yz;
Ox = Oy = Oz = Zx = Zy = Xy = Xz = Yx = Yz = 0; Ox = Oy = Oz = Zx = Zy = Xy = Xz = Yx = Yz = 0;
@ -437,31 +435,39 @@ void BasicGUI_MarkerDlg::onSelectionDone()
myData[ DY2 ]->SetValue( Yy ); myData[ DY2 ]->SetValue( Yy );
myData[ DZ2 ]->SetValue( Yz ); myData[ DZ2 ]->SetValue( Yz );
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText(aName);
} }
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();
aSelMgr->GetIndexes( anIO, aMap ); aSelMgr->GetIndexes(anIO, aMap);
if ( !aMap.IsEmpty() ) { if (!aMap.IsEmpty()) {
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);
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) {
if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) { if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX) {
gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
myData[ X ]->SetValue( aPnt.X() ); myData[ X ]->SetValue( aPnt.X() );
myData[ Y ]->SetValue( aPnt.Y() ); myData[ Y ]->SetValue( aPnt.Y() );
myData[ Z ]->SetValue( aPnt.Z() ); myData[ Z ]->SetValue( aPnt.Z() );
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText(aName);
} }
else { else {
myData[ X ]->SetValue( 0 ); myData[ X ]->SetValue( 0 );
@ -473,12 +479,12 @@ void BasicGUI_MarkerDlg::onSelectionDone()
if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) { if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) {
gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape))); gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape)));
gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape))); gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape)));
gp_Dir aDir(gp_Vec(aP1, aP2)); gp_Dir aDir (gp_Vec(aP1, aP2));
myData[ DX1 ]->SetValue( aDir.X() ); myData[ DX1 ]->SetValue( aDir.X() );
myData[ DY1 ]->SetValue( aDir.Y() ); myData[ DY1 ]->SetValue( aDir.Y() );
myData[ DZ1 ]->SetValue( aDir.Z() ); myData[ DZ1 ]->SetValue( aDir.Z() );
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText(aName);
} }
else { else {
myData[ DX1 ]->SetValue( 0 ); myData[ DX1 ]->SetValue( 0 );
@ -495,7 +501,7 @@ void BasicGUI_MarkerDlg::onSelectionDone()
myData[ DX2 ]->SetValue( aDir.X() ); myData[ DX2 ]->SetValue( aDir.X() );
myData[ DY2 ]->SetValue( aDir.Y() ); myData[ DY2 ]->SetValue( aDir.Y() );
myData[ DZ2 ]->SetValue( aDir.Z() ); myData[ DZ2 ]->SetValue( aDir.Z() );
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText(aName);
} }
else { else {
myData[ DX2 ]->SetValue( 0 ); myData[ DX2 ]->SetValue( 0 );
@ -551,22 +557,25 @@ void BasicGUI_MarkerDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == Group1->PushButton1) { if (send == Group1->PushButton1) {
myEditCurrentArgument = Group1->LineEdit1; myEditCurrentArgument = Group1->LineEdit1;
globalSelection( GEOM_ALLGEOM ); globalSelection( GEOM_ALLGEOM );
} }
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 );
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); globalSelection(); // close local contexts, if any
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,10 +602,10 @@ 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,10 +675,10 @@ 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());
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -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,70 +199,69 @@ 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)
{ {
case 0: /* plane from a point and a direction (vector, edge...) */ case 0: /* plane from a point and a direction (vector, edge...) */
{ {
Group3Pnts->hide(); Group3Pnts->hide();
GroupFace->hide(); GroupFace->hide();
resize(0, 0); resize(0, 0);
GroupPntDir->show(); GroupPntDir->show();
myEditCurrentArgument = GroupPntDir->LineEdit1; myEditCurrentArgument = GroupPntDir->LineEdit1;
GroupPntDir->LineEdit1->setText(tr("")); GroupPntDir->LineEdit1->setText(tr(""));
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;
}
case 1: /* plane from 3 points */
{
GroupPntDir->hide();
GroupFace->hide();
resize(0, 0);
Group3Pnts->show();
myEditCurrentArgument = Group3Pnts->LineEdit1;
Group3Pnts->LineEdit1->setText("");
Group3Pnts->LineEdit2->setText("");
Group3Pnts->LineEdit3->setText("");
/* for the first argument */
globalSelection( GEOM_POINT ); // to break previous local selection
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
break;
}
case 2: /* plane from a planar face selection */
{
GroupPntDir->hide();
Group3Pnts->hide();
resize(0, 0);
GroupFace->show();
myEditCurrentArgument = GroupFace->LineEdit1;
GroupFace->LineEdit1->setText(tr(""));
/* for the first argument */
globalSelection( GEOM_PLANE );
TColStd_MapOfInteger aMap;
aMap.Add( GEOM_PLANE );
aMap.Add( GEOM_MARKER );
globalSelection( aMap );
break;
}
} }
case 1: /* plane from 3 points */
{
GroupPntDir->hide();
GroupFace->hide();
resize(0, 0);
Group3Pnts->show();
myEditCurrentArgument = Group3Pnts->LineEdit1;
Group3Pnts->LineEdit1->setText("");
Group3Pnts->LineEdit2->setText("");
Group3Pnts->LineEdit3->setText("");
/* for the first argument */
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
break;
}
case 2: /* plane from a planar face selection */
{
GroupPntDir->hide();
Group3Pnts->hide();
resize(0, 0);
GroupFace->show();
myEditCurrentArgument = GroupFace->LineEdit1;
GroupFace->LineEdit1->setText(tr(""));
/* for the first argument */
//globalSelection( GEOM_PLANE );
TColStd_MapOfInteger aMap;
aMap.Add( GEOM_PLANE );
aMap.Add( GEOM_MARKER );
globalSelection( aMap );
break;
}
}
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 :
@ -305,7 +303,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
if ( IObjectCount() != 1 ) if (IObjectCount() != 1)
{ {
if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil();
@ -318,32 +316,47 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
// nbSel == 1 // nbSel == 1
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
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);
TopoDS_Shape aShape; TopoDS_Shape aShape;
QString aName = GEOMBase::GetName( aSelectedObject ); 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;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{ {
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
TColStd_IndexedMapOfInteger aMap; int anIndex = aMap(1);
aSelMgr->GetIndexes( firstIObject(), aMap ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if ( aMap.Extent() == 1 ) aSelMgr->clearSelected(); // ???
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if ( myEditCurrentArgument == GroupPntDir->LineEdit2 )
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);
} }
myEditCurrentArgument->setText( aName ); else // Global Selection
{
if (aShape.ShapeType() != aNeedType) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
}
}
myEditCurrentArgument->setText(aName);
if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject; if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = aSelectedObject;
else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = aSelectedObject; else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = 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 ) { }
globalSelection( GEOM_PLANE ); else if (myEditCurrentArgument == GroupFace->LineEdit1) {
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
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); globalSelection(); // close local contexts, if any
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,12 +432,10 @@ 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,35 +211,42 @@ 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)
{ {
switch ( constructorId ) globalSelection(); // close local contexts, if any
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();
GroupOnCurve->hide(); GroupOnCurve->hide();
@ -255,8 +260,8 @@ 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();
GroupOnCurve->hide(); GroupOnCurve->hide();
@ -270,8 +275,8 @@ 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();
GroupRefPoint->hide(); GroupRefPoint->hide();
@ -287,8 +292,8 @@ 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();
GroupRefPoint->hide(); GroupRefPoint->hide();
@ -310,33 +315,30 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
SelectionIntoArgument(); SelectionIntoArgument();
} }
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
//================================================================================= //=================================================================================
void BasicGUI_PointDlg::ClickOnOk() void BasicGUI_PointDlg::ClickOnOk()
{ {
if ( onAccept() ) if (onAccept())
ClickOnCancel(); ClickOnCancel();
} }
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
//================================================================================= //=================================================================================
bool BasicGUI_PointDlg::ClickOnApply() bool BasicGUI_PointDlg::ClickOnApply()
{ {
if ( !onAccept() ) if (!onAccept())
return false; return false;
initName(); initName();
ConstructorsClicked( getConstructorId() ); ConstructorsClicked(getConstructorId());
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)
@ -355,7 +356,7 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
{ {
const int id = getConstructorId(); const int id = getConstructorId();
if ( ( id == 1 || id == 2 ) && myEditCurrentArgument != 0 ) if ((id == 1 || id == 2) && myEditCurrentArgument != 0)
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
myX->setText( "" ); myX->setText( "" );
@ -364,65 +365,74 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
myRefPoint = myEdge = GEOM::GEOM_Object::_nil(); myRefPoint = myEdge = GEOM::GEOM_Object::_nil();
} }
if ( IObjectCount() == 1 ) if (IObjectCount() == 1)
{ {
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())
{
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes( firstIObject(), aMap );
if ( aMap.Extent() == 1 )
{
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if ( id == 2 || id == 3 )
aName.append( ":edge_" + QString::number( anIndex ) );
else
aName.append( ":vertex_" + QString::number( anIndex ) );
aSelMgr->clearSelected();
}
}
if ( id == 0 )
{ {
GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ); TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
if (id == 2 || id == 3)
aNeedType = TopAbs_EDGE;
if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX ) LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
return; TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{
GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
int anIndex = aMap(1);
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 = "";
if (id == 0) return;
}
}
}
if (id == 0)
{
if (aShape.IsNull()) 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() );
GroupXYZ->SpinBox_DZ->SetValue( aPnt.Z() ); GroupXYZ->SpinBox_DZ->SetValue( aPnt.Z() );
} }
else if ( id == 1 ) else if (id == 1)
{ {
myRefPoint = aSelectedObject; myRefPoint = aSelectedObject;
GroupRefPoint->LineEdit1->setText( aName ); GroupRefPoint->LineEdit1->setText(aName);
} }
else if ( id == 2 ) else if (id == 2)
{ {
myEdge = aSelectedObject; myEdge = aSelectedObject;
GroupOnCurve->LineEdit1->setText( aName ); GroupOnCurve->LineEdit1->setText(aName);
} }
else if ( id == 3 ) else if (id == 3)
{ {
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

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
// //
@ -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,42 +176,43 @@ 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();
switch (constructorId) switch (constructorId)
{ {
case 0: case 0:
{ {
GroupDimensions->hide(); GroupDimensions->hide();
resize(0, 0); resize(0, 0);
GroupPoints->show(); GroupPoints->show();
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit2->setText(""); GroupPoints->LineEdit2->setText("");
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); globalSelection(); // close local contexts, if any
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(myGeomGUI->getApp()->selectionMgr(),
break; SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
} break;
case 1:
{
GroupPoints->hide();
resize( 0, 0 );
GroupDimensions->show();
double dx( 0. ), dy( 0. ), dz( 0. );
GroupDimensions->SpinBox_DX->SetValue( dx );
GroupDimensions->SpinBox_DY->SetValue( dy );
GroupDimensions->SpinBox_DZ->SetValue( dz );
GroupDimensions->CheckBox1->setChecked( FALSE );
break;
}
} }
case 1:
{
GroupPoints->hide();
resize( 0, 0 );
GroupDimensions->show();
double dx( 0. ), dy( 0. ), dz( 0. );
GroupDimensions->SpinBox_DX->SetValue( dx );
GroupDimensions->SpinBox_DY->SetValue( dy );
GroupDimensions->SpinBox_DZ->SetValue( dz );
GroupDimensions->CheckBox1->setChecked( FALSE );
break;
}
}
displayPreview(); displayPreview();
} }
@ -262,39 +263,47 @@ void BasicGUI_VectorDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
if ( IObjectCount() != 1 ) if (IObjectCount() != 1)
{ {
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) if (myEditCurrentArgument == GroupPoints->LineEdit1)
myPoint1 = GEOM::GEOM_Object::_nil(); myPoint1 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myPoint2 = GEOM::GEOM_Object::_nil(); myPoint2 = GEOM::GEOM_Object::_nil();
return; return;
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
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 );
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
{
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(firstIObject(), aMap);
if (aMap.Extent() == 1) // Local Selection
{ {
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
TColStd_IndexedMapOfInteger aMap; int anIndex = aMap(1);
aSelMgr->GetIndexes( firstIObject(), aMap ); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
if ( aMap.Extent() == 1 ) aSelMgr->clearSelected(); // ???
{
GEOM::GEOM_IShapesOperations_var aShapesOp = aName += QString(":vertex_%1").arg(anIndex);
getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 );
aName.append( ":vertex_" + QString::number( anIndex ) );
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected();
}
} }
myEditCurrentArgument->setText( aName ); else // Global Selection
{
if (aShape.ShapeType() != TopAbs_VERTEX) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
}
}
myEditCurrentArgument->setText(aName);
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject;
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = 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,10 +346,10 @@ 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

@ -293,10 +293,10 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
QString aName; QString aName;
const int id = getConstructorId(); const int id = getConstructorId();
if ( IObjectCount() != 1 ) { if (IObjectCount() != 1) {
if(id == 0) if (id == 0)
myFace = GEOM::GEOM_Object::_nil(); myFace = GEOM::GEOM_Object::_nil();
else if(id == 1) { else if (id == 1) {
if (myEditCurrentArgument == Group2->LineEdit1) if (myEditCurrentArgument == Group2->LineEdit1)
myVectX = GEOM::GEOM_Object::_nil(); myVectX = GEOM::GEOM_Object::_nil();
else if (myEditCurrentArgument == Group2->LineEdit2) else if (myEditCurrentArgument == Group2->LineEdit2)
@ -309,53 +309,53 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
Standard_Boolean aRes = Standard_False; Standard_Boolean aRes = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes);
if(!aRes || CORBA::is_nil( aSelectedObject )) if (!aRes || CORBA::is_nil(aSelectedObject))
return; return;
aName = GEOMBase::GetName( aSelectedObject ); aName = GEOMBase::GetName(aSelectedObject);
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; {
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) TopoDS_Shape aShape;
{ if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); {
TColStd_IndexedMapOfInteger aMap; LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
aSelMgr->GetIndexes( firstIObject(), aMap ); TColStd_IndexedMapOfInteger aMap;
if ( aMap.Extent() == 1 ) aSelMgr->GetIndexes( firstIObject(), aMap );
{ if ( aMap.Extent() == 1 )
GEOM::GEOM_IShapesOperations_var aShapesOp = {
getGeomEngine()->GetIShapesOperations( getStudyId() ); GEOM::GEOM_IShapesOperations_var aShapesOp =
int anIndex = aMap( 1 ); getGeomEngine()->GetIShapesOperations( getStudyId() );
TopTools_IndexedMapOfShape aShapes; int anIndex = aMap( 1 );
TopExp::MapShapes( aShape, aShapes ); TopTools_IndexedMapOfShape aShapes;
aShape = aShapes.FindKey( anIndex ); TopExp::MapShapes( aShape, aShapes );
aName = aName + " Edge_" + QString::number( anIndex ); aShape = aShapes.FindKey( anIndex );
if(myEditCurrentArgument == Group2->LineEdit1) aName = aName + ":edge_" + QString::number( anIndex );
myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex); if(myEditCurrentArgument == Group2->LineEdit1)
else myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex);
myVectZ = aShapesOp->GetSubShape(aSelectedObject, anIndex); else
} myVectZ = aShapesOp->GetSubShape(aSelectedObject, anIndex);
else { }
if(myEditCurrentArgument == Group2->LineEdit1) else {
myVectX = aSelectedObject; if (myEditCurrentArgument == Group2->LineEdit1)
else myVectX = aSelectedObject;
myVectZ = aSelectedObject; else
} myVectZ = aSelectedObject;
aSelMgr->clearSelected(); }
} aSelMgr->clearSelected();
} }
} }
}
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
updateWPlane(); updateWPlane();
} }
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -364,16 +364,16 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == Group1->PushButton1) { if (send == Group1->PushButton1) {
myEditCurrentArgument = Group1->LineEdit1; myEditCurrentArgument = Group1->LineEdit1;
globalSelection( GEOM_PLANE ); globalSelection( GEOM_PLANE );
} }
else if(send == Group2->PushButton1) { else if (send == Group2->PushButton1) {
myEditCurrentArgument = Group2->LineEdit1; myEditCurrentArgument = Group2->LineEdit1;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE ); localSelection( anObj, TopAbs_EDGE );
} }
else if(send == Group2->PushButton2) { else if (send == Group2->PushButton2) {
myEditCurrentArgument = Group2->LineEdit2; myEditCurrentArgument = Group2->LineEdit2;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
localSelection( anObj, TopAbs_EDGE ); localSelection( anObj, TopAbs_EDGE );
@ -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,25 +558,26 @@ 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;
} }
if (myReverseCB->isChecked()) if (myReverseCB->isChecked())
{ {
myWPlane.YReverse(); myWPlane.YReverse();
myWPlane.ZReverse(); myWPlane.ZReverse();
} }
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.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(), (myWPlane.Location().X() , myWPlane.Location().Y() , myWPlane.Location().Z(),
myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z() ); myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(),
displayPreview(anObj); myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z());
} displayPreview(anObj);
}
return true; return true;
} }