0020669: EDF 1198 GEOM: creation of vertices at intersection of 1D elements

This commit is contained in:
dmv 2010-02-11 10:29:04 +00:00
parent f56f0abee7
commit 7968bd362a
6 changed files with 139 additions and 83 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -40,9 +40,12 @@ projected on the given edge to produce the resulting point.
projected point. projected point.
\image html point3_2.png \image html point3_2.png
\n Fourthly, we can define a point by intersection of two \b Lines. \n Fourthly, we can define a point(s) by intersection of two \b Lines or \b Wires (or a Wire and a Line).
\n <b>TUI Command:</b> <em>geompy.MakePointOnLinesIntersection(myLine1,myLine2).</em> If they intersect only once, a point will be created. If there are several intersections, a compound of
\n <b>Arguments:</b> Name + 2 lines points will be created. The type of the selected object (Line or Wire) can be changed in the popup menu,
after clicking the corresponding selection button. (see the picture below)
\n <b>TUI Command:</b> <em>geompy.MakePointOnLinesIntersection(myLine1,myWire1).</em>
\n <b>Arguments:</b> Name + 2 1D objects
\image html point4.png \image html point4.png

View File

@ -42,6 +42,7 @@
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QRadioButton> #include <QRadioButton>
#include <QMenu>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
@ -61,6 +62,8 @@
#define GEOM_POINT_INTINT 3 #define GEOM_POINT_INTINT 3
#define GEOM_POINT_SURF 4 #define GEOM_POINT_SURF 4
#define SPACING 6
#define MARGIN 9
//================================================================================= //=================================================================================
// class : BasicGUI_PointDlg() // class : BasicGUI_PointDlg()
@ -79,6 +82,8 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_REF" ) ) ); QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_REF" ) ) );
QPixmap image4( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_LINES") ) ); QPixmap image4( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_LINES") ) );
QPixmap image5( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_FACE" ) ) ); QPixmap image5( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_FACE" ) ) );
QPixmap image6( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICO_LINE" ) ) );
QPixmap image7( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICO_WIRE" ) ) );
setWindowTitle( tr( "GEOM_POINT_TITLE" ) ); setWindowTitle( tr( "GEOM_POINT_TITLE" ) );
@ -92,14 +97,14 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
mainFrame()->RadioButton5->show(); mainFrame()->RadioButton5->show();
mainFrame()->RadioButton5->setIcon( image5 ); mainFrame()->RadioButton5->setIcon( image5 );
QGroupBox* paramGrp = new QGroupBox( centralWidget() ); myParamGroup = new QGroupBox( centralWidget() );
myParamCoord = new QButtonGroup( paramGrp ); myParamCoord = new QButtonGroup( myParamGroup );
QHBoxLayout* boxLayout = new QHBoxLayout( paramGrp ); QHBoxLayout* boxLayout = new QHBoxLayout( myParamGroup );
boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 ); boxLayout->setMargin( MARGIN ); boxLayout->setSpacing( SPACING );
QRadioButton* btn = new QRadioButton( tr( "GEOM_PARAM_VALUE" ), paramGrp ); QRadioButton* btn = new QRadioButton( tr( "GEOM_PARAM_VALUE" ), myParamGroup );
myParamCoord->addButton( btn, PARAM_VALUE ); myParamCoord->addButton( btn, PARAM_VALUE );
boxLayout->addWidget( btn ); boxLayout->addWidget( btn );
btn = new QRadioButton( tr( "GEOM_COORD_VALUE" ), paramGrp ); btn = new QRadioButton( tr( "GEOM_COORD_VALUE" ), myParamGroup );
myParamCoord->addButton( btn, COORD_VALUE ); myParamCoord->addButton( btn, COORD_VALUE );
boxLayout->addWidget( btn ); boxLayout->addWidget( btn );
myParamCoord->setExclusive( true ); myParamCoord->setExclusive( true );
@ -132,12 +137,21 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
GroupRefPoint->TextLabel3->setText( tr( "GEOM_DY" ) ); GroupRefPoint->TextLabel3->setText( tr( "GEOM_DY" ) );
GroupRefPoint->TextLabel4->setText( tr( "GEOM_DZ" ) ); GroupRefPoint->TextLabel4->setText( tr( "GEOM_DZ" ) );
/* popup menu for line intersect buttons */
myBtnPopup = new QMenu(this);
QIcon ico_line = QIcon( image6 );
QIcon ico_wire = QIcon( image7 );
myActions[myBtnPopup->addAction( ico_line, tr( "GEOM_EDGE" ) )] = 0;
myActions[myBtnPopup->addAction( ico_wire, tr( "GEOM_WIRE" ) )] = 1;
GroupLineIntersection = new DlgRef_2Sel( centralWidget() ); GroupLineIntersection = new DlgRef_2Sel( centralWidget() );
GroupLineIntersection->GroupBox1->setTitle( tr( "GEOM_LINE_INTERSECTION" ) ); GroupLineIntersection->GroupBox1->setTitle( tr( "GEOM_LINE_INTERSECTION" ) );
GroupLineIntersection->TextLabel1->setText( tr( "GEOM_LINE1" ) ); GroupLineIntersection->TextLabel1->setText( tr( "GEOM_LINE1" ) );
GroupLineIntersection->TextLabel2->setText( tr( "GEOM_LINE2" ) ); GroupLineIntersection->TextLabel2->setText( tr( "GEOM_LINE2" ) );
GroupLineIntersection->PushButton1->setIcon( image2 ); GroupLineIntersection->PushButton1->setIcon( image2 );
GroupLineIntersection->PushButton1->setMenu( myBtnPopup );
GroupLineIntersection->PushButton2->setIcon( image2 ); GroupLineIntersection->PushButton2->setIcon( image2 );
GroupLineIntersection->PushButton2->setMenu( myBtnPopup );
GroupLineIntersection->LineEdit2->setEnabled(false); GroupLineIntersection->LineEdit2->setEnabled(false);
myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES_RES" ), centralWidget() ); myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES_RES" ), centralWidget() );
@ -154,7 +168,7 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( paramGrp ); layout->addWidget( myParamGroup );
layout->addWidget( GroupXYZ ); layout->addWidget( GroupXYZ );
layout->addWidget( GroupOnCurve ); layout->addWidget( GroupOnCurve );
layout->addWidget( GroupOnSurface ); layout->addWidget( GroupOnSurface );
@ -207,6 +221,7 @@ void BasicGUI_PointDlg::Init()
myEdge = GEOM::GEOM_Object::_nil(); myEdge = GEOM::GEOM_Object::_nil();
myRefPoint = GEOM::GEOM_Object::_nil(); myRefPoint = GEOM::GEOM_Object::_nil();
myNeedType = TopAbs_VERTEX;
myEditCurrentArgument = 0; myEditCurrentArgument = 0;
@ -256,8 +271,9 @@ void BasicGUI_PointDlg::Init()
connect( GroupOnSurface->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupOnSurface->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupOnSurface->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupOnSurface->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupLineIntersection->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( myBtnPopup, SIGNAL( triggered( QAction* ) ), SLOT( onBtnPopup( QAction* ) ) );
connect( GroupLineIntersection->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupLineIntersection->PushButton1, SIGNAL( pressed() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupLineIntersection->PushButton2, SIGNAL( pressed() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupLineIntersection->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupLineIntersection->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupLineIntersection->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupLineIntersection->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
@ -305,67 +321,63 @@ void BasicGUI_PointDlg::SetDoubleSpinBoxStep( double step )
//================================================================================= //=================================================================================
void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
{ {
globalSelection(); // close local contexts, if any
switch ( constructorId ) { switch ( constructorId ) {
case GEOM_POINT_XYZ: case GEOM_POINT_XYZ:
{ {
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
GroupRefPoint->hide(); GroupRefPoint->hide();
GroupOnCurve->hide(); GroupOnCurve->hide();
GroupLineIntersection->hide(); GroupLineIntersection->hide();
GroupOnSurface->hide(); GroupOnSurface->hide();
myCoordGrp->hide(); myCoordGrp->hide();
myParamGroup->hide();
myParamCoord->button( PARAM_VALUE )->hide();
myParamCoord->button( COORD_VALUE )->hide();
GroupXYZ->show(); GroupXYZ->show();
break; break;
} }
case GEOM_POINT_REF: case GEOM_POINT_REF:
{ {
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
myEditCurrentArgument = GroupRefPoint->LineEdit1; myEditCurrentArgument = GroupRefPoint->LineEdit1;
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
myRefPoint = GEOM::GEOM_Object::_nil(); myRefPoint = GEOM::GEOM_Object::_nil();
GroupRefPoint->PushButton1->setDown(true); GroupRefPoint->PushButton1->setDown(true);
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); myParamGroup->hide();
myParamCoord->button( PARAM_VALUE )->hide();
myParamCoord->button( COORD_VALUE )->hide();
GroupXYZ->hide(); GroupXYZ->hide();
GroupOnCurve->hide(); GroupOnCurve->hide();
GroupLineIntersection->hide(); GroupLineIntersection->hide();
GroupOnSurface->hide(); GroupOnSurface->hide();
GroupRefPoint->show(); GroupRefPoint->show();
myCoordGrp->show(); myCoordGrp->show();
break; break;
} }
case GEOM_POINT_EDGE: case GEOM_POINT_EDGE:
{ {
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
myEditCurrentArgument = GroupOnCurve->LineEdit1; myEditCurrentArgument = GroupOnCurve->LineEdit1;
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
myEdge = GEOM::GEOM_Object::_nil(); myEdge = GEOM::GEOM_Object::_nil();
GroupOnCurve->PushButton1->setDown(true); GroupOnCurve->PushButton1->setDown(true);
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
GroupRefPoint->hide(); GroupRefPoint->hide();
GroupLineIntersection->hide(); GroupLineIntersection->hide();
GroupOnSurface->hide(); GroupOnSurface->hide();
myParamGroup->show();
myParamCoord->button( PARAM_VALUE )->show();
myParamCoord->button( COORD_VALUE )->show();
GroupOnCurve->show(); GroupOnCurve->show();
myCoordGrp->show(); myCoordGrp->show();
updateParamCoord( false ); updateParamCoord( false );
break; break;
} }
case GEOM_POINT_INTINT: case GEOM_POINT_INTINT:
{ {
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
myNeedType = TopAbs_EDGE;
myEditCurrentArgument = GroupLineIntersection->LineEdit1; myEditCurrentArgument = GroupLineIntersection->LineEdit1;
GroupLineIntersection->LineEdit1->setText( "" ); GroupLineIntersection->LineEdit1->setText( "" );
GroupLineIntersection->LineEdit2->setText( "" ); GroupLineIntersection->LineEdit2->setText( "" );
@ -375,38 +387,30 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
myLine2 = GEOM::GEOM_Object::_nil(); myLine2 = GEOM::GEOM_Object::_nil();
GroupLineIntersection->PushButton1->setDown(true); GroupLineIntersection->PushButton1->setDown(true);
GroupLineIntersection->PushButton2->setDown(false); GroupLineIntersection->PushButton2->setDown(false);
myParamGroup->hide();
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
myParamCoord->button( PARAM_VALUE )->hide();
myParamCoord->button( COORD_VALUE )->hide();
GroupXYZ->hide(); GroupXYZ->hide();
GroupRefPoint->hide(); GroupRefPoint->hide();
GroupOnCurve->hide(); GroupOnCurve->hide();
GroupOnSurface->hide(); GroupOnSurface->hide();
myCoordGrp->hide(); myCoordGrp->hide();
GroupLineIntersection->show(); GroupLineIntersection->show();
break; break;
} }
case GEOM_POINT_SURF: case GEOM_POINT_SURF:
{ {
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
myEditCurrentArgument = GroupOnSurface->LineEdit1; myEditCurrentArgument = GroupOnSurface->LineEdit1;
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
myFace = GEOM::GEOM_Object::_nil(); myFace = GEOM::GEOM_Object::_nil();
GroupOnSurface->PushButton1->setDown(true); GroupOnSurface->PushButton1->setDown(true);
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
GroupRefPoint->hide(); GroupRefPoint->hide();
GroupOnCurve->hide(); GroupOnCurve->hide();
GroupLineIntersection->hide(); GroupLineIntersection->hide();
myParamGroup->show();
myParamCoord->button( PARAM_VALUE )->show();
myParamCoord->button( COORD_VALUE )->show();
GroupOnSurface->show(); GroupOnSurface->show();
myCoordGrp->show(); myCoordGrp->show();
updateParamCoord( false ); updateParamCoord( false );
break; break;
} }
@ -477,21 +481,26 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
if ( id == GEOM_POINT_EDGE || id == GEOM_POINT_INTINT ) if ( id == GEOM_POINT_XYZ || id == GEOM_POINT_REF)
aNeedType = TopAbs_EDGE; myNeedType = TopAbs_VERTEX;
else if ( id == GEOM_POINT_EDGE )
myNeedType = TopAbs_EDGE;
else if ( id == GEOM_POINT_SURF ) else if ( id == GEOM_POINT_SURF )
aNeedType = TopAbs_FACE; myNeedType = TopAbs_FACE;
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(anIO, aMap); aSelMgr->GetIndexes(anIO, aMap);
if ( aMap.Extent() == 1 ) { // Local Selection if ( aMap.Extent() == 1 ) { // Local Selection
int anIndex = aMap( 1 ); int anIndex = aMap( 1 );
if ( aNeedType == TopAbs_EDGE ) if ( myNeedType == TopAbs_FACE )
aName += QString( ":face_%1" ).arg( anIndex );
else if ( myNeedType == TopAbs_WIRE )
aName += QString( ":wire_%1" ).arg( anIndex );
else if ( myNeedType == TopAbs_EDGE )
aName += QString( ":edge_%1" ).arg( anIndex ); aName += QString( ":edge_%1" ).arg( anIndex );
else else if ( myNeedType == TopAbs_VERTEX )
aName += QString( ":vertex_%1" ).arg( anIndex ); aName += QString( ":vertex_%1" ).arg( anIndex );
//Find SubShape Object in Father //Find SubShape Object in Father
@ -508,7 +517,7 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ); GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE );
} }
else { // Global Selection else { // Global Selection
if ( aShape.ShapeType() != aNeedType ) { if ( aShape.ShapeType() != myNeedType ) {
aSelectedObject = GEOM::GEOM_Object::_nil(); aSelectedObject = GEOM::GEOM_Object::_nil();
aName = ""; aName = "";
if ( id == GEOM_POINT_XYZ ) return; if ( id == GEOM_POINT_XYZ ) return;
@ -516,7 +525,7 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
} }
} }
if ( aShape.IsNull() || aShape.ShapeType() != aNeedType) if ( aShape.IsNull() || aShape.ShapeType() != myNeedType)
return; return;
if ( id == GEOM_POINT_XYZ ) { if ( id == GEOM_POINT_XYZ ) {
@ -535,17 +544,23 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
} }
else if ( id == GEOM_POINT_INTINT ) { else if ( id == GEOM_POINT_INTINT ) {
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
globalSelection();
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) { if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) {
myLine1 = aSelectedObject; myLine1 = aSelectedObject;
if ( !myLine1->_is_nil() && myLine2->_is_nil() ) if ( !myLine1->_is_nil() && myLine2->_is_nil() ) {
GroupLineIntersection->PushButton2->setMenu( 0 );
GroupLineIntersection->PushButton2->click(); GroupLineIntersection->PushButton2->click();
GroupLineIntersection->PushButton2->setDown(true);
GroupLineIntersection->PushButton2->setMenu( myBtnPopup );
}
} }
else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) { else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) {
myLine2 = aSelectedObject; myLine2 = aSelectedObject;
if ( !myLine2->_is_nil() && myLine1->_is_nil() ) if ( !myLine2->_is_nil() && myLine1->_is_nil() ) {
GroupLineIntersection->PushButton1->setMenu( 0 );
GroupLineIntersection->PushButton1->click(); GroupLineIntersection->PushButton1->click();
GroupLineIntersection->PushButton1->setDown(true);
GroupLineIntersection->PushButton1->setMenu( myBtnPopup );
}
} }
} }
else if ( id == GEOM_POINT_SURF ) else if ( id == GEOM_POINT_SURF )
@ -583,27 +598,25 @@ void BasicGUI_PointDlg::LineEditReturnPressed()
//================================================================================= //=================================================================================
void BasicGUI_PointDlg::SetEditCurrentArgument() void BasicGUI_PointDlg::SetEditCurrentArgument()
{ {
globalSelection(); // close local contexts, if any
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if ( send == GroupRefPoint->PushButton1 ) { if ( send == GroupRefPoint->PushButton1 ) {
GroupRefPoint->LineEdit1->setFocus(); GroupRefPoint->LineEdit1->setFocus();
myEditCurrentArgument = GroupRefPoint->LineEdit1; myEditCurrentArgument = GroupRefPoint->LineEdit1;
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
} }
else if ( send == GroupOnCurve->PushButton1 ) { else if ( send == GroupOnCurve->PushButton1 ) {
GroupOnCurve->LineEdit1->setFocus(); GroupOnCurve->LineEdit1->setFocus();
myEditCurrentArgument = GroupOnCurve->LineEdit1; myEditCurrentArgument = GroupOnCurve->LineEdit1;
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} }
else if ( send == GroupOnSurface->PushButton1 ) else if ( send == GroupOnSurface->PushButton1 )
{ {
GroupOnSurface->LineEdit1->setFocus(); GroupOnSurface->LineEdit1->setFocus();
myEditCurrentArgument = GroupOnSurface->LineEdit1; myEditCurrentArgument = GroupOnSurface->LineEdit1;
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
} }
else if ( send == GroupLineIntersection->PushButton1 ) { else if ( send == GroupLineIntersection->PushButton1 ) {
@ -612,7 +625,6 @@ void BasicGUI_PointDlg::SetEditCurrentArgument()
GroupLineIntersection->PushButton2->setDown( false ); GroupLineIntersection->PushButton2->setDown( false );
GroupLineIntersection->LineEdit1->setEnabled(true); GroupLineIntersection->LineEdit1->setEnabled(true);
GroupLineIntersection->LineEdit2->setEnabled(false); GroupLineIntersection->LineEdit2->setEnabled(false);
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} }
else if ( send == GroupLineIntersection->PushButton2 ) { else if ( send == GroupLineIntersection->PushButton2 ) {
GroupLineIntersection->LineEdit2->setFocus(); GroupLineIntersection->LineEdit2->setFocus();
@ -620,7 +632,6 @@ void BasicGUI_PointDlg::SetEditCurrentArgument()
GroupLineIntersection->PushButton1->setDown( false ); GroupLineIntersection->PushButton1->setDown( false );
GroupLineIntersection->LineEdit1->setEnabled(false); GroupLineIntersection->LineEdit1->setEnabled(false);
GroupLineIntersection->LineEdit2->setEnabled(true); GroupLineIntersection->LineEdit2->setEnabled(true);
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} }
send->setDown(true); send->setDown(true);
} }
@ -959,3 +970,20 @@ void BasicGUI_PointDlg::updateParamCoord(bool theIsUpdate)
resize( minimumSizeHint() ); resize( minimumSizeHint() );
} }
} }
//=================================================================================
// function : onBtnPopup()
// purpose :
//=================================================================================
void BasicGUI_PointDlg::onBtnPopup( QAction* a )
{
int index = myActions[a];
globalSelection(); // close local contexts, if any
QString type;
if ( index == 0 )
myNeedType = TopAbs_EDGE;
else
myNeedType = TopAbs_WIRE;
localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
}

View File

@ -27,6 +27,7 @@
#define BASICGUI_POINTDLG_H #define BASICGUI_POINTDLG_H
#include <GEOMBase_Skeleton.h> #include <GEOMBase_Skeleton.h>
#include <QMap>
class DlgRef_1Sel1Spin; class DlgRef_1Sel1Spin;
class DlgRef_3Spin; class DlgRef_3Spin;
@ -37,6 +38,8 @@ class DlgRef_1Sel2Spin;
class QLineEdit; class QLineEdit;
class QGroupBox; class QGroupBox;
class QButtonGroup; class QButtonGroup;
class QMenu;
class QAction;
class gp_Pnt; class gp_Pnt;
@ -88,8 +91,15 @@ private:
QLineEdit* myX; QLineEdit* myX;
QLineEdit* myY; QLineEdit* myY;
QLineEdit* myZ; QLineEdit* myZ;
QGroupBox* myParamGroup;
QButtonGroup* myParamCoord; QButtonGroup* myParamCoord;
QMenu* myBtnPopup;
QMap<QAction*, int> myActions;
TopAbs_ShapeEnum myNeedType;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
@ -102,6 +112,7 @@ private slots:
void ValueChangedInSpinBox( double ); void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double ); void SetDoubleSpinBoxStep( double );
void ClickParamCoord(); void ClickParamCoord();
void onBtnPopup( QAction* );
}; };
#endif // BASICGUI_POINTDLG_H #endif // BASICGUI_POINTDLG_H

View File

@ -577,14 +577,14 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
if ( HasColor() ) if ( HasColor() )
{ {
AISShape->SetColor( (Quantity_NameOfColor)GetColor() ); AISShape->SetColor( (Quantity_NameOfColor)GetColor() );
if ( myShape.ShapeType() == TopAbs_VERTEX )
{
Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
anAspect->SetColor( (Quantity_NameOfColor)GetColor() ); anAspect->SetColor( (Quantity_NameOfColor)GetColor() );
if ( myShape.ShapeType() == TopAbs_VERTEX )
{
anAspect->SetScale( myScaleOfMarker ); anAspect->SetScale( myScaleOfMarker );
anAspect->SetTypeOfMarker( myTypeOfMarker ); anAspect->SetTypeOfMarker( myTypeOfMarker );
AISShape->Attributes()->SetPointAspect( anAspect );
} }
AISShape->Attributes()->SetPointAspect( anAspect );
} }
else else
{ {

View File

@ -29,12 +29,14 @@
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx> #include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepExtrema_DistShapeShape.hxx> #include <BRepExtrema_DistShapeShape.hxx>
#include <BRep_Builder.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <TopAbs.hxx> #include <TopAbs.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <Geom_Curve.hxx> #include <Geom_Curve.hxx>
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
@ -105,6 +107,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
Standard_Integer aType = aFunction->GetType(); Standard_Integer aType = aFunction->GetType();
gp_Pnt aPnt; gp_Pnt aPnt;
TopoDS_Compound aCompound;
bool retCompound = false;
if (aType == POINT_XYZ) { if (aType == POINT_XYZ) {
aPnt = gp_Pnt(aPI.GetX(), aPI.GetY(), aPI.GetZ()); aPnt = gp_Pnt(aPI.GetX(), aPI.GetY(), aPI.GetZ());
@ -120,7 +124,6 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
} }
gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aRefShape)); gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aRefShape));
aPnt = gp_Pnt(P.X() + aPI.GetX(), P.Y() + aPI.GetY(), P.Z() + aPI.GetZ()); aPnt = gp_Pnt(P.X() + aPI.GetX(), P.Y() + aPI.GetY(), P.Z() + aPI.GetZ());
} }
else if (aType == POINT_CURVE_PAR) { else if (aType == POINT_CURVE_PAR) {
Handle(GEOM_Function) aRefCurve = aPI.GetCurve(); Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
@ -181,23 +184,30 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
TopoDS_Shape aRefShape1 = aRef1->GetValue(); TopoDS_Shape aRefShape1 = aRef1->GetValue();
TopoDS_Shape aRefShape2 = aRef2->GetValue(); TopoDS_Shape aRefShape2 = aRef2->GetValue();
if (aRefShape1.ShapeType() != TopAbs_EDGE || aRefShape2.ShapeType() != TopAbs_EDGE ) { if ( (aRefShape1.ShapeType() != TopAbs_EDGE && aRefShape1.ShapeType() != TopAbs_WIRE)
|| (aRefShape2.ShapeType() != TopAbs_EDGE && aRefShape2.ShapeType() != TopAbs_WIRE) ) {
Standard_TypeMismatch::Raise Standard_TypeMismatch::Raise
("Creation Point On Lines Intersection Aborted : Line shape is not an edge"); ("Creation Point On Lines Intersection Aborted : Line shape is not an edge or wire");
} }
//Calculate Lines Intersection Point //Calculate Lines Intersection Point
BRepExtrema_DistShapeShape dst (aRefShape1, aRefShape2); BRepExtrema_DistShapeShape dst (aRefShape1, aRefShape2);
if (dst.IsDone()) if (dst.IsDone()) {
{
gp_Pnt P1, P2; gp_Pnt P1, P2;
BRep_Builder B;
B.MakeCompound( aCompound );
for (int i = 1; i <= dst.NbSolution(); i++) { for (int i = 1; i <= dst.NbSolution(); i++) {
P1 = dst.PointOnShape1(i); P1 = dst.PointOnShape1(i);
P2 = dst.PointOnShape2(i); P2 = dst.PointOnShape2(i);
Standard_Real Dist = P1.Distance(P2); Standard_Real Dist = P1.Distance(P2);
if ( Dist <= Precision::Confusion() ) if ( Dist <= Precision::Confusion() && dst.NbSolution() > 1) {
BRepBuilderAPI_MakeVertex mkVertex (P1);
B.Add(aCompound, mkVertex.Shape());
retCompound = true;
} else if ( Dist <= Precision::Confusion() ) {
aPnt = P1; aPnt = P1;
else } else {
Standard_TypeMismatch::Raise ("Lines not have an Intersection Point"); Standard_TypeMismatch::Raise ("Shapes has not an Intersection Points");
}
} }
} }
} }
@ -205,8 +215,14 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
return 0; return 0;
} }
TopoDS_Shape aShape;
if ( retCompound ) {
aShape = aCompound;
} else {
BRepBuilderAPI_MakeVertex mkVertex (aPnt); BRepBuilderAPI_MakeVertex mkVertex (aPnt);
TopoDS_Shape aShape = mkVertex.Shape(); aShape = mkVertex.Shape();
}
aShape.Infinite(Standard_True); aShape.Infinite(Standard_True);
aFunction->SetValue(aShape); aFunction->SetValue(aShape);
@ -258,5 +274,3 @@ const Handle(GEOMImpl_PointDriver) Handle(GEOMImpl_PointDriver)::DownCast(const
return _anOtherObject ; return _anOtherObject ;
} }