Back to index

salome-geom  6.5.0
Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
MeasureGUI_BndBoxDlg Class Reference

#include <MeasureGUI_BndBoxDlg.h>

Inheritance diagram for MeasureGUI_BndBoxDlg:
Inheritance graph
[legend]
Collaboration diagram for MeasureGUI_BndBoxDlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MeasureGUI_BndBoxDlg (GeometryGUI *, QWidget *)
 ~MeasureGUI_BndBoxDlg ()

Protected Slots

virtual void ClickOnCancel ()
virtual void ClickOnHelp ()
virtual void DeactivateActiveDialog ()
virtual void ActivateThisDialog ()
virtual void SelectionIntoArgument ()
virtual void LineEditReturnPressed ()
virtual void SetEditCurrentArgument ()

Protected Member Functions

virtual void processObject ()
virtual SALOME_Prs * buildPrs ()
void enterEvent (QEvent *)
void closeEvent (QCloseEvent *)
void keyPressEvent (QKeyEvent *)
void redisplayPreview ()
GEOM_Displayer * getDisplayer ()
virtual bool isValid (QString &)
virtual void activateSelection ()
virtual GEOM::GEOM_IOperations_ptr createOperation ()
MeasureGUI_SkeletonBoxmainFrame () const
QWidget * centralWidget () const
QPushButton * buttonClose () const
QPushButton * buttonHelp () const

Protected Attributes

QPushButton * mySelBtn
QLineEdit * mySelEdit
GEOM::GEOM_Object_var myObj
GeometryGUI * myGeomGUI
GEOM_Displayer * myDisplayer
QString myHelpFileName
MeasureGUI_SkeletonBoxmyMainFrame

Private Member Functions

void Init ()
bool getParameters (double &, double &, double &, double &, double &, double &)

Private Attributes

MeasureGUI_1Sel6LineEditmyGrp

Detailed Description

Definition at line 38 of file MeasureGUI_BndBoxDlg.h.


Constructor & Destructor Documentation

MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg ( GeometryGUI *  GUI,
QWidget *  parent 
)

Definition at line 64 of file MeasureGUI_BndBoxDlg.cxx.

  : MeasureGUI_Skeleton( GUI, parent )
{
  QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap(
    "GEOM", tr( "ICON_DLG_BOUNDING_BOX" ) ) );
  QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap(
    "GEOM", tr( "ICON_SELECT" ) ) );

  setWindowTitle( tr( "GEOM_BNDBOX_TITLE" ) );

  /***************************************************************/
  
  mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BNDBOX" ) );
  mainFrame()->RadioButton1->setIcon( image0 );

  myGrp = new MeasureGUI_1Sel6LineEdit( centralWidget() );
  myGrp->GroupBox1->setTitle( tr( "GEOM_BNDBOX_OBJDIM" ) );
  myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
  myGrp->TextLabel2->setText( tr( "GEOM_MIN" ) );
  myGrp->TextLabel3->setText( tr( "GEOM_MAX" ) );
  myGrp->TextLabel4->setText( tr( "GEOM_X" ) );
  myGrp->TextLabel5->setText( tr( "GEOM_Y" ) );
  myGrp->TextLabel6->setText( tr( "GEOM_Z" ) );
  myGrp->LineEdit11->setReadOnly( true );
  myGrp->LineEdit12->setReadOnly( true );
  myGrp->LineEdit21->setReadOnly( true );
  myGrp->LineEdit22->setReadOnly( true );
  myGrp->LineEdit31->setReadOnly( true );
  myGrp->LineEdit32->setReadOnly( true );
  myGrp->LineEdit11->setMinimumWidth(120);
  myGrp->LineEdit12->setMinimumWidth(120);
  myGrp->LineEdit21->setMinimumWidth(120);
  myGrp->LineEdit22->setMinimumWidth(120);
  myGrp->LineEdit31->setMinimumWidth(120);
  myGrp->LineEdit32->setMinimumWidth(120);
  myGrp->PushButton1->setIcon( image1 );
  myGrp->LineEdit1->setReadOnly( true );

  QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
  layout->setMargin( 0 ); layout->setSpacing( 6 );
  layout->addWidget( myGrp );
  
  /***************************************************************/

  myHelpFileName = "using_measurement_tools_page.html#bounding_box_anchor";

  /* Initialisation */
  Init();
}

Here is the call graph for this function:

Definition at line 119 of file MeasureGUI_BndBoxDlg.cxx.

{
}

Member Function Documentation

void MeasureGUI_Skeleton::activateSelection ( ) [protected, virtual, inherited]

Reimplemented in MeasureGUI_PropertiesDlg, and MeasureGUI_PointDlg.

Definition at line 348 of file MeasureGUI_Skeleton.cxx.

{
  globalSelection( GEOM_ALLSHAPES );
}

Here is the caller graph for this function:

void MeasureGUI_Skeleton::ActivateThisDialog ( ) [protected, virtual, slot, inherited]

Definition at line 215 of file MeasureGUI_Skeleton.cxx.

{
  myGeomGUI->EmitSignalDeactivateDialog();
  
  setEnabled( true );
  
  myGeomGUI->SetActiveDialogBox( ( QDialog* )this );

  LightApp_SelectionMgr* aSel = ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr();
  if ( aSel )
    connect( aSel, SIGNAL( currentSelectionChanged() ), 
             this, SLOT  ( SelectionIntoArgument() ) ) ;
  
  redisplayPreview();
  activateSelection();
}

Here is the call graph for this function:

Here is the caller graph for this function:

SALOME_Prs * MeasureGUI_BndBoxDlg::buildPrs ( ) [protected, virtual]

Reimplemented from MeasureGUI_Skeleton.

Definition at line 242 of file MeasureGUI_BndBoxDlg.cxx.

{
  double aXMin, aYMin, aZMin, aXMax, aYMax, aZMax;

  if ( myObj->_is_nil() || !getParameters( aXMin, aXMax, aYMin, aYMax, aZMin, aZMax ) )
    return 0;

  TopoDS_Shape aShape = BRepPrimAPI_MakeBox( gp_Pnt( aXMin, aYMin, aZMin ),
                                             gp_Pnt( aXMax, aYMax, aZMax ) ).Shape();
       
  return !aShape.IsNull() ? getDisplayer()->BuildPrs( aShape ) : 0;

}

Here is the call graph for this function:

QPushButton * MeasureGUI_Skeleton::buttonClose ( ) const [protected, inherited]

Definition at line 408 of file MeasureGUI_Skeleton.cxx.

{
  return mainFrame()->buttonClose;
}

Here is the call graph for this function:

Here is the caller graph for this function:

QPushButton * MeasureGUI_Skeleton::buttonHelp ( ) const [protected, inherited]

Definition at line 413 of file MeasureGUI_Skeleton.cxx.

{
  return mainFrame()->buttonHelp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

QWidget * MeasureGUI_Skeleton::centralWidget ( ) const [protected, inherited]

Definition at line 403 of file MeasureGUI_Skeleton.cxx.

{
  return mainFrame()->GroupMedium;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MeasureGUI_Skeleton::ClickOnCancel ( ) [protected, virtual, slot, inherited]

Definition at line 141 of file MeasureGUI_Skeleton.cxx.

{
  close();
}

Here is the caller graph for this function:

void MeasureGUI_Skeleton::ClickOnHelp ( ) [protected, virtual, slot, inherited]

Definition at line 150 of file MeasureGUI_Skeleton.cxx.

{
  LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
  if ( app ) {
    app->onHelpContextModule( myGeomGUI ? app->moduleName( myGeomGUI->moduleName() ) : QString( "" ), myHelpFileName );
  }
  else {
    QString platform;
#ifdef WIN32
    platform = "winapplication";
#else
    platform = "application";
#endif
    SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ),
                              tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
                              arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ) );
  }
}

Here is the caller graph for this function:

void MeasureGUI_Skeleton::closeEvent ( QCloseEvent *  e) [protected, inherited]

Definition at line 286 of file MeasureGUI_Skeleton.cxx.

{
  LightApp_SelectionMgr* aSel = ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr();
  if ( aSel )
    disconnect( aSel, 0, this, 0 );
  QDialog::closeEvent( e );
}
GEOM::GEOM_IOperations_ptr MeasureGUI_Skeleton::createOperation ( ) [protected, virtual, inherited]

Definition at line 377 of file MeasureGUI_Skeleton.cxx.

{
  return getGeomEngine()->GetIMeasureOperations( getStudyId() );
}
void MeasureGUI_Skeleton::DeactivateActiveDialog ( ) [protected, virtual, slot, inherited]

Definition at line 197 of file MeasureGUI_Skeleton.cxx.

{
  setEnabled( false );
  
  LightApp_SelectionMgr* aSel = ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr();
  if ( aSel )
    disconnect( aSel, 0, this, 0 );
  
  myGeomGUI->SetActiveDialogBox( 0 );

  globalSelection();
}

Here is the caller graph for this function:

void MeasureGUI_Skeleton::enterEvent ( QEvent *  ) [protected, inherited]

Definition at line 298 of file MeasureGUI_Skeleton.cxx.

{
  if ( mainFrame()->GroupConstructors->isEnabled() )
    return;
    
  ActivateThisDialog();
}

Here is the call graph for this function:

GEOM_Displayer * MeasureGUI_Skeleton::getDisplayer ( ) [protected, inherited]

Definition at line 366 of file MeasureGUI_Skeleton.cxx.

{
  if ( !myDisplayer )
    myDisplayer = new GEOM_Displayer( getStudy() );
  return myDisplayer;
}

Here is the caller graph for this function:

bool MeasureGUI_BndBoxDlg::getParameters ( double &  theXmin,
double &  theXmax,
double &  theYmin,
double &  theYmax,
double &  theZmin,
double &  theZmax 
) [private]

Definition at line 171 of file MeasureGUI_BndBoxDlg.cxx.

{
  if ( myObj->_is_nil() )
    return false;
  else {
    GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
    try {
      Handle(Poly_Triangulation) Trtn = 0; 

      GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
      if ( CORBA::is_nil(aGeomGen) )
        return false;

      QString IOR = GEOMBase::GetIORFromObject( myObj );
      GEOM::GEOM_Object_var anObject = aGeomGen->GetIORFromString( IOR.toLatin1().constData() );
      if ( CORBA::is_nil(anObject) )
        return false;

      TopoDS_Shape aShape;
      GEOMBase::GetShape(anObject, aShape, TopAbs_SHAPE);
      if ( aShape.IsNull() )
        return false;
      
      TopLoc_Location l;
      Handle(Poly_Triangulation) T;
      TopExp_Explorer ex;
      for (ex.Init(aShape,TopAbs_FACE); ex.More(); ex.Next()) {
        const TopoDS_Face& F = TopoDS::Face(ex.Current());
        BRepAdaptor_Surface surf(F);
        if (surf.GetType() == GeomAbs_Sphere) {
          T = BRep_Tool::Triangulation(F, l);
          if (!T.IsNull()) {
            Handle(Poly_Triangulation) NullTrtn = 0;
            (*((Handle(BRep_TFace)*)&F.TShape()))->Triangulation(NullTrtn);
            Trtn = T;
            break;
          }
        }
        else
          break;
      }
      
      anOper->GetBoundingBox( myObj, theXmin, theXmax, theYmin, theYmax, theZmin, theZmax );
      
      if (!Trtn.IsNull()) {
        TopLoc_Location l;
        Handle(Poly_Triangulation) T;
        TopExp_Explorer ex;
        for (ex.Init(aShape,TopAbs_FACE); ex.More(); ex.Next()) {
          const TopoDS_Face& F = TopoDS::Face(ex.Current());
          (*((Handle(BRep_TFace)*)&F.TShape()))->Triangulation(Trtn);
          break;
        }
      }
      
    }
    catch( const SALOME::SALOME_Exception& e ) {
      SalomeApp_Tools::QtCatchCorbaException( e );
      return false;
    }

    return anOper->IsDone();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MeasureGUI_BndBoxDlg::Init ( ) [private]

Reimplemented from MeasureGUI_Skeleton.

Definition at line 128 of file MeasureGUI_BndBoxDlg.cxx.

{
  mySelBtn = myGrp->PushButton1;
  mySelEdit = myGrp->LineEdit1;
  MeasureGUI_Skeleton::Init();
}

Here is the caller graph for this function:

bool MeasureGUI_Skeleton::isValid ( QString &  ) [protected, virtual, inherited]

Reimplemented in MeasureGUI_DistanceDlg, and MeasureGUI_AngleDlg.

Definition at line 357 of file MeasureGUI_Skeleton.cxx.

{
  return !myObj->_is_nil();
}

Here is the caller graph for this function:

void MeasureGUI_Skeleton::keyPressEvent ( QKeyEvent *  e) [protected, inherited]

Definition at line 386 of file MeasureGUI_Skeleton.cxx.

{
  QDialog::keyPressEvent( e );
  if ( e->isAccepted() )
    return;

  if ( e->key() == Qt::Key_F1 ) {
    e->accept();
    ClickOnHelp();
  }
}

Here is the call graph for this function:

void MeasureGUI_Skeleton::LineEditReturnPressed ( ) [protected, virtual, slot, inherited]

Reimplemented in MeasureGUI_DistanceDlg, and MeasureGUI_AngleDlg.

Definition at line 173 of file MeasureGUI_Skeleton.cxx.

{
  /* User name of object input management                          */
  /* If successfull the selection is changed and signal emitted... */
  /* so SelectionIntoArgument() is automatically called.           */
  
  if ( mySelEdit ) {
    const QString objectUserName = mySelEdit->text();
    QWidget* thisWidget = ( QWidget* )this;
    
    LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
    SALOME_ListIO aSelList;
    aSelMgr->selectedObjects(aSelList);

    if (GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, aSelList))
      mySelEdit->setText(objectUserName);
  }
}

Here is the caller graph for this function:

MeasureGUI_SkeletonBox * MeasureGUI_Skeleton::mainFrame ( ) const [protected, inherited]

Definition at line 398 of file MeasureGUI_Skeleton.cxx.

{
  return myMainFrame;
}

Here is the caller graph for this function:

void MeasureGUI_BndBoxDlg::processObject ( ) [protected, virtual]

Reimplemented from MeasureGUI_Skeleton.

Definition at line 139 of file MeasureGUI_BndBoxDlg.cxx.

{
  double aXMin, aXMax, aYMin, aYMax, aZMin, aZMax;

  if ( !getParameters( aXMin, aXMax, aYMin, aYMax, aZMin, aZMax ) ) {
    mySelEdit->setText( "" );
    myGrp->LineEdit11->setText( "" );
    myGrp->LineEdit12->setText( "" );
    myGrp->LineEdit21->setText( "" );
    myGrp->LineEdit22->setText( "" );
    myGrp->LineEdit31->setText( "" );
    myGrp->LineEdit32->setText( "" );
  }
  else {
    SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
    int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );

    myGrp->LineEdit11->setText( DlgRef::PrintDoubleValue( aXMin, aPrecision ) );
    myGrp->LineEdit12->setText( DlgRef::PrintDoubleValue( aXMax, aPrecision ) );

    myGrp->LineEdit21->setText( DlgRef::PrintDoubleValue( aYMin, aPrecision ) );
    myGrp->LineEdit22->setText( DlgRef::PrintDoubleValue( aYMax, aPrecision ) );

    myGrp->LineEdit31->setText( DlgRef::PrintDoubleValue( aZMin, aPrecision ) );
    myGrp->LineEdit32->setText( DlgRef::PrintDoubleValue( aZMax, aPrecision ) );
  }
}

Here is the call graph for this function:

void MeasureGUI_Skeleton::redisplayPreview ( ) [protected, inherited]

Definition at line 319 of file MeasureGUI_Skeleton.cxx.

{
  QString aMess;
  if ( !isValid( aMess ) ) {
    erasePreview( true );
    return;
  }

  erasePreview( false );

  try {
    SUIT_OverrideCursor();

    getDisplayer()->SetColor( Quantity_NOC_VIOLET );
    getDisplayer()->SetToActivate( false );
    
    if ( SALOME_Prs* aPrs = buildPrs() )
      displayPreview( aPrs );
  }
  catch ( const SALOME::SALOME_Exception& e ) {
    SalomeApp_Tools::QtCatchCorbaException( e );
  }
  
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MeasureGUI_Skeleton::SelectionIntoArgument ( ) [protected, virtual, slot, inherited]

Reimplemented in MeasureGUI_DistanceDlg, MeasureGUI_PointDlg, and MeasureGUI_AngleDlg.

Definition at line 246 of file MeasureGUI_Skeleton.cxx.

{
  myObj = GEOM::GEOM_Object::_nil();

  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
  SALOME_ListIO aSelList;
  aSelMgr->selectedObjects(aSelList);

  GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();

  if (aSelList.Extent() > 0) {
    aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
  }

  if (aSelectedObject->_is_nil()) {
    mySelEdit->setText("");
    processObject();
    erasePreview();
    return;
  }

  myObj = aSelectedObject;
  mySelEdit->setText(GEOMBase::GetName(myObj));
  processObject();
  redisplayPreview();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MeasureGUI_Skeleton::SetEditCurrentArgument ( ) [protected, virtual, slot, inherited]

Reimplemented in MeasureGUI_DistanceDlg, and MeasureGUI_AngleDlg.

Definition at line 236 of file MeasureGUI_Skeleton.cxx.

{
  mySelEdit->setFocus();
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

GEOM_Displayer* MeasureGUI_Skeleton::myDisplayer [protected, inherited]

Definition at line 83 of file MeasureGUI_Skeleton.h.

GeometryGUI* MeasureGUI_Skeleton::myGeomGUI [protected, inherited]

Definition at line 82 of file MeasureGUI_Skeleton.h.

Definition at line 58 of file MeasureGUI_BndBoxDlg.h.

QString MeasureGUI_Skeleton::myHelpFileName [protected, inherited]

Definition at line 85 of file MeasureGUI_Skeleton.h.

Definition at line 86 of file MeasureGUI_Skeleton.h.

GEOM::GEOM_Object_var MeasureGUI_Skeleton::myObj [protected, inherited]

Definition at line 80 of file MeasureGUI_Skeleton.h.

QPushButton* MeasureGUI_Skeleton::mySelBtn [protected, inherited]

Definition at line 78 of file MeasureGUI_Skeleton.h.

QLineEdit* MeasureGUI_Skeleton::mySelEdit [protected, inherited]

Definition at line 79 of file MeasureGUI_Skeleton.h.


The documentation for this class was generated from the following files: