mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-30 19:30:36 +05:00
0022869: Disable Generate Groups if the path is closed
This commit is contained in:
parent
ff93873f53
commit
c5bc521a7c
@ -35,7 +35,9 @@
|
|||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
@ -217,6 +219,7 @@ void GenerationGUI_PipeDlg::Init()
|
|||||||
|
|
||||||
GroupPoints->PushButton1->click();
|
GroupPoints->PushButton1->click();
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
|
updateGenGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -286,6 +289,7 @@ void GenerationGUI_PipeDlg::SelectionTypeButtonClicked()
|
|||||||
if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
|
if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
myPath.nullify();
|
myPath.nullify();
|
||||||
|
updateGenGroup();
|
||||||
}
|
}
|
||||||
processPreview();
|
processPreview();
|
||||||
}
|
}
|
||||||
@ -352,6 +356,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
|||||||
else if ( myBaseObjects.isEmpty() )
|
else if ( myBaseObjects.isEmpty() )
|
||||||
GroupPoints->PushButton1->click();
|
GroupPoints->PushButton1->click();
|
||||||
}
|
}
|
||||||
|
updateGenGroup();
|
||||||
}
|
}
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
|
else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
|
||||||
myVec = getSelected( TopAbs_EDGE );
|
myVec = getSelected( TopAbs_EDGE );
|
||||||
@ -391,6 +396,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
|||||||
QString aName = GEOMBase::GetName( myPath.get() );
|
QString aName = GEOMBase::GetName( myPath.get() );
|
||||||
myEditCurrentArgument->setText( aName );
|
myEditCurrentArgument->setText( aName );
|
||||||
}
|
}
|
||||||
|
updateGenGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
processPreview();
|
processPreview();
|
||||||
@ -537,7 +543,8 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects)
|
|||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
if (doGroups) {
|
if (doGroups) {
|
||||||
doGroups = myGenGroupCheckGP->isChecked();
|
doGroups = myGenGroupCheckGP->isEnabled() &&
|
||||||
|
myGenGroupCheckGP->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < myBaseObjects.count(); i++) {
|
for (int i = 0; i < myBaseObjects.count(); i++) {
|
||||||
@ -577,7 +584,8 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (doGroups) {
|
if (doGroups) {
|
||||||
doGroups = myGenGroupCheckGMP->isChecked();
|
doGroups = myGenGroupCheckGMP->isEnabled() &&
|
||||||
|
myGenGroupCheckGMP->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
aList = anOper->MakePipeWithDifferentSections
|
aList = anOper->MakePipeWithDifferentSections
|
||||||
@ -632,7 +640,6 @@ void GenerationGUI_PipeDlg::restoreSubShapes
|
|||||||
QCheckBox *aGenGroupCheck = NULL;
|
QCheckBox *aGenGroupCheck = NULL;
|
||||||
QLineEdit *aPrefixEdit = NULL;
|
QLineEdit *aPrefixEdit = NULL;
|
||||||
|
|
||||||
|
|
||||||
switch (getConstructorId()) {
|
switch (getConstructorId()) {
|
||||||
case 0 :
|
case 0 :
|
||||||
case 1 :
|
case 1 :
|
||||||
@ -712,6 +719,82 @@ void GenerationGUI_PipeDlg::GenGroupClicked(bool isChecked)
|
|||||||
resetGenGroup((QCheckBox *)sender(), isChecked, false);
|
resetGenGroup((QCheckBox *)sender(), isChecked, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : updateGenGroup
|
||||||
|
// purpose : Update "Generate groups" widgets depending on the path.
|
||||||
|
//=================================================================================
|
||||||
|
void GenerationGUI_PipeDlg::updateGenGroup()
|
||||||
|
{
|
||||||
|
bool isEnable = true;
|
||||||
|
|
||||||
|
if (myPath) {
|
||||||
|
// Check if the path is closed.
|
||||||
|
TopoDS_Shape aShapePath;
|
||||||
|
|
||||||
|
if (GEOMBase::GetShape(myPath.get(), aShapePath) &&
|
||||||
|
aShapePath.IsNull() == Standard_False) {
|
||||||
|
if (aShapePath.Closed()) {
|
||||||
|
// No groups should be generated if the path is closed.
|
||||||
|
isEnable = false;
|
||||||
|
} else {
|
||||||
|
const TopAbs_ShapeEnum aType = aShapePath.ShapeType();
|
||||||
|
|
||||||
|
if (aType == TopAbs_EDGE || aType == TopAbs_WIRE) {
|
||||||
|
// Check if path ends are coinsident.
|
||||||
|
TopoDS_Vertex aV[2];
|
||||||
|
|
||||||
|
if (aType == TopAbs_EDGE) {
|
||||||
|
// Edge
|
||||||
|
TopExp::Vertices(TopoDS::Edge(aShapePath), aV[0], aV[1]);
|
||||||
|
} else {
|
||||||
|
// Wire
|
||||||
|
TopExp::Vertices(TopoDS::Wire(aShapePath), aV[0], aV[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aV[0].IsNull() == Standard_False &&
|
||||||
|
aV[1].IsNull() == Standard_False) {
|
||||||
|
if (aV[0].IsSame(aV[1])) {
|
||||||
|
// No groups should be generated if the path is closed.
|
||||||
|
isEnable = false;
|
||||||
|
} else {
|
||||||
|
const Standard_Real aTol1 = BRep_Tool::Tolerance(aV[0]);
|
||||||
|
const Standard_Real aTol2 = BRep_Tool::Tolerance(aV[1]);
|
||||||
|
const gp_Pnt aPnt1 = BRep_Tool::Pnt(aV[0]);
|
||||||
|
const gp_Pnt aPnt2 = BRep_Tool::Pnt(aV[1]);
|
||||||
|
|
||||||
|
if (aPnt1.Distance(aPnt2) <= aTol1 + aTol2) {
|
||||||
|
// No groups should be generated if the path is closed.
|
||||||
|
isEnable = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QCheckBox *aGenGroupCheck = NULL;
|
||||||
|
|
||||||
|
switch (getConstructorId()) {
|
||||||
|
case 0 :
|
||||||
|
case 1 :
|
||||||
|
aGenGroupCheck = myGenGroupCheckGP;
|
||||||
|
break;
|
||||||
|
case 2 :
|
||||||
|
aGenGroupCheck = myGenGroupCheckGMP;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aGenGroupCheck != NULL) {
|
||||||
|
const bool isChecked = aGenGroupCheck->isChecked();
|
||||||
|
|
||||||
|
aGenGroupCheck->setEnabled(isEnable);
|
||||||
|
resetGenGroup(aGenGroupCheck, isEnable && isChecked, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : resetGenGroup
|
// function : resetGenGroup
|
||||||
// purpose : Resets data of "Generate groups" widgets.
|
// purpose : Resets data of "Generate groups" widgets.
|
||||||
|
@ -62,6 +62,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
void enterEvent( QEvent* );
|
void enterEvent( QEvent* );
|
||||||
|
void updateGenGroup();
|
||||||
void resetGenGroup
|
void resetGenGroup
|
||||||
(QCheckBox *theGenGroup,
|
(QCheckBox *theGenGroup,
|
||||||
const bool isChecked,
|
const bool isChecked,
|
||||||
|
Loading…
Reference in New Issue
Block a user