Back to index

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

#include <MeasureGUI_CenterMassDlg.h>

Collaboration diagram for MeasureGUI_CenterMassDlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MeasureGUI_CenterMassDlg (GeometryGUI *, QWidget *)
 ~MeasureGUI_CenterMassDlg ()

Protected Member Functions

virtual GEOM::GEOM_IOperations_ptr createOperation ()
virtual bool isValid (QString &)
virtual bool execute (ObjectList &)

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void ActivateThisDialog ()
void LineEditReturnPressed ()
void SelectionIntoArgument ()
void SetEditCurrentArgument ()

Private Member Functions

void Init ()
void enterEvent (QEvent *)
void processObject ()
bool getParameters (double &, double &, double &)

Private Attributes

GEOM::GEOM_Object_var myObj
MeasureGUI_1Sel3LineEditmyGrp

Detailed Description

Definition at line 38 of file MeasureGUI_CenterMassDlg.h.


Constructor & Destructor Documentation

MeasureGUI_CenterMassDlg::MeasureGUI_CenterMassDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent 
)

Definition at line 53 of file MeasureGUI_CenterMassDlg.cxx.

  : GEOMBase_Skeleton( theGeometryGUI, parent, false )
{
  QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_CENTERMASS" ) ) );
  QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );

  setWindowTitle( tr( "GEOM_CMASS_TITLE" ) );

  /***************************************************************/
  mainFrame()->GroupConstructors->setTitle( tr( "GEOM_CMASS" ) );
  mainFrame()->RadioButton1->setIcon( image0 );
  mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
  mainFrame()->RadioButton2->close();
  mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
  mainFrame()->RadioButton3->close();

  myGrp = new MeasureGUI_1Sel3LineEdit( centralWidget() );
  myGrp->GroupBox1->setTitle( tr( "GEOM_CENTER" ) );
  myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
  myGrp->TextLabel2->setText( tr( "GEOM_X" ) );
  myGrp->TextLabel3->setText( tr( "GEOM_Y" ) );
  myGrp->TextLabel4->setText( tr( "GEOM_Z" ) );
  myGrp->LineEdit2->setReadOnly( true );
  myGrp->LineEdit3->setReadOnly( true );
  myGrp->LineEdit4->setReadOnly( true );
  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#center_mass_anchor";

  /* Initialisation */
  Init();
}

Here is the call graph for this function:

Definition at line 98 of file MeasureGUI_CenterMassDlg.cxx.

{
}

Member Function Documentation

Definition at line 216 of file MeasureGUI_CenterMassDlg.cxx.

{
  GEOMBase_Skeleton::ActivateThisDialog();

  connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 
           SIGNAL(currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );

  globalSelection();
  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool MeasureGUI_CenterMassDlg::ClickOnApply ( ) [private, slot]

Definition at line 143 of file MeasureGUI_CenterMassDlg.cxx.

{
  if ( !onAccept() )
    return false;

  initName();
  return true;

//    myMeasureGUI->MakeCDGAndDisplay( myGeomShape );
}

Here is the caller graph for this function:

void MeasureGUI_CenterMassDlg::ClickOnOk ( ) [private, slot]

Definition at line 132 of file MeasureGUI_CenterMassDlg.cxx.

{
  if ( ClickOnApply() )
    ClickOnCancel();
}

Here is the call graph for this function:

Here is the caller graph for this function:

GEOM::GEOM_IOperations_ptr MeasureGUI_CenterMassDlg::createOperation ( ) [protected, virtual]

Definition at line 272 of file MeasureGUI_CenterMassDlg.cxx.

{
  return getGeomEngine()->GetIMeasureOperations( getStudyId() );
}
void MeasureGUI_CenterMassDlg::enterEvent ( QEvent *  ) [private]

Definition at line 262 of file MeasureGUI_CenterMassDlg.cxx.

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

Here is the call graph for this function:

bool MeasureGUI_CenterMassDlg::execute ( ObjectList objects) [protected, virtual]

Definition at line 328 of file MeasureGUI_CenterMassDlg.cxx.

{
  GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
  GEOM::GEOM_Object_var anObj = anOper->GetCentreOfMass( myObj );

  if ( !anObj->_is_nil() )
    objects.push_back( anObj._retn() );

  return true;
}
bool MeasureGUI_CenterMassDlg::getParameters ( double &  theX,
double &  theY,
double &  theZ 
) [private]

Definition at line 290 of file MeasureGUI_CenterMassDlg.cxx.

{
  if ( myObj->_is_nil() )
    return false;
  else {
    try {
      GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
      GEOM::GEOM_Object_var anObj = anOper->GetCentreOfMass( myObj );
      if ( !anOper->IsDone() )
        return false;

      TopoDS_Shape aShape;
      if ( !GEOMBase::GetShape( anObj, aShape ) ||
           aShape.IsNull() ||
           aShape.ShapeType() != TopAbs_VERTEX )
        return false;

      TopoDS_Vertex aVertex = TopoDS::Vertex( aShape );

      gp_Pnt aPnt = BRep_Tool::Pnt( aVertex );

      theX = aPnt.X();
      theY = aPnt.Y();
      theZ = aPnt.Z();

      return true;
    }
    catch( const SALOME::SALOME_Exception& e ) {
      SalomeApp_Tools::QtCatchCorbaException( e );
      return false;
    }
  }
}

Here is the caller graph for this function:

void MeasureGUI_CenterMassDlg::Init ( ) [private]

Definition at line 107 of file MeasureGUI_CenterMassDlg.cxx.

{
  /* init variables */
  myEditCurrentArgument = myGrp->LineEdit1;

   /* signals and slots connections */
  connect( buttonOk(),    SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
  connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );

  connect( myGrp->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
  connect( myGrp->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );

  connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );

  initName( tr( "GEOM_POINT") );
  globalSelection();
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 281 of file MeasureGUI_CenterMassDlg.cxx.

{
  return !myObj->_is_nil();
}

Definition at line 202 of file MeasureGUI_CenterMassDlg.cxx.

{
  QLineEdit* send = ( QLineEdit* )sender();
  if ( send == myGrp->LineEdit1 ) {
    myEditCurrentArgument = myGrp->LineEdit1;
    GEOMBase_Skeleton::LineEditReturnPressed();
  }
}

Here is the caller graph for this function:

Definition at line 231 of file MeasureGUI_CenterMassDlg.cxx.

{
  if ( myObj->_is_nil() ) {
    myGrp->LineEdit1->setText( "" );
    myGrp->LineEdit2->setText( "" );
    myGrp->LineEdit3->setText( "" );
    myGrp->LineEdit4->setText( "" );
    erasePreview();
  }
  else {
    double x = 0, y = 0, z = 0;
    
    getParameters( x, y, z );
    
    myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) );

    SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
    int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
    myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( x, aPrecision ) );
    myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( y, aPrecision ) );
    myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( z, aPrecision ) );

    displayPreview(true);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 159 of file MeasureGUI_CenterMassDlg.cxx.

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

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

  if (aSelList.Extent() != 1) {
    processObject();
    return;
  }

  GEOM::GEOM_Object_var aSelectedObject =
    GEOMBase::ConvertIOinGEOMObject( aSelList.First() );

  if ( aSelectedObject->_is_nil() ) {
    processObject();
    return;
  }

  myObj = aSelectedObject;
  processObject();
  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 190 of file MeasureGUI_CenterMassDlg.cxx.

{
  myGrp->LineEdit1->setFocus();
  myEditCurrentArgument = myGrp->LineEdit1;
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 68 of file MeasureGUI_CenterMassDlg.h.

GEOM::GEOM_Object_var MeasureGUI_CenterMassDlg::myObj [private]

Definition at line 67 of file MeasureGUI_CenterMassDlg.h.


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