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.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : MeasureGUI_WhatisDlg.cxx
25 // Author : Nicolas REJNERI
29 #include "MeasureGUI_WhatisDlg.h"
30 #include "MeasureGUI_1Sel1TextView_QTD.h"
33 #include <TopTools_MapOfShape.hxx>
34 #include <TCollection_AsciiString.hxx>
35 #include <TopTools_ListOfShape.hxx>
36 #include <TopTools_ListIteratorOfListOfShape.hxx>
38 #include <TopoDS_Iterator.hxx>
40 #include <BRep_Tool.hxx>
42 #include "utilities.h"
43 #include "SUIT_Session.h"
44 #include "SalomeApp_Tools.h"
46 #include <qtextedit.h>
47 #include <qlineedit.h>
50 #include <qpushbutton.h>
51 #include <qradiobutton.h>
52 #include <qbuttongroup.h>
54 //=================================================================================
55 // class : MeasureGUI_WhatisDlg( )
56 // purpose : Constructs a MeasureGUI_WhatisDlg which is a child of 'parent', with the
57 // name 'name' and widget flags set to 'f'.
58 // The dialog will by default be modeless, unless you set 'modal' to
59 // TRUE to construct a modal dialog.
60 //=================================================================================
61 MeasureGUI_WhatisDlg::MeasureGUI_WhatisDlg( GeometryGUI* GUI, QWidget* parent )
62 : MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_WhatisDlg" )
64 QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap(
65 "GEOM",tr( "ICON_DLG_WHATIS" ) ) );
66 QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap(
67 "GEOM",tr( "ICON_SELECT" ) ) );
69 setCaption( tr( "GEOM_WHATIS_TITLE" ) );
71 /***************************************************************/
73 GroupConstructors->setTitle( tr( "GEOM_WHATIS" ) );
74 RadioButton1->setPixmap( image0 );
76 myGrp = new MeasureGUI_1Sel1TextView_QTD( this, "myGrp" );
77 myGrp->GroupBox1->setTitle( tr( "GEOM_WHATIS_OBJECT" ) );
78 myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
79 myGrp->TextEdit1->setReadOnly( TRUE );
80 myGrp->PushButton1->setPixmap( image1 );
81 myGrp->LineEdit1->setReadOnly( true );
83 Layout1->addWidget( myGrp, 1, 0 );
85 /***************************************************************/
87 myHelpFileName = "files/salome2_sp3_measuregui_functions.htm#Whatis";
94 //=================================================================================
95 // function : ~MeasureGUI_WhatisDlg()
96 // purpose : Destroys the object and frees any allocated resources
97 //=================================================================================
98 MeasureGUI_WhatisDlg::~MeasureGUI_WhatisDlg()
103 //=================================================================================
106 //=================================================================================
107 void MeasureGUI_WhatisDlg::Init()
109 mySelBtn = myGrp->PushButton1;
110 mySelEdit = myGrp->LineEdit1;
111 MeasureGUI_Skeleton::Init();
114 //=================================================================================
115 // function : processObject
117 //=================================================================================
118 void MeasureGUI_WhatisDlg::processObject()
121 myGrp->TextEdit1->setText( getParameters( aText ) ? aText : QString("") );
125 //=================================================================================
126 // function : getParameters
128 //=================================================================================
129 bool MeasureGUI_WhatisDlg::getParameters( QString& theText )
131 if ( myObj->_is_nil() )
137 theText = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->WhatIs( myObj );
139 catch( const SALOME::SALOME_Exception& e )
141 SalomeApp_Tools::QtCatchCorbaException( e );
145 return getOperation()->IsDone();