Back to index

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

#include <RepairGUI_CloseContourDlg.h>

List of all members.

Public Member Functions

 RepairGUI_CloseContourDlg (GeometryGUI *, QWidget *=0, bool=false)
 ~RepairGUI_CloseContourDlg ()

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 initSelection ()
bool getIsByVertex () const

Private Attributes

GEOM::GEOM_Object_var myObject
GEOM::short_array_var myWiresInd
DlgRef_2SelExt * GroupPoints
QButtonGroup * myIsVertexGr

Detailed Description

Definition at line 39 of file RepairGUI_CloseContourDlg.h.


Constructor & Destructor Documentation

RepairGUI_CloseContourDlg::RepairGUI_CloseContourDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent = 0,
bool  modal = false 
)

Definition at line 52 of file RepairGUI_CloseContourDlg.cxx.

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

  setWindowTitle(tr("GEOM_CLOSECONTOUR_TITLE"));

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

  GroupPoints = new DlgRef_2SelExt(centralWidget());
  GroupPoints->GroupBox1->setTitle(tr("Contour to close"));
  GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
  GroupPoints->PushButton1->setIcon(image1);
  GroupPoints->LineEdit1->setReadOnly(true);

  GroupPoints->TextLabel2->setText(tr("Contour to close"));
  GroupPoints->PushButton2->setIcon(image1);
  GroupPoints->LineEdit2->setReadOnly(true);

  QRadioButton* rb1 = new QRadioButton(tr("Close by common vertex"), GroupPoints->Box);
  QRadioButton* rb2 = new QRadioButton(tr("Close by new edge"),      GroupPoints->Box);

  myIsVertexGr = new QButtonGroup(GroupPoints->Box);
  myIsVertexGr->addButton(rb1, 0);
  myIsVertexGr->addButton(rb2, 1);
  rb1->setChecked(true);

  QVBoxLayout* l = new QVBoxLayout(GroupPoints->Box);
  l->setMargin(0); l->setSpacing(6);
  l->addWidget(rb1);
  l->addWidget(rb2);

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

  setHelpFileName("close_contour_operation_page.html");

  Init();
}

Here is the call graph for this function:

Definition at line 106 of file RepairGUI_CloseContourDlg.cxx.

{
}

Member Function Documentation

Definition at line 272 of file RepairGUI_CloseContourDlg.cxx.

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

  myEditCurrentArgument = GroupPoints->LineEdit1;
  myEditCurrentArgument->setText( "" );
  GroupPoints->LineEdit2->setText( "" );
  myObject = GEOM::GEOM_Object::_nil();
  myWiresInd->length( 0 );

  initSelection();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 155 of file RepairGUI_CloseContourDlg.cxx.

{
  if (!onAccept())
    return false;

  initName();
  // activate first line edit
  GroupPoints->PushButton1->click();
  return true;
}

Here is the caller graph for this function:

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

Definition at line 144 of file RepairGUI_CloseContourDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 301 of file RepairGUI_CloseContourDlg.cxx.

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

Definition at line 291 of file RepairGUI_CloseContourDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 321 of file RepairGUI_CloseContourDlg.cxx.

{
  GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
  GEOM::GEOM_Object_var anObj = anOper->CloseContour(myObject, myWiresInd, getIsByVertex());

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

  return aResult;
}

Here is the call graph for this function:

bool RepairGUI_CloseContourDlg::getIsByVertex ( ) const [private]

Definition at line 337 of file RepairGUI_CloseContourDlg.cxx.

{
  return myIsVertexGr->button(0)->isChecked();
}

Here is the caller graph for this function:

void RepairGUI_CloseContourDlg::Init ( ) [private]

Definition at line 114 of file RepairGUI_CloseContourDlg.cxx.

{
  // init variables
  GroupPoints->LineEdit1->clear();
  GroupPoints->LineEdit2->clear();
  myObject = GEOM::GEOM_Object::_nil();
  myWiresInd = new GEOM::short_array();
  myWiresInd->length(0);

  // signals and slots connections
  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(GroupPoints->LineEdit1,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
  connect(GroupPoints->LineEdit2,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));

  initName(tr("CLOSE_CONTOUR_NEW_OBJ_NAME"));

  GroupPoints->PushButton1->click();
  SelectionIntoArgument();
  resize(100,100);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 346 of file RepairGUI_CloseContourDlg.cxx.

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

  if (myEditCurrentArgument == GroupPoints->LineEdit1) {
    TColStd_MapOfInteger aTypes;
    aTypes.Add(GEOM_COMPOUND);
    aTypes.Add(GEOM_SOLID);
    aTypes.Add(GEOM_SHELL);
    aTypes.Add(GEOM_FACE);
    aTypes.Add(GEOM_WIRE);

    globalSelection(aTypes);
  }
  else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
    localSelection(myObject, TopAbs_EDGE);
    localSelection(myObject, TopAbs_WIRE);
  }

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 310 of file RepairGUI_CloseContourDlg.cxx.

{
  TopoDS_Shape aTmpShape;
  return !myObject->_is_nil() && (myWiresInd->length() ||
                                  GEOMBase::GetShape(myObject, aTmpShape, TopAbs_WIRE));
}

Definition at line 259 of file RepairGUI_CloseContourDlg.cxx.

{
  const QObject* send = sender();
  if (send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2) {
    myEditCurrentArgument = (QLineEdit*)send;
    GEOMBase_Skeleton::LineEditReturnPressed();
  }
}

Here is the caller graph for this function:

Definition at line 170 of file RepairGUI_CloseContourDlg.cxx.

{
  myEditCurrentArgument->setText("");
  // the second argument depends on the first one
  GroupPoints->LineEdit2->setText("");
  myWiresInd->length(0);

  if (myEditCurrentArgument == GroupPoints->LineEdit1)
    myObject = GEOM::GEOM_Object::_nil();

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

  if (aSelList.Extent() == 1) {
    Handle(SALOME_InteractiveObject) anIO = aSelList.First();

    if (myEditCurrentArgument == GroupPoints->LineEdit1) { // face selection
      myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
      if ( GEOMBase::IsShape(myObject) ) {
        myEditCurrentArgument->setText(GEOMBase::GetName(myObject));
        TopoDS_Shape aShape;
        if (GEOMBase::GetShape(myObject, aShape, TopAbs_WIRE))
          GroupPoints->LineEdit2->setText(myEditCurrentArgument->text());

        // clear selection
        disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
        myGeomGUI->getApp()->selectionMgr()->clearSelected();
        connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
                this, SLOT(SelectionIntoArgument()));

        GroupPoints->PushButton2->click();
      }
      else
        myObject = GEOM::GEOM_Object::_nil();
    }
    else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
      TColStd_IndexedMapOfInteger aMap;
      aSelMgr->GetIndexes(anIO, aMap);
      const int n = aMap.Extent();
      myWiresInd->length(n);
      for (int i = 1; i <= n; i++)
        myWiresInd[i-1] = aMap(i);
      if (n)
        myEditCurrentArgument->setText(QString::number(n) + "_" + tr("GEOM_WIRE") + tr("_S_"));
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 223 of file RepairGUI_CloseContourDlg.cxx.

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

  bool isEffective = false;

  if (send == GroupPoints->PushButton1) {
    isEffective = true;
    myEditCurrentArgument = GroupPoints->LineEdit1;

    GroupPoints->PushButton2->setDown(false);
    GroupPoints->LineEdit2->setEnabled(false);
  }
  else if (send == GroupPoints->PushButton2 && !myObject->_is_nil()) {
    isEffective = true;
    myEditCurrentArgument = GroupPoints->LineEdit2;

    GroupPoints->PushButton1->setDown(false);
    GroupPoints->LineEdit1->setEnabled(false);
  }

  if (isEffective) {
    initSelection();

    // enable line edit
    myEditCurrentArgument->setEnabled(true);
    myEditCurrentArgument->setFocus();
    // after setFocus(), because it will be setDown(false) when loses focus
    send->setDown(true);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

DlgRef_2SelExt* RepairGUI_CloseContourDlg::GroupPoints [private]

Definition at line 64 of file RepairGUI_CloseContourDlg.h.

QButtonGroup* RepairGUI_CloseContourDlg::myIsVertexGr [private]

Definition at line 65 of file RepairGUI_CloseContourDlg.h.

GEOM::GEOM_Object_var RepairGUI_CloseContourDlg::myObject [private]

Definition at line 61 of file RepairGUI_CloseContourDlg.h.

GEOM::short_array_var RepairGUI_CloseContourDlg::myWiresInd [private]

Definition at line 62 of file RepairGUI_CloseContourDlg.h.


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