Back to index

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

#include <BasicGUI_LineDlg.h>

List of all members.

Public Member Functions

 BasicGUI_LineDlg (GeometryGUI *, QWidget *=0, bool=false, Qt::WindowFlags=0)
 ~BasicGUI_LineDlg ()

Protected Member Functions

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

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void ActivateThisDialog ()
void DeactivateActiveDialog ()
void ConstructorsClicked (int)
void SelectionIntoArgument ()
void SetEditCurrentArgument ()

Private Member Functions

void Init ()
void enterEvent (QEvent *)

Private Attributes

GEOM::GeomObjPtr myPoint1
GEOM::GeomObjPtr myPoint2
GEOM::GeomObjPtr myFace1
GEOM::GeomObjPtr myFace2
DlgRef_2Sel * GroupPoints
DlgRef_2Sel * GroupFaces

Detailed Description

Definition at line 39 of file BasicGUI_LineDlg.h.


Constructor & Destructor Documentation

BasicGUI_LineDlg::BasicGUI_LineDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent = 0,
bool  modal = false,
Qt::WindowFlags  fl = 0 
)

Definition at line 53 of file BasicGUI_LineDlg.cxx.

  : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{
  QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_LINE_2P" ) ) );
  QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
  QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_LINE_2F" ) ) );

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

  GroupPoints = new DlgRef_2Sel( centralWidget() );

  GroupPoints->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
  GroupPoints->TextLabel1->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
  GroupPoints->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
  GroupPoints->PushButton1->setIcon( image1 );
  GroupPoints->PushButton2->setIcon( image1 );
  GroupPoints->LineEdit1->setReadOnly( true );
  GroupPoints->LineEdit2->setReadOnly( true );
  GroupPoints->LineEdit1->setEnabled( true );
  GroupPoints->LineEdit2->setEnabled( false );

  GroupFaces = new DlgRef_2Sel( centralWidget() );
  GroupFaces->GroupBox1->setTitle( tr( "GEOM_FACES" ) );
  GroupFaces->TextLabel1->setText( tr( "GEOM_FACE_I" ).arg( "1" ) );
  GroupFaces->TextLabel2->setText( tr( "GEOM_FACE_I" ).arg( "2" ) );
  GroupFaces->PushButton1->setIcon( image1 );
  GroupFaces->PushButton2->setIcon( image1 );
  GroupFaces->LineEdit1->setReadOnly( true );
  GroupFaces->LineEdit2->setReadOnly( true );
  GroupFaces->LineEdit1->setEnabled( true );
  GroupFaces->LineEdit2->setEnabled( false );

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

  /***************************************************************/

  setHelpFileName( "create_line_page.html" );

  Init();
}

Here is the call graph for this function:

Definition at line 110 of file BasicGUI_LineDlg.cxx.

{  
}

Member Function Documentation

void BasicGUI_LineDlg::ActivateThisDialog ( ) [private, slot]

Definition at line 333 of file BasicGUI_LineDlg.cxx.

{
  GEOMBase_Skeleton::ActivateThisDialog();
  connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
           this, SLOT( SelectionIntoArgument() ) );

  ConstructorsClicked( getConstructorId() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BasicGUI_LineDlg::addSubshapesToStudy ( ) [protected, virtual]

Definition at line 420 of file BasicGUI_LineDlg.cxx.

{
  switch ( getConstructorId() ) {
  case 0 :
    GEOMBase::PublishSubObject( myPoint1.get() );
    GEOMBase::PublishSubObject( myPoint2.get() );
    break;
  case 1 :
    GEOMBase::PublishSubObject( myFace1.get() );
    GEOMBase::PublishSubObject( myFace2.get() );
    break;
  default:
    break;
  }
}

Here is the call graph for this function:

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

Definition at line 168 of file BasicGUI_LineDlg.cxx.

{
  if ( !onAccept() )
    return false;
  
  initName();

  myEditCurrentArgument->setText( "" );
  ConstructorsClicked( getConstructorId() );

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 157 of file BasicGUI_LineDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void BasicGUI_LineDlg::ConstructorsClicked ( int  constructorId) [private, slot]

Definition at line 185 of file BasicGUI_LineDlg.cxx.

{  
  switch ( constructorId ) {
  case 0:
    {
      myEditCurrentArgument = GroupPoints->LineEdit1;
      myEditCurrentArgument->setText( "" );
      GroupPoints->LineEdit2->setText( "" );
      myPoint1.nullify();
      myPoint2.nullify();
      GroupPoints->PushButton1->setDown(true);
      GroupPoints->PushButton2->setDown(false);
      GroupPoints->LineEdit1->setEnabled(true);
      GroupPoints->LineEdit2->setEnabled(false);
      GroupPoints->show();
      GroupFaces->hide();
      break;
    }
  case 1:
    {
      myEditCurrentArgument = GroupFaces->LineEdit1;
      myEditCurrentArgument->setText("");
      myFace1.nullify();
      myFace2.nullify();
      GroupFaces->PushButton1->setDown(true);
      GroupFaces->PushButton2->setDown(false);
      GroupFaces->LineEdit1->setEnabled(true);
      GroupFaces->LineEdit2->setEnabled(false);
      GroupPoints->hide();
      GroupFaces->show();
      break;
    }
  }

  TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
                             myEditCurrentArgument == GroupFaces->LineEdit2 ) ?
    TopAbs_FACE : TopAbs_VERTEX;
  globalSelection(); // close local selection to clear it
  localSelection( GEOM::GEOM_Object::_nil(), aNeedType );

  qApp->processEvents();
  updateGeometry();
  resize( minimumSizeHint() );
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 365 of file BasicGUI_LineDlg.cxx.

{
  return myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() );
}
void BasicGUI_LineDlg::DeactivateActiveDialog ( ) [private, slot]

Definition at line 346 of file BasicGUI_LineDlg.cxx.

Here is the caller graph for this function:

void BasicGUI_LineDlg::enterEvent ( QEvent *  ) [private]

Definition at line 355 of file BasicGUI_LineDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 394 of file BasicGUI_LineDlg.cxx.

{
  bool res = false;
  GEOM::GEOM_Object_var anObj;
  GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow( getOperation() );
  switch ( getConstructorId() ) {
  case 0 :
    anObj = anOper->MakeLineTwoPnt( myPoint1.get(), myPoint2.get() );
    res = true;
    break;
  case 1 :
    anObj = anOper->MakeLineTwoFaces( myFace1.get(), myFace2.get() );
    res = true;
    break;
  }
  
  if ( !anObj->_is_nil() )
    objects.push_back( anObj._retn() );

  return res;
}

Here is the call graph for this function:

void BasicGUI_LineDlg::Init ( ) [private]

Definition at line 119 of file BasicGUI_LineDlg.cxx.

{
  /* init variables */
  myEditCurrentArgument = GroupPoints->LineEdit1;
  myPoint1.nullify();
  myPoint2.nullify();
  myFace1.nullify();
  myFace2.nullify();

  GroupPoints->PushButton1->setDown(true);
        
  /* signals and slots connections */
  connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
  connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );

  connect( this,           SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );

  connect( buttonOk(),     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
  connect( buttonApply(),  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );

  connect( GroupPoints->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
  connect( GroupPoints->PushButton2, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
  connect( GroupFaces->PushButton1,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
  connect( GroupFaces->PushButton2,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );

  connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
           this, SLOT( SelectionIntoArgument() ) );
  
  initName( tr( "GEOM_LINE" ) );

  ConstructorsClicked( 0 );
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 374 of file BasicGUI_LineDlg.cxx.

{
  bool ok = false;
  switch ( getConstructorId() ) {
  case 0 :
    ok = myPoint1 && myPoint2;
    break;
  case 1:
    ok = myFace1 && myFace2;
    break;
  default:
    break;
  }
  return ok;
}
void BasicGUI_LineDlg::SelectionIntoArgument ( ) [private, slot]

Definition at line 235 of file BasicGUI_LineDlg.cxx.

{
  myEditCurrentArgument->setText( "" );

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

  if (aSelList.Extent() != 1) {
    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1.nullify();
    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2.nullify();
    else if (myEditCurrentArgument == GroupFaces->LineEdit1)  myFace1.nullify();
    else if (myEditCurrentArgument == GroupFaces->LineEdit2)  myFace2.nullify();
    displayPreview(true);
    return;
  }

  TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
                             myEditCurrentArgument == GroupFaces->LineEdit2 ) ?
    TopAbs_FACE : TopAbs_VERTEX;
  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
  TopoDS_Shape aShape;
  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
    QString aName = GEOMBase::GetName( aSelectedObject.get() );
    myEditCurrentArgument->setText( aName );
    if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
      myPoint1 = aSelectedObject;
      if ( myPoint1 && !myPoint2 )
        GroupPoints->PushButton2->click();
    }
    else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
      myPoint2 = aSelectedObject;
      if ( myPoint2 && !myPoint1 )
        GroupPoints->PushButton1->click();
    }
    else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) {
      myFace1 = aSelectedObject;
      if ( myFace1 && !myFace2 )
        GroupFaces->PushButton2->click();
    }
    else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) {
      myFace2 = aSelectedObject;
      if ( myFace2 && !myFace1 )
        GroupFaces->PushButton1->click();      
    }
  }
  
  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BasicGUI_LineDlg::SetEditCurrentArgument ( ) [private, slot]

Definition at line 289 of file BasicGUI_LineDlg.cxx.

{
  QPushButton* send = (QPushButton*)sender();
  if ( send == GroupPoints->PushButton1 ) {
    myEditCurrentArgument = GroupPoints->LineEdit1;
    GroupPoints->PushButton2->setDown(false);
    GroupPoints->LineEdit1->setEnabled(true);
    GroupPoints->LineEdit2->setEnabled(false);
  }
  else if ( send == GroupPoints->PushButton2 ) {
    myEditCurrentArgument = GroupPoints->LineEdit2;
    GroupPoints->PushButton1->setDown(false);
    GroupPoints->LineEdit1->setEnabled(false);
    GroupPoints->LineEdit2->setEnabled(true);
  }
  else if ( send == GroupFaces->PushButton1 ) {
    myEditCurrentArgument = GroupFaces->LineEdit1;
    GroupFaces->PushButton2->setDown(false);
    GroupFaces->LineEdit1->setEnabled(true);
    GroupFaces->LineEdit2->setEnabled(false);
  }
  else if ( send == GroupFaces->PushButton2 ) {
    myEditCurrentArgument = GroupFaces->LineEdit2;
    GroupFaces->PushButton1->setDown(false);
    GroupFaces->LineEdit1->setEnabled(false);
    GroupFaces->LineEdit2->setEnabled(true);
  }

  TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
                             myEditCurrentArgument == GroupFaces->LineEdit2 ) ?
    TopAbs_FACE : TopAbs_VERTEX;
  globalSelection(); // close local selection to clear it
  localSelection( GEOM::GEOM_Object::_nil(), aNeedType );

  myEditCurrentArgument->setFocus();
  //  SelectionIntoArgument();
  send->setDown(true);
  displayPreview(true);
}

Here is the caller graph for this function:


Member Data Documentation

DlgRef_2Sel* BasicGUI_LineDlg::GroupFaces [private]

Definition at line 65 of file BasicGUI_LineDlg.h.

DlgRef_2Sel* BasicGUI_LineDlg::GroupPoints [private]

Definition at line 64 of file BasicGUI_LineDlg.h.

Definition at line 61 of file BasicGUI_LineDlg.h.

Definition at line 62 of file BasicGUI_LineDlg.h.

Definition at line 59 of file BasicGUI_LineDlg.h.

Definition at line 60 of file BasicGUI_LineDlg.h.


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