mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-27 06:40:49 +05:00
Bugs 16640, 19050: Improve selection mechanism in GEOM dialog boxes.
This commit is contained in:
parent
0dd54298d5
commit
b77eef91b6
@ -26,20 +26,19 @@
|
|||||||
#include "MeasureGUI_AngleDlg.h"
|
#include "MeasureGUI_AngleDlg.h"
|
||||||
#include "MeasureGUI_Widgets.h"
|
#include "MeasureGUI_Widgets.h"
|
||||||
|
|
||||||
#include <GEOMBase.h>
|
|
||||||
#include <DlgRef.h>
|
#include <DlgRef.h>
|
||||||
|
#include <GEOMBase.h>
|
||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
|
|
||||||
#include <SUIT_Desktop.h>
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
|
#include <SUIT_Desktop.h>
|
||||||
#include <SUIT_ResourceMgr.h>
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include <SalomeApp_Tools.h>
|
|
||||||
#include <SUIT_MessageBox.h>
|
#include <SUIT_MessageBox.h>
|
||||||
#include <SUIT_ViewWindow.h>
|
#include <SUIT_ViewWindow.h>
|
||||||
#include <SUIT_ViewManager.h>
|
#include <SUIT_ViewManager.h>
|
||||||
#include <SOCC_Prs.h>
|
#include <SOCC_Prs.h>
|
||||||
#include <SOCC_ViewModel.h>
|
#include <SOCC_ViewModel.h>
|
||||||
|
#include <SalomeApp_Tools.h>
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
@ -82,13 +81,13 @@
|
|||||||
MeasureGUI_AngleDlg::MeasureGUI_AngleDlg (GeometryGUI* GUI, QWidget* parent)
|
MeasureGUI_AngleDlg::MeasureGUI_AngleDlg (GeometryGUI* GUI, QWidget* parent)
|
||||||
: MeasureGUI_Skeleton(GUI, parent)
|
: MeasureGUI_Skeleton(GUI, parent)
|
||||||
{
|
{
|
||||||
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_ANGLE" ) ) );
|
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||||
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_ANGLE")));
|
||||||
|
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||||
|
|
||||||
setWindowTitle(tr("GEOM_MEASURE_ANGLE_TITLE"));
|
setWindowTitle(tr("GEOM_MEASURE_ANGLE_TITLE"));
|
||||||
|
|
||||||
// Widgets
|
/***************************************************************/
|
||||||
|
|
||||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_MEASURE_ANGLE_ANGLE"));
|
mainFrame()->GroupConstructors->setTitle(tr("GEOM_MEASURE_ANGLE_ANGLE"));
|
||||||
mainFrame()->RadioButton1->setIcon(image0);
|
mainFrame()->RadioButton1->setIcon(image0);
|
||||||
|
|
||||||
@ -106,6 +105,7 @@ MeasureGUI_AngleDlg::MeasureGUI_AngleDlg( GeometryGUI* GUI, QWidget* parent )
|
|||||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||||
layout->setMargin(0); layout->setSpacing(6);
|
layout->setMargin(0); layout->setSpacing(6);
|
||||||
layout->addWidget(myGrp);
|
layout->addWidget(myGrp);
|
||||||
|
/***************************************************************/
|
||||||
|
|
||||||
// Help page reference
|
// Help page reference
|
||||||
myHelpFileName = "using_measurement_tools_page.html#angle_anchor";
|
myHelpFileName = "using_measurement_tools_page.html#angle_anchor";
|
||||||
@ -128,6 +128,11 @@ MeasureGUI_AngleDlg::~MeasureGUI_AngleDlg()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void MeasureGUI_AngleDlg::Init()
|
void MeasureGUI_AngleDlg::Init()
|
||||||
{
|
{
|
||||||
|
// init variables
|
||||||
|
myGrp->LineEdit1->setText("");
|
||||||
|
myGrp->LineEdit2->setText("");
|
||||||
|
myObj = myObj2 = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
mySelBtn = myGrp->PushButton1;
|
mySelBtn = myGrp->PushButton1;
|
||||||
mySelEdit = myGrp->LineEdit1;
|
mySelEdit = myGrp->LineEdit1;
|
||||||
mySelBtn2 = myGrp->PushButton2;
|
mySelBtn2 = myGrp->PushButton2;
|
||||||
@ -135,6 +140,7 @@ void MeasureGUI_AngleDlg::Init()
|
|||||||
|
|
||||||
myEditCurrentArgument = mySelEdit;
|
myEditCurrentArgument = mySelEdit;
|
||||||
|
|
||||||
|
// signals and slots connections
|
||||||
connect(mySelEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
connect(mySelEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
|
|
||||||
@ -142,7 +148,6 @@ void MeasureGUI_AngleDlg::Init()
|
|||||||
MeasureGUI_Skeleton::Init();
|
MeasureGUI_Skeleton::Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection has changed
|
// purpose : Called when selection has changed
|
||||||
@ -162,10 +167,22 @@ void MeasureGUI_AngleDlg::SelectionIntoArgument()
|
|||||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myEditCurrentArgument == mySelEdit)
|
// clear selection
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||||
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
if (myEditCurrentArgument == mySelEdit) {
|
||||||
myObj = aSelectedObject;
|
myObj = aSelectedObject;
|
||||||
else
|
if (!myObj->_is_nil() && myObj2->_is_nil())
|
||||||
|
myGrp->PushButton2->click();
|
||||||
|
}
|
||||||
|
else {
|
||||||
myObj2 = aSelectedObject;
|
myObj2 = aSelectedObject;
|
||||||
|
if (!myObj2->_is_nil() && myObj->_is_nil())
|
||||||
|
myGrp->PushButton1->click();
|
||||||
|
}
|
||||||
|
|
||||||
processObject();
|
processObject();
|
||||||
}
|
}
|
||||||
@ -227,17 +244,32 @@ void MeasureGUI_AngleDlg::SetEditCurrentArgument()
|
|||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
if ( send == mySelBtn ) {
|
if (send == myGrp->PushButton1) {
|
||||||
mySelEdit->setFocus();
|
myEditCurrentArgument = myGrp->LineEdit1;
|
||||||
myEditCurrentArgument = mySelEdit;
|
|
||||||
|
myGrp->PushButton2->setDown(false);
|
||||||
|
myGrp->LineEdit2->setEnabled(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mySelEdit2->setFocus();
|
myEditCurrentArgument = myGrp->LineEdit2;
|
||||||
myEditCurrentArgument = mySelEdit2;
|
|
||||||
|
myGrp->PushButton1->setDown(false);
|
||||||
|
myGrp->LineEdit1->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
globalSelection(GEOM_LINE);
|
globalSelection(GEOM_LINE);
|
||||||
SelectionIntoArgument();
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
// enable line edit
|
||||||
|
myEditCurrentArgument->setEnabled(true);
|
||||||
|
myEditCurrentArgument->setFocus();
|
||||||
|
// after setFocus(), because it will be setDown(false) when loses focus
|
||||||
|
send->setDown(true);
|
||||||
|
|
||||||
|
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||||
|
redisplayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
@ -26,9 +26,8 @@
|
|||||||
#include "MeasureGUI_DistanceDlg.h"
|
#include "MeasureGUI_DistanceDlg.h"
|
||||||
#include "MeasureGUI_Widgets.h"
|
#include "MeasureGUI_Widgets.h"
|
||||||
|
|
||||||
#include <GEOMBase.h>
|
|
||||||
#include <DlgRef.h>
|
#include <DlgRef.h>
|
||||||
|
#include <GEOMBase.h>
|
||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
@ -42,6 +41,7 @@
|
|||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
// OCCT Includes
|
||||||
#include <Geom_Plane.hxx>
|
#include <Geom_Plane.hxx>
|
||||||
#include <AIS_LengthDimension.hxx>
|
#include <AIS_LengthDimension.hxx>
|
||||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||||
@ -59,15 +59,13 @@
|
|||||||
MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg (GeometryGUI* GUI, QWidget* parent)
|
MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg (GeometryGUI* GUI, QWidget* parent)
|
||||||
: MeasureGUI_Skeleton(GUI, parent)
|
: MeasureGUI_Skeleton(GUI, parent)
|
||||||
{
|
{
|
||||||
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap(
|
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||||
"GEOM", tr( "ICON_DLG_MINDIST" ) ) );
|
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MINDIST")));
|
||||||
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap(
|
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||||
"GEOM", tr( "ICON_SELECT" ) ) );
|
|
||||||
|
|
||||||
setWindowTitle(tr("GEOM_MINDIST_TITLE"));
|
setWindowTitle(tr("GEOM_MINDIST_TITLE"));
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_DISTANCE"));
|
mainFrame()->GroupConstructors->setTitle(tr("GEOM_DISTANCE"));
|
||||||
mainFrame()->RadioButton1->setIcon(image0);
|
mainFrame()->RadioButton1->setIcon(image0);
|
||||||
|
|
||||||
@ -91,16 +89,14 @@ MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg( GeometryGUI* GUI, QWidget* paren
|
|||||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||||
layout->setMargin(0); layout->setSpacing(6);
|
layout->setMargin(0); layout->setSpacing(6);
|
||||||
layout->addWidget(myGrp);
|
layout->addWidget(myGrp);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
myHelpFileName = "using_measurement_tools_page.html#min_distance_anchor";
|
myHelpFileName = "using_measurement_tools_page.html#min_distance_anchor";
|
||||||
|
|
||||||
/* Initialisation */
|
// Initialisation
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~MeasureGUI_DistanceDlg()
|
// function : ~MeasureGUI_DistanceDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
@ -109,27 +105,29 @@ MeasureGUI_DistanceDlg::~MeasureGUI_DistanceDlg()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void MeasureGUI_DistanceDlg::Init()
|
void MeasureGUI_DistanceDlg::Init()
|
||||||
{
|
{
|
||||||
|
// init variables
|
||||||
|
myGrp->LineEdit1->setText("");
|
||||||
|
myGrp->LineEdit2->setText("");
|
||||||
|
myObj = myObj2 = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
mySelBtn = myGrp->PushButton1;
|
mySelBtn = myGrp->PushButton1;
|
||||||
mySelEdit = myGrp->LineEdit1;
|
mySelEdit = myGrp->LineEdit1;
|
||||||
mySelBtn2 = myGrp->PushButton2;
|
|
||||||
mySelEdit2 = myGrp->LineEdit2;
|
|
||||||
|
|
||||||
myEditCurrentArgument = mySelEdit;
|
myEditCurrentArgument = myGrp->LineEdit1;
|
||||||
|
|
||||||
connect( mySelEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
|
// signals and slots connections
|
||||||
connect( mySelBtn2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
connect(myGrp->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
connect(myGrp->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
|
|
||||||
MeasureGUI_Skeleton::Init();
|
MeasureGUI_Skeleton::Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection has changed
|
// purpose : Called when selection has changed
|
||||||
@ -149,10 +147,22 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument()
|
|||||||
aSelectedObject = GEOM::GEOM_Object::_nil();
|
aSelectedObject = GEOM::GEOM_Object::_nil();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( myEditCurrentArgument == mySelEdit )
|
// clear selection
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||||
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
if (myEditCurrentArgument == myGrp->LineEdit1) {
|
||||||
myObj = aSelectedObject;
|
myObj = aSelectedObject;
|
||||||
else
|
if (!myObj->_is_nil() && myObj2->_is_nil())
|
||||||
|
myGrp->PushButton2->click();
|
||||||
|
}
|
||||||
|
else {
|
||||||
myObj2 = aSelectedObject;
|
myObj2 = aSelectedObject;
|
||||||
|
if (!myObj2->_is_nil() && myObj->_is_nil())
|
||||||
|
myGrp->PushButton1->click();
|
||||||
|
}
|
||||||
|
|
||||||
processObject();
|
processObject();
|
||||||
}
|
}
|
||||||
@ -196,13 +206,11 @@ bool MeasureGUI_DistanceDlg::getParameters( double& theDistance,
|
|||||||
gp_Pnt& thePnt2)
|
gp_Pnt& thePnt2)
|
||||||
{
|
{
|
||||||
QString msg;
|
QString msg;
|
||||||
if ( !isValid( msg ) )
|
if (isValid(msg)) {
|
||||||
return false;
|
|
||||||
else {
|
|
||||||
try {
|
try {
|
||||||
double x1, y1, z1, x2, y2, z2;
|
double x1, y1, z1, x2, y2, z2;
|
||||||
theDistance = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetMinDistance(
|
theDistance = GEOM::GEOM_IMeasureOperations::_narrow(getOperation())->
|
||||||
myObj, myObj2, x1, y1, z1, x2, y2, z2 );
|
GetMinDistance(myObj, myObj2, x1, y1, z1, x2, y2, z2);
|
||||||
|
|
||||||
thePnt1.SetCoord(x1, y1, z1);
|
thePnt1.SetCoord(x1, y1, z1);
|
||||||
thePnt2.SetCoord(x2, y2, z2);
|
thePnt2.SetCoord(x2, y2, z2);
|
||||||
@ -214,8 +222,9 @@ bool MeasureGUI_DistanceDlg::getParameters( double& theDistance,
|
|||||||
|
|
||||||
return getOperation()->IsDone();
|
return getOperation()->IsDone();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
@ -225,18 +234,28 @@ void MeasureGUI_DistanceDlg::SetEditCurrentArgument()
|
|||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
if ( send == mySelBtn ) {
|
if (send == myGrp->PushButton1) {
|
||||||
mySelEdit->setFocus();
|
myEditCurrentArgument = myGrp->LineEdit1;
|
||||||
myEditCurrentArgument = mySelEdit;
|
|
||||||
|
myGrp->PushButton2->setDown(false);
|
||||||
|
myGrp->LineEdit2->setEnabled(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mySelEdit2->setFocus();
|
myEditCurrentArgument = myGrp->LineEdit2;
|
||||||
myEditCurrentArgument = mySelEdit2;
|
|
||||||
|
myGrp->PushButton1->setDown(false);
|
||||||
|
myGrp->LineEdit1->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionIntoArgument();
|
// enable line edit
|
||||||
}
|
myEditCurrentArgument->setEnabled(true);
|
||||||
|
myEditCurrentArgument->setFocus();
|
||||||
|
// after setFocus(), because it will be setDown(false) when loses focus
|
||||||
|
send->setDown(true);
|
||||||
|
|
||||||
|
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||||
|
redisplayPreview();
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : LineEditReturnPressed()
|
// function : LineEditReturnPressed()
|
||||||
@ -246,19 +265,17 @@ void MeasureGUI_DistanceDlg::LineEditReturnPressed()
|
|||||||
{
|
{
|
||||||
QLineEdit* send = (QLineEdit*)sender();
|
QLineEdit* send = (QLineEdit*)sender();
|
||||||
|
|
||||||
if ( send == mySelEdit )
|
if (send == myGrp->LineEdit1 || send == myGrp->LineEdit2) {
|
||||||
myEditCurrentArgument = mySelEdit;
|
myEditCurrentArgument = send;
|
||||||
else
|
|
||||||
myEditCurrentArgument = mySelEdit2;
|
|
||||||
|
|
||||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||||
SALOME_ListIO aSelList;
|
SALOME_ListIO aSelList;
|
||||||
aSelMgr->selectedObjects(aSelList);
|
aSelMgr->selectedObjects(aSelList);
|
||||||
|
|
||||||
if (GEOMBase::SelectionByNameInDialogs(this, mySelEdit->text(), aSelList))
|
if (GEOMBase::SelectionByNameInDialogs(this, myGrp->LineEdit1->text(), aSelList))
|
||||||
mySelEdit->setText(mySelEdit->text());
|
myGrp->LineEdit1->setText(myGrp->LineEdit1->text());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : buildPrs()
|
// function : buildPrs()
|
||||||
@ -269,7 +286,6 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
|
|||||||
double aDist = 0.;
|
double aDist = 0.;
|
||||||
gp_Pnt aPnt1(0, 0, 0), aPnt2(0, 0, 0);
|
gp_Pnt aPnt1(0, 0, 0), aPnt2(0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
||||||
|
|
||||||
if (myObj->_is_nil() || myObj2->_is_nil() ||
|
if (myObj->_is_nil() || myObj2->_is_nil() ||
|
||||||
|
@ -34,14 +34,15 @@
|
|||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
#include <GEOMImpl_Types.hxx>
|
// OCCT Includes
|
||||||
|
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
|
||||||
|
#include <GEOMImpl_Types.hxx>
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : MeasureGUI_NormaleDlg()
|
// class : MeasureGUI_NormaleDlg()
|
||||||
// purpose : Constructs a MeasureGUI_NormaleDlg which is a child of 'parent', with the
|
// purpose : Constructs a MeasureGUI_NormaleDlg which is a child of 'parent', with the
|
||||||
@ -78,7 +79,6 @@ MeasureGUI_NormaleDlg::MeasureGUI_NormaleDlg( GeometryGUI* theGeometryGUI, QWidg
|
|||||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||||
layout->setMargin(0); layout->setSpacing(6);
|
layout->setMargin(0); layout->setSpacing(6);
|
||||||
layout->addWidget(GroupArgs);
|
layout->addWidget(GroupArgs);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
setHelpFileName("using_measurement_tools_page.html#normale_anchor");
|
setHelpFileName("using_measurement_tools_page.html#normale_anchor");
|
||||||
@ -100,18 +100,15 @@ MeasureGUI_NormaleDlg::~MeasureGUI_NormaleDlg()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void MeasureGUI_NormaleDlg::Init()
|
void MeasureGUI_NormaleDlg::Init()
|
||||||
{
|
{
|
||||||
/* init variables */
|
// init variables
|
||||||
GroupArgs->LineEdit1->setReadOnly(true);
|
GroupArgs->LineEdit1->setReadOnly(true);
|
||||||
GroupArgs->LineEdit2->setReadOnly(true);
|
GroupArgs->LineEdit2->setReadOnly(true);
|
||||||
|
|
||||||
myFace = GEOM::GEOM_Object::_nil();
|
GroupArgs->LineEdit1->setText("");
|
||||||
myPoint = GEOM::GEOM_Object::_nil();
|
GroupArgs->LineEdit2->setText("");
|
||||||
|
myFace = myPoint = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
myEditCurrentArgument = GroupArgs->LineEdit1;
|
// signals and slots connections
|
||||||
globalSelection( GEOM_FACE ); // to close previous local selection
|
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
|
|
||||||
|
|
||||||
/* signals and slots connections */
|
|
||||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
|
|
||||||
@ -121,11 +118,9 @@ void MeasureGUI_NormaleDlg::Init()
|
|||||||
connect(GroupArgs->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
connect(GroupArgs->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
connect(GroupArgs->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
connect(GroupArgs->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
|
||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
|
|
||||||
initName(tr("GEOM_VECTOR_NORMALE"));
|
initName(tr("GEOM_VECTOR_NORMALE"));
|
||||||
|
|
||||||
|
GroupArgs->PushButton1->click();
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,12 +144,14 @@ bool MeasureGUI_NormaleDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
initName();
|
initName();
|
||||||
|
// activate first line edit
|
||||||
|
GroupArgs->PushButton1->click();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection as changed or other case
|
// purpose : Called when selection is changed or on dialog initialization or activation
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void MeasureGUI_NormaleDlg::SelectionIntoArgument()
|
void MeasureGUI_NormaleDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
@ -180,7 +177,7 @@ void MeasureGUI_NormaleDlg::SelectionIntoArgument()
|
|||||||
GEOM::GEOM_Object_var aSelectedObject =
|
GEOM::GEOM_Object_var aSelectedObject =
|
||||||
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
|
||||||
|
|
||||||
if ( !testResult )
|
if (!testResult || CORBA::is_nil(aSelectedObject))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString aName = GEOMBase::GetName(aSelectedObject);
|
QString aName = GEOMBase::GetName(aSelectedObject);
|
||||||
@ -207,6 +204,16 @@ void MeasureGUI_NormaleDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
myFace = aSelectedObject;
|
myFace = aSelectedObject;
|
||||||
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
|
// clear selection
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||||
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
if (!myFace->_is_nil() && myPoint->_is_nil())
|
||||||
|
GroupArgs->PushButton2->click();
|
||||||
}
|
}
|
||||||
else if (myEditCurrentArgument == GroupArgs->LineEdit2) {
|
else if (myEditCurrentArgument == GroupArgs->LineEdit2) {
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
@ -230,10 +237,58 @@ void MeasureGUI_NormaleDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
myPoint = aSelectedObject;
|
myPoint = aSelectedObject;
|
||||||
}
|
|
||||||
|
|
||||||
myEditCurrentArgument->setText(aName);
|
myEditCurrentArgument->setText(aName);
|
||||||
|
|
||||||
|
// clear selection
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
myGeomGUI->getApp()->selectionMgr()->clearSelected();
|
||||||
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
if (!myPoint->_is_nil() && myFace->_is_nil())
|
||||||
|
GroupArgs->PushButton1->click();
|
||||||
|
}
|
||||||
|
|
||||||
|
displayPreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : SetEditCurrentArgument()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void MeasureGUI_NormaleDlg::SetEditCurrentArgument()
|
||||||
|
{
|
||||||
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
globalSelection(GEOM_FACE);
|
||||||
|
|
||||||
|
if (send == GroupArgs->PushButton1) {
|
||||||
|
myEditCurrentArgument = GroupArgs->LineEdit1;
|
||||||
|
|
||||||
|
GroupArgs->PushButton2->setDown(false);
|
||||||
|
GroupArgs->LineEdit2->setEnabled(false);
|
||||||
|
|
||||||
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE);
|
||||||
|
}
|
||||||
|
else if (send == GroupArgs->PushButton2) {
|
||||||
|
myEditCurrentArgument = GroupArgs->LineEdit2;
|
||||||
|
|
||||||
|
GroupArgs->PushButton1->setDown(false);
|
||||||
|
GroupArgs->LineEdit1->setEnabled(false);
|
||||||
|
|
||||||
|
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
|
||||||
|
}
|
||||||
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
// enable line edit
|
||||||
|
myEditCurrentArgument->setEnabled(true);
|
||||||
|
myEditCurrentArgument->setFocus();
|
||||||
|
// after setFocus(), because it will be setDown(false) when loses focus
|
||||||
|
send->setDown(true);
|
||||||
|
|
||||||
|
// seems we need it only to avoid preview disappearing, caused by selection mode change
|
||||||
displayPreview();
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,28 +306,6 @@ void MeasureGUI_NormaleDlg::LineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : SetEditCurrentArgument()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void MeasureGUI_NormaleDlg::SetEditCurrentArgument()
|
|
||||||
{
|
|
||||||
QPushButton* send = (QPushButton*)sender();
|
|
||||||
globalSelection( GEOM_FACE );
|
|
||||||
|
|
||||||
if ( send == GroupArgs->PushButton1 ) {
|
|
||||||
myEditCurrentArgument = GroupArgs->LineEdit1;
|
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
|
|
||||||
}
|
|
||||||
else if ( send == GroupArgs->PushButton2 ) {
|
|
||||||
myEditCurrentArgument = GroupArgs->LineEdit2;
|
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
|
||||||
}
|
|
||||||
|
|
||||||
myEditCurrentArgument->setFocus();
|
|
||||||
SelectionIntoArgument();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -281,14 +314,15 @@ void MeasureGUI_NormaleDlg::ActivateThisDialog()
|
|||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
|
|
||||||
SelectionIntoArgument();
|
// reinit, because some selected objects could be removed
|
||||||
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void MeasureGUI_NormaleDlg::enterEvent( QEvent* e )
|
void MeasureGUI_NormaleDlg::enterEvent (QEvent*)
|
||||||
{
|
{
|
||||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user