1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : MeasureGUI_WhatisDlg.cxx
25 // Author : Nicolas REJNERI
29 #include "MeasureGUI_WhatisDlg.h"
30 #include "MeasureGUI_1Sel1TextView_QTD.h"
31 #include "SALOMEGUI_QtCatchCorbaException.hxx"
34 #include <TopTools_MapOfShape.hxx>
35 #include <TCollection_AsciiString.hxx>
36 #include <TopTools_ListOfShape.hxx>
37 #include <TopTools_ListIteratorOfListOfShape.hxx>
39 #include <TopoDS_Iterator.hxx>
41 #include <BRep_Tool.hxx>
43 #include "utilities.h"
44 #include "QAD_Desktop.h"
46 #include <qtextedit.h>
47 #include <qlineedit.h>
49 #include <qpushbutton.h>
50 #include <qradiobutton.h>
51 #include <qbuttongroup.h>
53 //=================================================================================
54 // class : MeasureGUI_WhatisDlg( )
55 // purpose : Constructs a MeasureGUI_WhatisDlg which is a child of 'parent', with the
56 // name 'name' and widget flags set to 'f'.
57 // The dialog will by default be modeless, unless you set 'modal' to
58 // TRUE to construct a modal dialog.
59 //=================================================================================
60 MeasureGUI_WhatisDlg::MeasureGUI_WhatisDlg( QWidget* parent, SALOME_Selection* Sel )
61 : MeasureGUI_Skeleton( parent, "MeasureGUI_WhatisDlg", Sel )
63 QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap(
64 "GEOM",tr( "ICON_DLG_WHATIS" ) ) );
65 QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap(
66 "GEOM",tr( "ICON_SELECT" ) ) );
68 setCaption( tr( "GEOM_WHATIS_TITLE" ) );
70 /***************************************************************/
72 GroupConstructors->setTitle( tr( "GEOM_WHATIS" ) );
73 RadioButton1->setPixmap( image0 );
75 myGrp = new MeasureGUI_1Sel1TextView_QTD( this, "myGrp" );
76 myGrp->GroupBox1->setTitle( tr( "GEOM_WHATIS_OBJECT" ) );
77 myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
78 myGrp->TextEdit1->setReadOnly( TRUE );
79 myGrp->PushButton1->setPixmap( image1 );
80 myGrp->LineEdit1->setReadOnly( true );
82 Layout1->addWidget( myGrp, 1, 0 );
84 /***************************************************************/
91 //=================================================================================
92 // function : ~MeasureGUI_WhatisDlg()
93 // purpose : Destroys the object and frees any allocated resources
94 //=================================================================================
95 MeasureGUI_WhatisDlg::~MeasureGUI_WhatisDlg()
100 //=================================================================================
103 //=================================================================================
104 void MeasureGUI_WhatisDlg::Init( SALOME_Selection* Sel )
106 mySelBtn = myGrp->PushButton1;
107 mySelEdit = myGrp->LineEdit1;
108 MeasureGUI_Skeleton::Init( Sel );
111 //=================================================================================
112 // function : processObject
114 //=================================================================================
115 void MeasureGUI_WhatisDlg::processObject()
118 myGrp->TextEdit1->setText( getParameters( aText ) ? aText : QString("") );
122 //=================================================================================
123 // function : getParameters
125 //=================================================================================
126 bool MeasureGUI_WhatisDlg::getParameters( QString& theText )
128 if ( myObj->_is_nil() )
134 theText = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->WhatIs( myObj );
136 catch( const SALOME::SALOME_Exception& e )
138 QtCatchCorbaException( e );
142 return getOperation()->IsDone();