0020044: EDF 866 GEOM: Extrusion along a path : impossible to select a Wire

This commit is contained in:
dmv 2008-11-18 11:51:02 +00:00
parent 912c5964b2
commit 0cee4b0fdd
3 changed files with 109 additions and 56 deletions

View File

@ -1044,6 +1044,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_PIPE_TITLE</source> <source>GEOM_PIPE_TITLE</source>
<translation>Pipe Construction</translation> <translation>Pipe Construction</translation>
</message> </message>
<message>
<source>GEOM_SELECT_UNPUBLISHED_EDGES</source>
<translation>Select unpublished edges</translation>
</message>
<message> <message>
<source>GEOM_PLANE</source> <source>GEOM_PLANE</source>
<translation>Plane</translation> <translation>Plane</translation>

View File

@ -39,6 +39,8 @@
#include <TopExp.hxx> #include <TopExp.hxx>
#include <TColStd_IndexedMapOfInteger.hxx> #include <TColStd_IndexedMapOfInteger.hxx>
#include <TopTools_IndexedMapOfShape.hxx> #include <TopTools_IndexedMapOfShape.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <GEOMImpl_Types.hxx> #include <GEOMImpl_Types.hxx>
@ -66,7 +68,7 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_3Sel(centralWidget()); GroupPoints = new DlgRef_3Sel1Check(centralWidget());
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT")); GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT"));
@ -75,6 +77,7 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
GroupPoints->PushButton1->setIcon(image1); GroupPoints->PushButton1->setIcon(image1);
GroupPoints->PushButton2->setIcon(image1); GroupPoints->PushButton2->setIcon(image1);
GroupPoints->PushButton3->setIcon(image1); GroupPoints->PushButton3->setIcon(image1);
GroupPoints->CheckButton1->setText(tr("GEOM_SELECT_UNPUBLISHED_EDGES"));
QVBoxLayout* layout = new QVBoxLayout(centralWidget()); QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6); layout->setMargin(0); layout->setSpacing(6);
@ -113,6 +116,8 @@ void GenerationGUI_PipeDlg::Init()
myBase = myPath = myVec = GEOM::GEOM_Object::_nil(); myBase = myPath = myVec = GEOM::GEOM_Object::_nil();
myOkBase = myOkPath = myOkVec = false; myOkBase = myOkPath = myOkVec = false;
GroupPoints->CheckButton1->setEnabled(false);
// signals and slots connections // 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()));
@ -127,6 +132,8 @@ void GenerationGUI_PipeDlg::Init()
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
initName(tr("GEOM_PIPE")); initName(tr("GEOM_PIPE"));
GroupPoints->TextLabel3->hide(); GroupPoints->TextLabel3->hide();
@ -167,6 +174,23 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId )
displayPreview(); displayPreview();
} }
//=================================================================================
// function : SelectionBittonClicked()
// purpose : Selection type Radio button management
//=================================================================================
void GenerationGUI_PipeDlg::SelectionTypeButtonClicked()
{
if ( GroupPoints->CheckButton1->isChecked() ) {
globalSelection();
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} else {
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_WIRE);
aMap.Add(GEOM_LINE);
globalSelection(aMap);
}
}
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
@ -249,57 +273,66 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
bool myOk = false; bool myOk = false;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
if (aSelectedObject != myBase) { if (myEditCurrentArgument == GroupPoints->LineEdit2 && !GroupPoints->CheckButton1->isChecked() ){
TColStd_IndexedMapOfInteger aMap; myPath = aSelectedObject;
aSelMgr->GetIndexes(aSelList.First(), aMap); myOkPath = true;
if (aMap.Extent() == 1) { myEditCurrentArgument->setText(aName);
int anIndex = aMap(1); }
aName.append(":edge_" + QString::number(anIndex)); else
{
if (aSelectedObject != myBase) {
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(aSelList.First(), aMap);
if (aMap.Extent() == 1) {
int anIndex = aMap(1);
aName.append(":edge_" + QString::number(anIndex));
//Find SubShape Object in Father
GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations(getStudyId());
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
myOk = true;
}
else { // get Object from study
aSelectedObject = aFindedObject;
myOk = true;
}
}
else {
myOk = true;
if (S.ShapeType() != TopAbs_EDGE) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
myOk = false;
}
}
if (myEditCurrentArgument == GroupPoints->LineEdit2) {
myPath = aSelectedObject;
myOkPath = myOk;
}
else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
myVec = aSelectedObject;
myOkVec = myOk;
}
}
myEditCurrentArgument->setText(aName);
//Find SubShape Object in Father if (myOkPath) {
GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); if (!myOkBase)
GroupPoints->PushButton1->click();
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study else if (!myOkVec)
GEOM::GEOM_IShapesOperations_var aShapesOp = GroupPoints->PushButton3->click();
getGeomEngine()->GetIShapesOperations(getStudyId()); }
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); else if (myOkVec) {
myOk = true; if (!myOkBase)
} GroupPoints->PushButton1->click();
else { // get Object from study else if (!myOkPath)
aSelectedObject = aFindedObject; GroupPoints->PushButton2->click();
myOk = true; }
}
} }
else {
myOk = true;
if (S.ShapeType() != TopAbs_EDGE) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
myOk = false;
}
}
if (myEditCurrentArgument == GroupPoints->LineEdit2) {
myPath = aSelectedObject;
myOkPath = myOk;
}
else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
myVec = aSelectedObject;
myOkVec = myOk;
}
}
myEditCurrentArgument->setText(aName);
if (myOkPath) {
if (!myOkBase)
GroupPoints->PushButton1->click();
else if (!myOkVec)
GroupPoints->PushButton3->click();
}
else if (myOkVec) {
if (!myOkBase)
GroupPoints->PushButton1->click();
else if (!myOkPath)
GroupPoints->PushButton2->click();
}
} }
// clear selection // clear selection
@ -329,15 +362,24 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument()
GroupPoints->LineEdit3->setEnabled(false); GroupPoints->LineEdit3->setEnabled(false);
if (send == GroupPoints->PushButton1) { if (send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->CheckButton1->setEnabled(false);
} }
else if (send == GroupPoints->PushButton2) { else if (send == GroupPoints->PushButton2) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); if ( GroupPoints->CheckButton1->isChecked() ) {
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} else {
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_WIRE);
aMap.Add(GEOM_LINE);
globalSelection(aMap);
}
GroupPoints->CheckButton1->setEnabled(true);
} }
else if(send == GroupPoints->PushButton3) { else if(send == GroupPoints->PushButton3) {
myEditCurrentArgument = GroupPoints->LineEdit3; myEditCurrentArgument = GroupPoints->LineEdit3;
GroupPoints->CheckButton1->setEnabled(false);
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
} }
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
@ -366,6 +408,11 @@ void GenerationGUI_PipeDlg::LineEditReturnPressed()
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
if (send == GroupPoints->LineEdit2)
GroupPoints->CheckButton1->setEnabled(true);
else
GroupPoints->CheckButton1->setEnabled(false);
} }
//================================================================================= //=================================================================================
@ -376,8 +423,9 @@ void GenerationGUI_PipeDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
// reinit, because some selected objects could be removed connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
Init(); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
ConstructorsClicked(getConstructorId());
} }
//================================================================================= //=================================================================================

View File

@ -28,7 +28,7 @@
#include <GEOMBase_Skeleton.h> #include <GEOMBase_Skeleton.h>
class DlgRef_3Sel; class DlgRef_3Sel1Check;
//================================================================================= //=================================================================================
// class : GenerationGUI_PipeDlg // class : GenerationGUI_PipeDlg
@ -61,7 +61,7 @@ private:
bool myOkPath; bool myOkPath;
bool myOkVec; /* to check when arguments are defined */ bool myOkVec; /* to check when arguments are defined */
DlgRef_3Sel* GroupPoints; DlgRef_3Sel1Check* GroupPoints;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
@ -71,6 +71,7 @@ private slots:
void SelectionIntoArgument(); void SelectionIntoArgument();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void ConstructorsClicked( int ); void ConstructorsClicked( int );
void SelectionTypeButtonClicked();
}; };
#endif // GENERATIONGUI_PIPEDLG_H #endif // GENERATIONGUI_PIPEDLG_H