Made use of a .ui file for convenience in the feature detection dialog. Hided unuseful widgets in the same dialog.

This commit is contained in:
rnc 2012-03-15 10:57:06 +00:00
parent 2afe0fcdcc
commit d5d4be3bc6
2 changed files with 41 additions and 61 deletions

View File

@ -106,8 +106,8 @@ EntityGUI_FeatureDetectorDlg::EntityGUI_FeatureDetectorDlg( GeometryGUI* theGeom
bool modal, Qt::WindowFlags fl) bool modal, Qt::WindowFlags fl)
: GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl) : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl)
{ {
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("OCCViewer", tr("ICON_OCCVIEWER_VIEW_DUMP"))); QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("OCCViewer", tr("ICON_OCCVIEWER_VIEW_DUMP")));
setWindowTitle(tr("GEOM_DETECT_TITLE")); setWindowTitle(tr("GEOM_DETECT_TITLE"));
@ -132,38 +132,20 @@ EntityGUI_FeatureDetectorDlg::EntityGUI_FeatureDetectorDlg( GeometryGUI* theGeom
// myViewGroup->hide(); // myViewGroup->hide();
// Widgets for the selection of the picture and the Region Of Interest // Widgets for the selection of the picture and the Region Of Interest
mySelectionGroup = new QGroupBox(tr("GEOM_ARGUMENTS"), centralWidget());
QGridLayout* mySelectGrpLayout = new QGridLayout(mySelectionGroup);
myPushButton = new QPushButton(mySelectionGroup);
myPushButton->setIcon(image0);
myPushButton->setCheckable(true);
myPushButton->setAutoExclusive(true);
mySelButton = new QPushButton(mySelectionGroup); mySelectionGroup = new DlgRef_1Sel1Frame(centralWidget());
mySelButton->setIcon(image1);
mySelButton->setCheckable(true);
mySelButton->setAutoExclusive(true);
myLineEdit = new QLineEdit(mySelectionGroup); mySelectionGroup->PushButton1->setIcon(image0);
mySelectionGroup->PushButton1->setCheckable(true);
mySelectionGroup->PushButton1->setAutoExclusive(true);
mySnapshotLabel = new QLabel(mySelectionGroup); mySelectionGroup->PushButton2->setIcon(image1);
QFrame* myImgSampleFrame = new QFrame(mySelectionGroup); mySelectionGroup->PushButton2->setCheckable(true);
myImgSampleFrame->setFrameRect(QRect(0,0,40,10)); mySelectionGroup->PushButton2->setAutoExclusive(true);
myImgSampleFrame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
QLabel* myPictureLabel = new QLabel(tr( "GEOM_PICTURE" ),mySelectionGroup);
mySelectGrpLayout->addWidget(myPictureLabel, 0, 0);
mySelectGrpLayout->addWidget(mySelButton, 0, 1);
mySelectGrpLayout->addWidget(myLineEdit, 0, 2);// 1, 2);
mySelectGrpLayout->addWidget(mySnapshotLabel, 1, 0); mySelectionGroup->TextLabel1->setText(tr( "GEOM_PICTURE" ));
mySelectGrpLayout->addWidget(myPushButton, 1, 1); mySelectionGroup->FrameLabel->setText("");
mySelectGrpLayout->addWidget(myImgSampleFrame, 1, 2, 2, 1);
mySelectGrpLayout->setRowStretch(3, 1);
QGridLayout* myFrameLayout = new QGridLayout(myImgSampleFrame);
myImgSampleLabel = new QLabel(myImgSampleFrame);
myFrameLayout->addWidget(myImgSampleLabel, 0, 0);
myOutputGroup = new DlgRef_3Radio(centralWidget()); myOutputGroup = new DlgRef_3Radio(centralWidget());
myOutputGroup->GroupBox1->setTitle(tr("GEOM_DETECT_OUTPUT")); myOutputGroup->GroupBox1->setTitle(tr("GEOM_DETECT_OUTPUT"));
@ -207,13 +189,13 @@ void EntityGUI_FeatureDetectorDlg::Init()
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() ) );
connect( this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); connect( this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( myPushButton, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); connect( mySelectionGroup->PushButton2, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
connect( mySelButton, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); connect( mySelectionGroup->PushButton1, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
// connect( myViewButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( onViewClicked( int ) ) ); // connect( myViewButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( onViewClicked( int ) ) );
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),this, SLOT( SelectionIntoArgument() ) ); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),this, SLOT( SelectionIntoArgument() ) );
myConstructorId = 0; myConstructorId = 0;
mySelButton->click(); mySelectionGroup->PushButton1->click();
// SetEditCurrentArgument(); // SetEditCurrentArgument();
SelectionIntoArgument(); SelectionIntoArgument();
@ -268,7 +250,7 @@ void EntityGUI_FeatureDetectorDlg::SelectionIntoArgument()
} }
if (aSelList.Extent() != 1) { if (aSelList.Extent() != 1) {
if (myEditCurrentArgument == myLineEdit) if (myEditCurrentArgument == mySelectionGroup->LineEdit1)
myFace.nullify(); myFace.nullify();
return; return;
} }
@ -280,7 +262,7 @@ void EntityGUI_FeatureDetectorDlg::SelectionIntoArgument()
QString aName = GEOMBase::GetName( aSelectedObject.get() ); QString aName = GEOMBase::GetName( aSelectedObject.get() );
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
if ( myEditCurrentArgument == myLineEdit ) { if ( myEditCurrentArgument == mySelectionGroup->LineEdit1 ) {
myFace = aSelectedObject; myFace = aSelectedObject;
AISit = soccViewer->entry2aisobjects.find(myFaceEntry.toStdString()); AISit = soccViewer->entry2aisobjects.find(myFaceEntry.toStdString());
if (AISit == soccViewer->entry2aisobjects.end()) if (AISit == soccViewer->entry2aisobjects.end())
@ -316,7 +298,7 @@ void EntityGUI_FeatureDetectorDlg::SelectionIntoArgument()
//================================================================================= //=================================================================================
bool EntityGUI_FeatureDetectorDlg::acceptMouseEvent() const bool EntityGUI_FeatureDetectorDlg::acceptMouseEvent() const
{ {
return myPushButton->isChecked(); return mySelectionGroup->PushButton2->isChecked();
} }
//======================================================================= //=======================================================================
@ -358,7 +340,10 @@ void EntityGUI_FeatureDetectorDlg::ConstructorsClicked(int id)
// myViewGroup->show(); // myViewGroup->show();
// mySelectionGroup->show(); // mySelectionGroup->show();
myOutputGroup->hide(); myOutputGroup->hide();
mySnapshotLabel->setText(tr("GEOM_DETECT_ZONE")); // mySelectionGroup->TextLabel2->setText(tr("GEOM_DETECT_ZONE"));
mySelectionGroup->TextLabel2->hide();
mySelectionGroup->Frame->hide();
mySelectionGroup->PushButton2->hide();
initName(tr("GEOM_CORNERS")); initName(tr("GEOM_CORNERS"));
break; break;
case CONTOURS: case CONTOURS:
@ -366,7 +351,10 @@ void EntityGUI_FeatureDetectorDlg::ConstructorsClicked(int id)
// mySelectionGroup->hide(); // mySelectionGroup->hide();
// mySelectionGroup->show(); // mySelectionGroup->show();
myOutputGroup->show(); myOutputGroup->show();
mySnapshotLabel->setText(tr("GEOM_COLOR_FILTER")); mySelectionGroup->TextLabel2->show();
mySelectionGroup->Frame->show();
mySelectionGroup->PushButton2->show();
mySelectionGroup->TextLabel2->setText(tr("GEOM_COLOR_FILTER"));
initName(tr("GEOM_CONTOURS")); initName(tr("GEOM_CONTOURS"));
break; break;
case LINES: case LINES:
@ -374,7 +362,7 @@ void EntityGUI_FeatureDetectorDlg::ConstructorsClicked(int id)
// mySelectionGroup->hide(); // mySelectionGroup->hide();
// mySelectionGroup->show(); // mySelectionGroup->show();
myOutputGroup->hide(); myOutputGroup->hide();
mySnapshotLabel->setText(tr("")); mySelectionGroup->TextLabel2->setText(tr(""));
initName(tr("GEOM_LINES")); initName(tr("GEOM_LINES"));
break; break;
} }
@ -419,16 +407,16 @@ void EntityGUI_FeatureDetectorDlg::ConstructorsClicked(int id)
void EntityGUI_FeatureDetectorDlg::onButtonClicked() void EntityGUI_FeatureDetectorDlg::onButtonClicked()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if (send == myPushButton) if (send == mySelectionGroup->PushButton2)
{ {
myLineEdit->setEnabled(false); mySelectionGroup->LineEdit1->setEnabled(false);
} }
else if (send == mySelButton) else if (send == mySelectionGroup->PushButton1)
{ {
myStartPnt = gp_Pnt(0,0,0); myStartPnt = gp_Pnt(0,0,0);
myEndPnt = myStartPnt; myEndPnt = myStartPnt;
myEditCurrentArgument = myLineEdit; myEditCurrentArgument = mySelectionGroup->LineEdit1;
myLineEdit->setEnabled(true); mySelectionGroup->LineEdit1->setEnabled(true);
} }
} }
@ -480,8 +468,8 @@ void EntityGUI_FeatureDetectorDlg::showImageSample()
// Display the result // Display the result
QPixmap pixmap(QString(samplePicturePath.c_str())); QPixmap pixmap(QString(samplePicturePath.c_str()));
myImgSampleLabel->setPixmap(pixmap); mySelectionGroup->FrameLabel->setPixmap(pixmap);
myImgSampleLabel->setMask(pixmap.mask()); mySelectionGroup->FrameLabel->setMask(pixmap.mask());
} }
//================================================================================= //=================================================================================

View File

@ -32,6 +32,7 @@ class QLabel;
class QPoint; class QPoint;
class DlgRef_3Radio; class DlgRef_3Radio;
class DlgRef_1Sel; class DlgRef_1Sel;
class DlgRef_1Sel1Frame;
class gp_Pnt; class gp_Pnt;
class ShapeRec_FeatureDetector; class ShapeRec_FeatureDetector;
@ -84,28 +85,19 @@ private:
int myConstructorId; int myConstructorId;
QGroupBox* mySelectionGroup; DlgRef_1Sel1Frame* mySelectionGroup;
QLabel* mySnapshotLabel;
QLabel* myImgSampleLabel;
DlgRef_1Sel* mySelWidget; DlgRef_1Sel* mySelWidget;
// Output typeselection widget
DlgRef_3Radio* myOutputGroup;;
gp_Pnt myStartPnt; gp_Pnt myStartPnt;
gp_Pnt myEndPnt; gp_Pnt myEndPnt;
QRect myRect; QRect myRect;
QPushButton* mySelButton;
QLineEdit* myLineEdit;
QPushButton* myPushButton;
// Picture dimensions and position // Picture dimensions and position
int height; int height;
int width; int width;
double pictureLeft; double pictureLeft;
double pictureTop; double pictureTop;
// Output slection widget
DlgRef_3Radio* myOutputGroup;;
}; };