mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-15 13:50:36 +05:00
0020695: EDF 1076 GEOM: Add a new shape in GEOM: T-shape
Correction for groups Added color change for buttons as for the L1 and L2 spin boxes.
This commit is contained in:
parent
aab7f57282
commit
db88ad36a7
@ -50,7 +50,7 @@ AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg(GeometryGUI* theGeometryGUI
|
|||||||
GEOMBase_Skeleton(theGeometryGUI, parent, false) {
|
GEOMBase_Skeleton(theGeometryGUI, parent, false) {
|
||||||
QPixmap imageOp(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPETSHAPE")));
|
QPixmap imageOp(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPETSHAPE")));
|
||||||
QPixmap imageSel(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
|
QPixmap imageSel(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||||
QPixmap imageImp(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICO_PIPETSHAPE_IMPORT")));
|
imageImp = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICO_PIPETSHAPE_IMPORT"));
|
||||||
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
|
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
|
||||||
|
|
||||||
setWindowTitle(tr("GEOM_PIPE_TSHAPE_TITLE"));
|
setWindowTitle(tr("GEOM_PIPE_TSHAPE_TITLE"));
|
||||||
@ -137,30 +137,6 @@ AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg(GeometryGUI* theGeometryGUI
|
|||||||
JunctionPointsSel->TextLabel6->setAttribute(Qt::WA_DeleteOnClose);
|
JunctionPointsSel->TextLabel6->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
JunctionPointsSel->TextLabel6->close();
|
JunctionPointsSel->TextLabel6->close();
|
||||||
|
|
||||||
// QGridLayout* junctionLayout = (QGridLayout*)JunctionPointsSel->GroupBox1->layout();
|
|
||||||
|
|
||||||
// junctionLayout->addWidget(new QLabel(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L1"), JunctionPointsSel->GroupBox1), 3, 0, 1, 1);
|
|
||||||
//
|
|
||||||
// QPushButton* ApplyNewL1 = new QPushButton(centralWidget());
|
|
||||||
// // ApplyNewL1->setText("Apply new L1");
|
|
||||||
// ApplyNewL1->setIcon(imageImp);
|
|
||||||
// junctionLayout->addWidget(ApplyNewL1, 3, 1, 1, 1);
|
|
||||||
//
|
|
||||||
// NewPosValL1 = new QLineEdit(JunctionPointsSel->GroupBox1);
|
|
||||||
// NewPosValL1->setReadOnly(true);
|
|
||||||
// junctionLayout->addWidget(NewPosValL1, 3, 2, 1, 1);
|
|
||||||
//
|
|
||||||
// junctionLayout->addWidget(new QLabel(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L2"), JunctionPointsSel->GroupBox1), 4, 0, 1, 1);
|
|
||||||
//
|
|
||||||
// QPushButton* ApplyNewL2 = new QPushButton(centralWidget());
|
|
||||||
// // ApplyNewL2->setText("Apply new L2");
|
|
||||||
// ApplyNewL2->setIcon(imageImp);
|
|
||||||
// junctionLayout->addWidget(ApplyNewL2, 4, 1, 1, 1);
|
|
||||||
//
|
|
||||||
// NewPosValL2 = new QLineEdit(JunctionPointsSel->GroupBox1);
|
|
||||||
// NewPosValL2->setReadOnly(true);
|
|
||||||
// junctionLayout->addWidget(NewPosValL2, 4, 2, 1, 1);
|
|
||||||
|
|
||||||
// 1st row, height = 1, colspan = 3
|
// 1st row, height = 1, colspan = 3
|
||||||
int rowPict = 0, colPict = 0, rowspanPict = 1, colspanPict = 3;
|
int rowPict = 0, colPict = 0, rowspanPict = 1, colspanPict = 3;
|
||||||
// 2nd row, height = 4, col 1
|
// 2nd row, height = 4, col 1
|
||||||
@ -236,6 +212,15 @@ void AdvancedGUI_PipeTShapeDlg::Init() {
|
|||||||
ChamferGroupParams->SpinBox_DY->setValue(10);
|
ChamferGroupParams->SpinBox_DY->setValue(10);
|
||||||
FilletGroupParams->SpinBox_DX->setValue(20);
|
FilletGroupParams->SpinBox_DX->setValue(20);
|
||||||
|
|
||||||
|
CssNormal = QString("QDoubleSpinBox {");
|
||||||
|
CssNormal.append(MainTubeGroupParams->SpinBox_DZ->styleSheet());
|
||||||
|
CssNormal.append("}");
|
||||||
|
CssNormal.append("\nQPushButton {");
|
||||||
|
CssNormal.append(JunctionPointsSel->PushButton4->styleSheet());
|
||||||
|
CssNormal.append("}");
|
||||||
|
CssAcceptable = "QDoubleSpinBox, QPushButton {background-color: rgb(85, 170, 127)}";
|
||||||
|
CssRefused = "QDoubleSpinBox, QPushButton {background-color: rgb(255, 0, 0)}";
|
||||||
|
|
||||||
// Signal/slot connections
|
// Signal/slot 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()));
|
||||||
@ -754,8 +739,10 @@ bool AdvancedGUI_PipeTShapeDlg::isValid(QString& msg) {
|
|||||||
bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var theP1,
|
bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var theP1,
|
||||||
GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3, double theTolerance) {
|
GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3, double theTolerance) {
|
||||||
|
|
||||||
MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
|
MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
|
||||||
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
|
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
|
||||||
|
JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
|
||||||
|
JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
|
||||||
|
|
||||||
CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
|
CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
|
||||||
CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
|
CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
|
||||||
@ -821,15 +808,19 @@ bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var th
|
|||||||
MainTubeGroupParams->SpinBox_DZ->setValue(newL1);
|
MainTubeGroupParams->SpinBox_DZ->setValue(newL1);
|
||||||
connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
|
connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
|
||||||
MainTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
|
MainTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
|
||||||
MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(85, 170, 127);");
|
MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
|
||||||
|
JunctionPointsSel->PushButton4->setStyleSheet(CssAcceptable);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
|
MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
|
||||||
MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 0, 0);");
|
MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
|
||||||
|
JunctionPointsSel->PushButton4->setStyleSheet(CssRefused);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
|
MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
|
||||||
|
JunctionPointsSel->PushButton4->setStyleSheet(CssNormal);
|
||||||
|
}
|
||||||
|
|
||||||
// std::cerr << "fabs(newL2 - theL2) = " << fabs(newL2 - theL2) << std::endl;
|
// std::cerr << "fabs(newL2 - theL2) = " << fabs(newL2 - theL2) << std::endl;
|
||||||
if (fabs(newL2 - theL2) > Precision::Approximation()) {
|
if (fabs(newL2 - theL2) > Precision::Approximation()) {
|
||||||
@ -840,15 +831,19 @@ bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var th
|
|||||||
IncidentTubeGroupParams->SpinBox_DZ->setValue(newL2);
|
IncidentTubeGroupParams->SpinBox_DZ->setValue(newL2);
|
||||||
connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
|
connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
|
||||||
IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
|
IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
|
||||||
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(85, 170, 127);");
|
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable);
|
||||||
|
JunctionPointsSel->PushButton5->setStyleSheet(CssAcceptable);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
|
IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
|
||||||
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 0, 0);");
|
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused);
|
||||||
|
JunctionPointsSel->PushButton5->setStyleSheet(CssRefused);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
|
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal);
|
||||||
|
JunctionPointsSel->PushButton5->setStyleSheet(CssNormal);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,8 @@ private:
|
|||||||
DlgRef_2Spin* ChamferGroupParams;
|
DlgRef_2Spin* ChamferGroupParams;
|
||||||
DlgRef_1Spin* FilletGroupParams;
|
DlgRef_1Spin* FilletGroupParams;
|
||||||
DlgRef_6Sel* JunctionPointsSel;
|
DlgRef_6Sel* JunctionPointsSel;
|
||||||
|
QPixmap imageImp;
|
||||||
|
QString CssNormal, CssAcceptable, CssRefused;
|
||||||
// QLineEdit* NewPosValL1;
|
// QLineEdit* NewPosValL1;
|
||||||
// QLineEdit* NewPosValL2;
|
// QLineEdit* NewPosValL2;
|
||||||
// QPushButton* ApplyNewL1;
|
// QPushButton* ApplyNewL1;
|
||||||
|
@ -227,6 +227,8 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector<GEOM_IOperations*> t
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gp_Trsf aTrsfInv = aTrsf.Inverted();
|
||||||
|
|
||||||
int expectedGroups = 0;
|
int expectedGroups = 0;
|
||||||
if (shapeType == TSHAPE_BASIC)
|
if (shapeType == TSHAPE_BASIC)
|
||||||
if (Abs(theR2+theW2-theR1-theW1) <= Precision::Approximation())
|
if (Abs(theR2+theW2-theR1-theW1) <= Precision::Approximation())
|
||||||
@ -256,7 +258,7 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector<GEOM_IOperations*> t
|
|||||||
GEOMImpl_I3DPrimOperations* a3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
|
GEOMImpl_I3DPrimOperations* a3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
|
||||||
|
|
||||||
//
|
//
|
||||||
// Uncomment the following lines when GetInPlace bug is solved
|
// Comment the following lines when GetInPlace bug is solved
|
||||||
// == BEGIN
|
// == BEGIN
|
||||||
// Workaround of GetInPlace bug
|
// Workaround of GetInPlace bug
|
||||||
// Create a bounding box that fits the shape
|
// Create a bounding box that fits the shape
|
||||||
@ -264,6 +266,11 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector<GEOM_IOperations*> t
|
|||||||
aBox->GetLastFunction()->SetDescription("");
|
aBox->GetLastFunction()->SetDescription("");
|
||||||
aTransformOperations->TranslateDXDYDZ(aBox, -theL1, -aR1Ext, -aR1Ext);
|
aTransformOperations->TranslateDXDYDZ(aBox, -theL1, -aR1Ext, -aR1Ext);
|
||||||
aBox->GetLastFunction()->SetDescription("");
|
aBox->GetLastFunction()->SetDescription("");
|
||||||
|
// Apply transformation to box
|
||||||
|
BRepBuilderAPI_Transform aTransformationBox(aBox->GetValue(), aTrsf, Standard_False);
|
||||||
|
TopoDS_Shape aBoxShapeTrsf = aTransformationBox.Shape();
|
||||||
|
aBox->GetLastFunction()->SetValue(aBoxShapeTrsf);
|
||||||
|
|
||||||
// Get the shell of the box
|
// Get the shell of the box
|
||||||
Handle(GEOM_Object) aShell = Handle(GEOM_Object)::DownCast(aShapesOperations->MakeExplode(aBox, TopAbs_SHELL, true)->Value(1));
|
Handle(GEOM_Object) aShell = Handle(GEOM_Object)::DownCast(aShapesOperations->MakeExplode(aBox, TopAbs_SHELL, true)->Value(1));
|
||||||
aBox->GetLastFunction()->SetDescription("");
|
aBox->GetLastFunction()->SetDescription("");
|
||||||
@ -291,9 +298,9 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector<GEOM_IOperations*> t
|
|||||||
if (!aCompoundOfFaces.IsNull()) {
|
if (!aCompoundOfFaces.IsNull()) {
|
||||||
aCompoundOfFaces->GetLastFunction()->SetDescription("");
|
aCompoundOfFaces->GetLastFunction()->SetDescription("");
|
||||||
// Apply transformation to compound of faces
|
// Apply transformation to compound of faces
|
||||||
BRepBuilderAPI_Transform aTransformationCompoundOfFaces(aCompoundOfFaces->GetValue(), aTrsf, Standard_False);
|
// BRepBuilderAPI_Transform aTransformationCompoundOfFaces(aCompoundOfFaces->GetValue(), aTrsf, Standard_False);
|
||||||
TopoDS_Shape aTrsf_CompoundOfFacesShape = aTransformationCompoundOfFaces.Shape();
|
// TopoDS_Shape aTrsf_CompoundOfFacesShape = aTransformationCompoundOfFaces.Shape();
|
||||||
aCompoundOfFaces->GetLastFunction()->SetValue(aTrsf_CompoundOfFacesShape);
|
// aCompoundOfFaces->GetLastFunction()->SetValue(aTrsf_CompoundOfFacesShape);
|
||||||
aCompoundOfFacesList.push_back(aCompoundOfFaces);
|
aCompoundOfFacesList.push_back(aCompoundOfFaces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -387,7 +394,13 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector<GEOM_IOperations*> t
|
|||||||
//// Groups of Edges ////
|
//// Groups of Edges ////
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Result of propagate
|
// Result of propagate
|
||||||
|
|
||||||
|
// Apply inverted transformation to shape
|
||||||
|
BRepBuilderAPI_Transform aTransformationShapeInv(theShape->GetValue(), aTrsfInv, Standard_False);
|
||||||
|
TopoDS_Shape aShapeTrsfInv = aTransformationShapeInv.Shape();
|
||||||
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
|
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
|
||||||
|
aFunction->SetValue(aShapeTrsfInv);
|
||||||
|
|
||||||
TCollection_AsciiString theDesc = aFunction->GetDescription();
|
TCollection_AsciiString theDesc = aFunction->GetDescription();
|
||||||
Handle(TColStd_HSequenceOfTransient) aSeqPropagate = aBlocksOperations->Propagate(theShape);
|
Handle(TColStd_HSequenceOfTransient) aSeqPropagate = aBlocksOperations->Propagate(theShape);
|
||||||
if (aSeqPropagate.IsNull() || aSeqPropagate->Length() == 0) {
|
if (aSeqPropagate.IsNull() || aSeqPropagate->Length() == 0) {
|
||||||
@ -398,6 +411,12 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector<GEOM_IOperations*> t
|
|||||||
// Recover previous description to get rid of Propagate dump
|
// Recover previous description to get rid of Propagate dump
|
||||||
aFunction->SetDescription(theDesc);
|
aFunction->SetDescription(theDesc);
|
||||||
|
|
||||||
|
|
||||||
|
// Apply transformation to shape
|
||||||
|
BRepBuilderAPI_Transform aTransformationShape(theShape->GetValue(), aTrsf, Standard_False);
|
||||||
|
TopoDS_Shape aShapeTrsf = aTransformationShape.Shape();
|
||||||
|
aFunction->SetValue(aShapeTrsf);
|
||||||
|
|
||||||
bool addGroup;
|
bool addGroup;
|
||||||
bool circularFoundAndAdded = false;
|
bool circularFoundAndAdded = false;
|
||||||
bool incidentPipeFound = false;
|
bool incidentPipeFound = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user