Back to index

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

#include <OperationGUI_PartitionDlg.h>

List of all members.

Public Member Functions

 OperationGUI_PartitionDlg (GeometryGUI *, QWidget *=0)
 ~OperationGUI_PartitionDlg ()
void SetListMaterials (GEOM::ListOfLong)
GEOM::ListOfLong GetListMaterials ()

Protected Member Functions

virtual GEOM::GEOM_IOperations_ptr createOperation ()
virtual bool isValid (QString &)
virtual bool execute (ObjectList &)
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr)

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void ActivateThisDialog ()
void LineEditReturnPressed ()
void SelectionIntoArgument ()
void SetEditCurrentArgument ()
void ComboTextChanged ()
void ConstructorsClicked (int)

Private Member Functions

void Init ()
void enterEvent (QEvent *)
int GetLimit () const

Private Attributes

GEOM::ListOfGO myListShapes
GEOM::ListOfLong myListMaterials
GEOM::ListOfGO myListTools
GEOM::ListOfGO myListRemoveInside
GEOM::ListOfGO myListKeepInside
DlgRef_2Sel1List2Check * GroupPoints

Detailed Description

Definition at line 36 of file OperationGUI_PartitionDlg.h.


Constructor & Destructor Documentation

OperationGUI_PartitionDlg::OperationGUI_PartitionDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent = 0 
)

Definition at line 52 of file OperationGUI_PartitionDlg.cxx.

  : GEOMBase_Skeleton( theGeometryGUI, parent, false )
{
  SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
  QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION" ) ) );
  QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_PARTITION_PLANE" ) ) );
  QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );

  setWindowTitle( tr( "GEOM_PARTITION_TITLE" ) );

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

  // Full partition (contains half-space partition)
  GroupPoints = new DlgRef_2Sel1List2Check( centralWidget() );
  GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
  GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
  GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECTS" ) );
  GroupPoints->TextLabel3->setText( tr( "GEOM_RECONSTRUCTION_LIMIT" ) );
  GroupPoints->PushButton1->setIcon( image2 );
  GroupPoints->PushButton2->setIcon( image2 );
  GroupPoints->LineEdit1->setReadOnly( true );
  GroupPoints->LineEdit2->setReadOnly( true );
  GroupPoints->LineEdit1->setEnabled( true );
  GroupPoints->LineEdit2->setEnabled( false );
  GroupPoints->CheckButton1->setText( tr( "GEOM_KEEP_NONLIMIT_SHAPES" ) );
  GroupPoints->CheckButton2->setText( tr( "GEOM_NO_SELF_INTERSECTION" ) );

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

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

  setHelpFileName( "partition_page.html" );

  Init();
}

Here is the call graph for this function:

Definition at line 100 of file OperationGUI_PartitionDlg.cxx.

{
  // no need to delete child widgets, Qt does it all for us
}

Member Function Documentation

Definition at line 383 of file OperationGUI_PartitionDlg.cxx.

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

  ConstructorsClicked( getConstructorId() );
  processPreview();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 239 of file OperationGUI_PartitionDlg.cxx.

{
  if ( !onAccept() )
    return false;

  initName();
  //  0020854: EDF 1398 GEOM: Ergonomy of Partition GUI window
  //  ConstructorsClicked( getConstructorId() );
  return true;
}

Here is the caller graph for this function:

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

Definition at line 227 of file OperationGUI_PartitionDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 502 of file OperationGUI_PartitionDlg.cxx.

{
  //bool IsEnabled = GroupPoints->ComboBox1->currentItem() < 3;
  //GroupPoints->LineEdit3->setEnabled(IsEnabled);
  //GroupPoints->LineEdit4->setEnabled(IsEnabled);
  //GroupPoints->TextLabel4->setEnabled(IsEnabled);
  //GroupPoints->TextLabel5->setEnabled(IsEnabled);
  //GroupPoints->PushButton3->setEnabled(IsEnabled);
  //GroupPoints->PushButton4->setEnabled(IsEnabled);
  processPreview();
}

Here is the caller graph for this function:

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

Definition at line 169 of file OperationGUI_PartitionDlg.cxx.

{
  disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
  globalSelection();

  //myListShapes.length( 0 );
  //myListTools.length( 0 );
  //myListKeepInside.length( 0 );   // obsolete
  //myListRemoveInside.length( 0 ); // obsolete
  //myListMaterials.length( 0 );    // obsolete

  switch ( constructorId ) {
  case 0: /*Full partition */
    GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
    GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
    GroupPoints->TextLabel2->setText( tr( "GEOM_TOOL_OBJECTS" ) );
    GroupPoints->TextLabel3->show();
    GroupPoints->ComboBox1->show();
    GroupPoints->ComboBox1->setCurrentIndex( 0 );
    GroupPoints->CheckButton1->show();
    GroupPoints->CheckButton2->show();
    GroupPoints->PushButton1->setDown( true );
    GroupPoints->PushButton2->setDown( false );
    GroupPoints->LineEdit1->setEnabled(true);
    GroupPoints->LineEdit2->setEnabled(false);
    break;
  case 1: /*Half-space partition */
    GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION_HALFSPACE" ) );
    GroupPoints->TextLabel3->hide();
    GroupPoints->ComboBox1->hide();
    GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
    GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) );
    GroupPoints->CheckButton1->hide();
    GroupPoints->CheckButton2->hide();
    GroupPoints->PushButton1->setDown( true );
    GroupPoints->LineEdit1->setEnabled(true);
    break;
  }

  myEditCurrentArgument = GroupPoints->LineEdit1;
  GroupPoints->LineEdit1->clear();
  GroupPoints->LineEdit2->clear();

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

  myEditCurrentArgument->setFocus();
  connect( myGeomGUI->getApp()->selectionMgr(),
           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 409 of file OperationGUI_PartitionDlg.cxx.

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

Definition at line 398 of file OperationGUI_PartitionDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 431 of file OperationGUI_PartitionDlg.cxx.

{
  bool res = false;
  GEOM::GEOM_Object_var anObj;

  GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());

  switch ( getConstructorId() ) {
  case 0:
    {
      int aLimit               = GetLimit();
      int aKeepNonlimitShapes  = GroupPoints->CheckButton1->isChecked();
      bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked();

      anObj = aNoSelfIntersection ?
        anOper->MakePartitionNonSelfIntersectedShape(myListShapes, myListTools,
                                                     myListKeepInside, myListRemoveInside,
                                                     aLimit, false, myListMaterials, aKeepNonlimitShapes) :
        anOper->MakePartition(myListShapes, myListTools,
                              myListKeepInside, myListRemoveInside,
                              aLimit, false, myListMaterials, aKeepNonlimitShapes);
      res = true;
    }
    break;
  case 1:
    {
      anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in() );
      res = true;
    }
    break;
  }

  if ( !anObj->_is_nil() ) {
    TopoDS_Shape aShape;
    GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE );
    TopoDS_Iterator It( aShape, Standard_True, Standard_True );
    int nbSubshapes = 0;
    for (; It.More(); It.Next())
      nbSubshapes++;

    if ( nbSubshapes )
      objects.push_back( anObj._retn() );
    else
      SUIT_MessageBox::warning( this,
                                QObject::tr( "GEOM_ERROR" ),
                                QObject::tr( "GEOM_WRN_PARTITION_RESULT_EMPTY" ) );
  }

  return res;
}

Here is the call graph for this function:

int OperationGUI_PartitionDlg::GetLimit ( ) const [private]

Definition at line 518 of file OperationGUI_PartitionDlg.cxx.

{
  int aLimit = GroupPoints->ComboBox1->currentIndex();

  switch ( aLimit ) {
  case 0:  aLimit = GEOM::SOLID ; break;
  case 1:  aLimit = GEOM::SHELL ; break;
  case 2:  aLimit = GEOM::FACE  ; break;
  case 3:  aLimit = GEOM::WIRE  ; break;
  case 4:  aLimit = GEOM::EDGE  ; break;
  case 5:  aLimit = GEOM::VERTEX; break;
  default: aLimit = GEOM::SHAPE ;
  }

  return aLimit;
}

Here is the caller graph for this function:

Definition at line 110 of file OperationGUI_PartitionDlg.cxx.

{
  return myListMaterials;
}
void OperationGUI_PartitionDlg::Init ( ) [private]

Definition at line 119 of file OperationGUI_PartitionDlg.cxx.

{
  /* type for sub-shape selection */
  GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SOLID" ) );
  GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::SOLID);
  GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_SHELL" ) );
  GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::SHELL);
  GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_FACE" ) );
  GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::FACE);
  GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_WIRE" ) );
  GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::WIRE);
  GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_EDGE" ) );
  GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::EDGE);
  GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) );
  GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::VERTEX);
  GroupPoints->CheckButton1->setChecked( false );

  mainFrame()->GroupBoxPublish->show();

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

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

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

  connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
  connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );

  connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) );

  connect( myGeomGUI->getApp()->selectionMgr(),
           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );

  connect( GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
  connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );

  initName( tr( "GEOM_PARTITION" ) );

  ConstructorsClicked( 0 );
  GroupPoints->PushButton1->click();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 419 of file OperationGUI_PartitionDlg.cxx.

{
  return (getConstructorId() == 0 ?
          myListShapes.length() :
          myListShapes.length() && myListTools.length());
}

Definition at line 367 of file OperationGUI_PartitionDlg.cxx.

{
  QLineEdit* send = (QLineEdit*)sender();

  if ( send == GroupPoints->LineEdit1 ||
       send == GroupPoints->LineEdit2 ) {
      myEditCurrentArgument = send;
      GEOMBase_Skeleton::LineEditReturnPressed();
  }
}

Here is the caller graph for this function:

void OperationGUI_PartitionDlg::restoreSubShapes ( SALOMEDS::Study_ptr  theStudy,
SALOMEDS::SObject_ptr  theSObject 
) [protected, virtual]

Definition at line 486 of file OperationGUI_PartitionDlg.cxx.

{
  if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
    // empty list of arguments means that all arguments should be restored
    getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
                                         /*theFindMethod=*/GEOM::FSM_GetInPlaceByHistory,
                                         /*theInheritFirstArg=*/myListShapes.length() == 1,
                                         mainFrame()->CheckBoxAddPrefix->isChecked() ); // ? false
  }
}

Definition at line 255 of file OperationGUI_PartitionDlg.cxx.

{
  myEditCurrentArgument->setText( "" );
  QString aString = "";

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

  int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);

  if ( getConstructorId() == 1 ) {
    // for half-selection, only one shape can be selected as an object
    // and only one plane as a tool
    if ( nbSel != 1 ) {
      if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
        myListShapes.length( 0 );
        // myListMaterials.length( 0 ); // obsolete
        return;
      }
      else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
        myListTools.length( 0 );
        return;
      }
    }
  }
  else {
    if ( nbSel < 1 ) {
      if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
        myListShapes.length( 0 );
        //myListMaterials.length( 0 ); // obsolete
        return;
      }
      else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
        myListTools.length( 0 );
        return;
      }
    }
  }

  if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
    GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true);
    //myListMaterials.length( 0 ); // obsolete

    GEOM::shape_type type = GEOM::SHAPE;
    for (int i = 0; i < myListShapes.length(); i++)
      type = qMin( type, myListShapes[i]->GetMaxShapeType() );
    int idx = qMax( 0, GroupPoints->ComboBox1->findData( type ) );
    GroupPoints->ComboBox1->setCurrentIndex( idx );

    if ( !myListShapes.length() )
      return;
  }
  else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
    GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListTools, true);
    if ( !myListTools.length() )
      return;
    else if ( myListTools.length() == 1 && getConstructorId() == 1 ) {
      GEOM::GEOM_IMeasureOperations_var mOp = getGeomEngine()->GetIMeasureOperations( getStudyId() );
      GEOM::ListOfLong_var   intList;
      GEOM::ListOfDouble_var dblList;
      GEOM::GEOM_IKindOfShape::shape_kind kind = mOp->KindOfShape( myListTools[0].in(), intList.out(), dblList.out() );
      mOp->UnRegister();
      if ( kind < GEOM::GEOM_IKindOfShape::DISK_CIRCLE || kind > GEOM::GEOM_IKindOfShape::PLANAR ) {
        myListTools.length( 0 );
        return;
      }
    }
  }

  myEditCurrentArgument->setText( aString );
  processPreview();
}

Here is the caller graph for this function:

Definition at line 334 of file OperationGUI_PartitionDlg.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 ) {
    myGeomGUI->getApp()->selectionMgr()->clearSelected(); //clear prewious selection
    myEditCurrentArgument = GroupPoints->LineEdit2;
    GroupPoints->PushButton1->setDown(false);
    GroupPoints->LineEdit1->setEnabled(false);
    GroupPoints->LineEdit2->setEnabled(true);
    if ( getConstructorId() == 1 )
      globalSelection( GEOM_PLANE  );
  }

  globalSelection( GEOM_ALLSHAPES );

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

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 105 of file OperationGUI_PartitionDlg.cxx.

{
  myListMaterials = ListMaterials;
}

Member Data Documentation

DlgRef_2Sel1List2Check* OperationGUI_PartitionDlg::GroupPoints [private]

Definition at line 66 of file OperationGUI_PartitionDlg.h.

Definition at line 64 of file OperationGUI_PartitionDlg.h.

Definition at line 61 of file OperationGUI_PartitionDlg.h.

Definition at line 63 of file OperationGUI_PartitionDlg.h.

Definition at line 60 of file OperationGUI_PartitionDlg.h.

Definition at line 62 of file OperationGUI_PartitionDlg.h.


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