DCQ : Debug selection

This commit is contained in:
dcq 2004-04-08 08:15:42 +00:00
parent 5ef9687887
commit bbbd230dc9
4 changed files with 106 additions and 292 deletions

View File

@ -72,23 +72,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(QWidget* parent, const char* na
Group1->TextLabel3->setText(tr("GEOM_D2")); Group1->TextLabel3->setText(tr("GEOM_D2"));
Group1->PushButton1->setPixmap(image3); Group1->PushButton1->setPixmap(image3);
Group2 = new DlgRef_1Sel2Spin(this, "Group2");
Group2->GroupBox1->setTitle(tr("GEOM_CHAMFER_EDGES"));
Group2->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
Group2->TextLabel2->setText(tr("GEOM_D1"));
Group2->TextLabel3->setText(tr("GEOM_D2"));
Group2->PushButton1->setPixmap(image3);
Group3 = new DlgRef_1Sel2Spin(this, "Group3");
Group3->GroupBox1->setTitle(tr("GEOM_CHAMFER_FACES"));
Group3->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
Group3->TextLabel2->setText(tr("GEOM_D1"));
Group3->TextLabel3->setText(tr("GEOM_D2"));
Group3->PushButton1->setPixmap(image3);
Layout1->addWidget(Group1, 1, 0); Layout1->addWidget(Group1, 1, 0);
Layout1->addWidget(Group2, 1, 0);
Layout1->addWidget(Group3, 1, 0);
/***************************************************************/ /***************************************************************/
/* Initialisations */ /* Initialisations */
@ -127,18 +111,10 @@ void OperationGUI_ChamferDlg::Init(Handle (AIS_InteractiveContext) ic)
double SpecificStep = 10.0; double SpecificStep = 10.0;
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes */
Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3);
Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3);
Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3);
Group1->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); Group1->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3);
Group2->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3);
Group3->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3);
Group1->SpinBox_DX->SetValue(myD1); Group1->SpinBox_DX->SetValue(myD1);
Group2->SpinBox_DX->SetValue(myD1);
Group3->SpinBox_DX->SetValue(myD1);
Group1->SpinBox_DY->SetValue(myD2); Group1->SpinBox_DY->SetValue(myD2);
Group2->SpinBox_DY->SetValue(myD2);
Group3->SpinBox_DY->SetValue(myD2);
/* signals and slots connections */ /* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
@ -150,32 +126,16 @@ void OperationGUI_ChamferDlg::Init(Handle (AIS_InteractiveContext) ic)
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(Group1->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(Group1->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(Group2->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(Group3->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DY, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DY, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DY, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DY, SLOT(SetStep(double)));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* displays Dialog */ /* displays Dialog */
Group2->hide();
Group3->hide();
Group1->show(); Group1->show();
this->show(); this->show();
@ -210,51 +170,27 @@ void OperationGUI_ChamferDlg::ConstructorsClicked(int constructorId)
} }
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
Group1->LineEdit1->setText("");
Group1->SpinBox_DX->SetValue(myD1);
Group1->SpinBox_DY->SetValue(myD2);
switch (constructorId) switch (constructorId)
{ {
case 0: /* Chamfer All */ case 0: /* Chamfer All */
{ {
Group2->hide(); Group1->GroupBox1->setTitle(tr("GEOM_CHAMFER_ALL"));
Group3->hide();
resize(0, 0);
Group1->show();
myEditCurrentArgument = Group1->LineEdit1;
Group1->LineEdit1->setText("");
myShapeType = -1; myShapeType = -1;
Group1->SpinBox_DX->SetValue(myD1);
Group1->SpinBox_DY->SetValue(myD2);
break; break;
} }
case 1: /* Chamfer edges */ case 1: /* Chamfer edges */
{ {
Group1->hide(); Group1->GroupBox1->setTitle(tr("GEOM_CHAMFER_EDGES"));
Group3->hide();
resize(0, 0);
Group2->show();
myEditCurrentArgument = Group2->LineEdit1;
Group2->LineEdit1->setText("");
myShapeType = 6; myShapeType = 6;
Group2->SpinBox_DX->SetValue(myD1);
Group2->SpinBox_DY->SetValue(myD2);
break; break;
} }
case 2: /* Chamfer Faces */ case 2: /* Chamfer Faces */
{ {
Group1->hide(); Group1->GroupBox1->setTitle(tr("GEOM_CHAMFER_FACES"));
Group2->hide();
resize(0, 0);
Group3->show();
myEditCurrentArgument = Group3->LineEdit1;
Group3->LineEdit1->setText("");
myShapeType = 4; myShapeType = 4;
Group3->SpinBox_DX->SetValue(myD1);
Group3->SpinBox_DY->SetValue(myD2);
break; break;
} }
} }
@ -382,7 +318,7 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
} }
} }
} }
if(myConstructorId == 0) if(myOkShape && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myConstructorId == 0)
this->MakePreview(); this->MakePreview();
} }
@ -398,27 +334,6 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument()
} }
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void OperationGUI_ChamferDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == Group1->LineEdit1)
myEditCurrentArgument = Group1->LineEdit1;
else if (send == Group2->LineEdit1)
myEditCurrentArgument = Group2->LineEdit1;
else if (send == Group3->LineEdit1)
myEditCurrentArgument = Group3->LineEdit1;
else
return;
GEOMBase_Skeleton::LineEditReturnPressed();
return;
}
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -427,18 +342,9 @@ void OperationGUI_ChamferDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == Group1->PushButton1) { if(send == Group1->PushButton1)
Group1->LineEdit1->setFocus(); Group1->LineEdit1->setFocus();
myEditCurrentArgument = Group1->LineEdit1;
}
else if(send == Group2->PushButton1) {
Group2->LineEdit1->setFocus();
myEditCurrentArgument = Group2->LineEdit1;
}
else if(send == Group3->PushButton1) {
Group3->LineEdit1->setFocus();
myEditCurrentArgument = Group3->LineEdit1;
}
this->SelectionIntoArgument(); this->SelectionIntoArgument();
return; return;
} }
@ -499,24 +405,20 @@ void OperationGUI_ChamferDlg::closeEvent(QCloseEvent* e)
// function : ValueChangedInSpinBox() // function : ValueChangedInSpinBox()
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue ) void OperationGUI_ChamferDlg::ValueChangedInSpinBox(double newValue)
{ {
myGeomBase->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender(); QObject* send = (QObject*)sender();
if(send == Group1->SpinBox_DX || send == Group2->SpinBox_DX || send == Group3->SpinBox_DX) { /* D1 */ if(send == Group1->SpinBox_DX) /* D1 */
myD1 = newValue; myD1 = newValue;
if(myConstructorId == 0) else if(send == Group1->SpinBox_DY) /* D2 */
this->MakePreview();
return ;
}
else if(send == Group1->SpinBox_DY || send == Group2->SpinBox_DY || send == Group3->SpinBox_DY) { /* D2 */
myD2 = newValue; myD2 = newValue;
if(myConstructorId == 0)
this->MakePreview(); if(myOkShape && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myConstructorId == 0)
return; this->MakePreview();
}
return; return;
} }
@ -548,45 +450,45 @@ void OperationGUI_ChamferDlg::ResetStateOfDialog()
//================================================================================= //=================================================================================
void OperationGUI_ChamferDlg::MakePreview() void OperationGUI_ChamferDlg::MakePreview()
{ {
QApplication::setOverrideCursor( Qt::waitCursor ); QApplication::setOverrideCursor(Qt::waitCursor);
TopoDS_Shape tds ; TopoDS_Shape tds;
try
{ try {
BRepFilletAPI_MakeChamfer MC(myShape); BRepFilletAPI_MakeChamfer MC(myShape);
switch (myConstructorId) switch(myConstructorId)
{
case 0: /* Chamfer All */
{ {
TopTools_IndexedDataMapOfShapeListOfShape M; case 0: /* Chamfer All */
TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,M); {
for (int i = 1;i<=M.Extent();i++) TopTools_IndexedDataMapOfShapeListOfShape M;
{ TopExp::MapShapesAndAncestors(myShape, TopAbs_EDGE, TopAbs_FACE, M);
for(int i = 1; i <= M.Extent(); i++) {
TopoDS_Edge E = TopoDS::Edge(M.FindKey(i)); TopoDS_Edge E = TopoDS::Edge(M.FindKey(i));
TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First()); TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First());
if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E)) if(!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E))
MC.Add(myD1, myD2,E,F); MC.Add(myD1, myD2, E, F);
} }
tds = MC.Shape(); tds = MC.Shape();
break; break;
}
// case 1: /* Chamfer edges */
// case 2: /* Chamfer Faces */
} }
// case 1: /* Chamfer edges */
// case 2: /* Chamfer Faces */
}
if (!tds.IsNull())
{
mySimulationTopoDs = tds;
myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
}
} if(!tds.IsNull()) {
catch(Standard_Failure) mySimulationTopoDs = tds;
{ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
QAD_MessageBox::warn1 (QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_CHAMFER_ABORT").arg(myD1).arg(myD2), tr("GEOM_BUT_OK"));
Group1->SpinBox_DX->SetValue(5.0);
Group1->SpinBox_DY->SetValue(5.0);
myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
QApplication::restoreOverrideCursor();
} }
}
catch(Standard_Failure) {
QApplication::restoreOverrideCursor();
QAD_MessageBox::warn1 (QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_CHAMFER_ABORT").arg(myD1).arg(myD2), tr("GEOM_BUT_OK"));
QApplication::setOverrideCursor(Qt::waitCursor);
myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
Group1->SpinBox_DX->SetValue(5.0);
Group1->SpinBox_DY->SetValue(5.0);
}
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
return;
} }

View File

@ -72,8 +72,6 @@ private :
double myD2; double myD2;
DlgRef_1Sel2Spin* Group1; DlgRef_1Sel2Spin* Group1;
DlgRef_1Sel2Spin* Group2;
DlgRef_1Sel2Spin* Group3;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -81,7 +79,6 @@ private slots:
void ClickOnCancel(); void ClickOnCancel();
void ActivateThisDialog(); void ActivateThisDialog();
void DeactivateActiveDialog(); void DeactivateActiveDialog();
void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox(double newValue); void ValueChangedInSpinBox(double newValue);

View File

@ -69,21 +69,7 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg(QWidget* parent, const char* name
Group1->TextLabel2->setText(tr("GEOM_RADIUS")); Group1->TextLabel2->setText(tr("GEOM_RADIUS"));
Group1->PushButton1->setPixmap(image3); Group1->PushButton1->setPixmap(image3);
Group2 = new DlgRef_1Sel1Spin(this, "Group2");
Group2->GroupBox1->setTitle(tr("GEOM_FILLET_EDGES"));
Group2->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
Group2->TextLabel2->setText(tr("GEOM_RADIUS"));
Group2->PushButton1->setPixmap(image3);
Group3 = new DlgRef_1Sel1Spin(this, "Group3");
Group3->GroupBox1->setTitle(tr("GEOM_FILLET_FACES"));
Group3->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
Group3->TextLabel2->setText(tr("GEOM_RADIUS"));
Group3->PushButton1->setPixmap(image3);
Layout1->addWidget(Group1, 1, 0); Layout1->addWidget(Group1, 1, 0);
Layout1->addWidget(Group2, 1, 0);
Layout1->addWidget(Group3, 1, 0);
/***************************************************************/ /***************************************************************/
/* Initialisations */ /* Initialisations */
@ -121,12 +107,7 @@ void OperationGUI_FilletDlg::Init(Handle(AIS_InteractiveContext) ic)
double SpecificStep = 10.0; double SpecificStep = 10.0;
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes */
Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3);
Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3);
Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3);
Group1->SpinBox_DX->SetValue(myRadius); Group1->SpinBox_DX->SetValue(myRadius);
Group2->SpinBox_DX->SetValue(myRadius);
Group3->SpinBox_DX->SetValue(myRadius);
/* signals and slots connections */ /* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
@ -138,26 +119,14 @@ void OperationGUI_FilletDlg::Init(Handle(AIS_InteractiveContext) ic)
connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DX, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DX, SLOT(SetStep(double)));
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
/* displays Dialog */ /* displays Dialog */
Group2->hide();
Group3->hide();
Group1->show(); Group1->show();
this->show(); this->show();
@ -191,48 +160,26 @@ void OperationGUI_FilletDlg::ConstructorsClicked(int constructorId)
} }
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
Group1->LineEdit1->setText("");
Group1->SpinBox_DX->SetValue(myRadius);
switch (constructorId) switch (constructorId)
{ {
case 0: /* Fillet All */ case 0: /* Fillet All */
{ {
Group2->hide(); Group1->GroupBox1->setTitle(tr("GEOM_FILLET_ALL"));
Group3->hide();
resize(0, 0);
Group1->show();
myEditCurrentArgument = Group1->LineEdit1;
Group1->LineEdit1->setText("");
myShapeType = -1; myShapeType = -1;
Group1->SpinBox_DX->SetValue(myRadius);
break; break;
} }
case 1: /* Fillet edges */ case 1: /* Fillet edges */
{ {
Group1->hide(); Group1->GroupBox1->setTitle(tr("GEOM_FILLET_EDGES"));
Group3->hide();
resize(0, 0);
Group2->show();
myEditCurrentArgument = Group2->LineEdit1;
Group2->LineEdit1->setText("");
myShapeType = 6; myShapeType = 6;
Group2->SpinBox_DX->SetValue(myRadius);
break; break;
} }
case 2: /* Fillet Faces */ case 2: /* Fillet Faces */
{ {
Group1->hide(); Group1->GroupBox1->setTitle(tr("GEOM_FILLET_FACES"));
Group2->hide();
resize(0, 0);
Group3->show();
myEditCurrentArgument = Group3->LineEdit1;
Group3->LineEdit1->setText("");
myShapeType = 4; myShapeType = 4;
Group3->SpinBox_DX->SetValue(myRadius);
break; break;
} }
} }
@ -358,7 +305,7 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
} }
} }
} }
if(myConstructorId == 0) if(myOkShape && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myConstructorId == 0)
this->MakePreview(); this->MakePreview();
} }
else else
@ -373,27 +320,6 @@ void OperationGUI_FilletDlg::SelectionIntoArgument()
} }
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void OperationGUI_FilletDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == Group1->LineEdit1)
myEditCurrentArgument = Group1->LineEdit1;
else if (send == Group2->LineEdit1)
myEditCurrentArgument = Group2->LineEdit1;
else if (send == Group3->LineEdit1)
myEditCurrentArgument = Group3->LineEdit1;
else
return;
GEOMBase_Skeleton::LineEditReturnPressed();
return;
}
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -402,18 +328,9 @@ void OperationGUI_FilletDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == Group1->PushButton1) { if(send == Group1->PushButton1)
Group1->LineEdit1->setFocus(); Group1->LineEdit1->setFocus();
myEditCurrentArgument = Group1->LineEdit1;
}
else if(send == Group2->PushButton1) {
Group2->LineEdit1->setFocus();
myEditCurrentArgument = Group2->LineEdit1;
}
else if(send == Group3->PushButton1) {
Group3->LineEdit1->setFocus();
myEditCurrentArgument = Group3->LineEdit1;
}
this->SelectionIntoArgument(); this->SelectionIntoArgument();
return; return;
} }
@ -502,7 +419,7 @@ void OperationGUI_FilletDlg::ValueChangedInSpinBox(double newValue)
myRadius = newValue; myRadius = newValue;
if(myConstructorId == 0) if(myOkShape && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myConstructorId == 0)
this->MakePreview(); this->MakePreview();
return; return;
} }
@ -514,56 +431,57 @@ void OperationGUI_FilletDlg::ValueChangedInSpinBox(double newValue)
//================================================================================= //=================================================================================
void OperationGUI_FilletDlg::MakePreview() void OperationGUI_FilletDlg::MakePreview()
{ {
QApplication::setOverrideCursor( Qt::waitCursor ); QApplication::setOverrideCursor(Qt::waitCursor);
TopoDS_Shape tds ; TopoDS_Shape tds;
try
{ try {
BRepFilletAPI_MakeFillet fill(myShape); BRepFilletAPI_MakeFillet fill(myShape);
switch (myConstructorId) switch(myConstructorId)
{
case 0: /* Fillet All */
{ {
case 0: /* Fillet All */ TopExp_Explorer Exp(myShape, TopAbs_EDGE);
{ for(Exp; Exp.More(); Exp.Next()) {
TopExp_Explorer Exp ( myShape, TopAbs_EDGE ); TopoDS_Edge E = TopoDS::Edge(Exp.Current());
for (Exp; Exp.More(); Exp.Next()) fill.Add(E);
{
TopoDS_Edge E =TopoDS::Edge(Exp.Current());
fill.Add(E);
}
for (int i = 1;i<=fill.NbContours();i++) {
try
{
fill.SetRadius(myRadius,i,i);
}
catch(Standard_Failure)
{
QAD_MessageBox::warn1 (QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_FILLET_ABORT").arg(myRadius), tr("GEOM_BUT_OK"));
Group1->SpinBox_DX->SetValue(5.0);
myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
QApplication::restoreOverrideCursor();
return;
}
}
tds = fill.Shape();
break;
} }
// case 1: /* Fillet edges */
// case 2: /* Fillet Faces */ for(int i = 1; i <= fill.NbContours(); i++) {
try {
fill.SetRadius(myRadius,i,i);
}
catch(Standard_Failure) {
QApplication::restoreOverrideCursor();
QAD_MessageBox::warn1 (QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_FILLET_ABORT").arg(myRadius), tr("GEOM_BUT_OK"));
QApplication::setOverrideCursor(Qt::waitCursor);
myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
Group1->SpinBox_DX->SetValue(5.0);
QApplication::restoreOverrideCursor();
return;
}
}
tds = fill.Shape();
break;
} }
if (!tds.IsNull()) // case 1: /* Fillet edges */
{ // case 2: /* Fillet Faces */
mySimulationTopoDs = tds; }
myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
} if(!tds.IsNull()) {
} mySimulationTopoDs = tds;
catch(Standard_Failure) myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
{
QAD_MessageBox::warn1 (QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_FILLET_ABORT").arg(myRadius), tr("GEOM_BUT_OK"));
Group1->SpinBox_DX->SetValue(5.0);
myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
QApplication::restoreOverrideCursor();
} }
}
catch(Standard_Failure) {
QApplication::restoreOverrideCursor();
QAD_MessageBox::warn1 (QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_FILLET_ABORT").arg(myRadius), tr("GEOM_BUT_OK"));
QApplication::setOverrideCursor(Qt::waitCursor);
myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
Group1->SpinBox_DX->SetValue(5.0);
}
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
return;
} }

View File

@ -71,8 +71,6 @@ private :
double myRadius; double myRadius;
DlgRef_1Sel1Spin* Group1; DlgRef_1Sel1Spin* Group1;
DlgRef_1Sel1Spin* Group2;
DlgRef_1Sel1Spin* Group3;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -80,7 +78,6 @@ private slots:
void ClickOnCancel(); void ClickOnCancel();
void ActivateThisDialog(); void ActivateThisDialog();
void DeactivateActiveDialog(); void DeactivateActiveDialog();
void LineEditReturnPressed();
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ValueChangedInSpinBox(double newValue); void ValueChangedInSpinBox(double newValue);