Back to index

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

#include <OperationGUI_Fillet1d2dDlg.h>

List of all members.

Public Member Functions

 OperationGUI_Fillet1d2dDlg (GeometryGUI *, QWidget *, bool theIs1D)
 ~OperationGUI_Fillet1d2dDlg ()

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 ()
void ValueChangedInSpinBox (double)

Private Member Functions

void Init ()
void enterEvent (QEvent *)
void activateSelection ()
double getRadius () const

Private Attributes

bool myIs1D
GEOM::GEOM_Object_var myShape
TColStd_IndexedMapOfInteger myVertexes
DlgRef_2Sel1Spin * GroupVertexes

Detailed Description

Definition at line 37 of file OperationGUI_Fillet1d2dDlg.h.


Constructor & Destructor Documentation

OperationGUI_Fillet1d2dDlg::OperationGUI_Fillet1d2dDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent,
bool  theIs1D 
)

Definition at line 52 of file OperationGUI_Fillet1d2dDlg.cxx.

  : GEOMBase_Skeleton(theGeometryGUI, parent, false),
    myIs1D( is1D )
{
  SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
  QPixmap image0 (aResMgr->loadPixmap("GEOM", myIs1D ? tr("ICON_DLG_FILLET_1D") 
                                                     : tr("ICON_DLG_FILLET_2D")));
  QPixmap iconSelect (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));

  setWindowTitle(myIs1D ? tr("GEOM_FILLET_1D_TITLE") : tr("GEOM_FILLET_2D_TITLE"));

  /***************************************************************/
  mainFrame()->GroupConstructors->setTitle(myIs1D ? tr("GEOM_FILLET_1D") : tr("GEOM_FILLET_2D"));
  mainFrame()->RadioButton1->setIcon(image0);
  mainFrame()->RadioButton2->close();
  mainFrame()->RadioButton3->close();

  GroupVertexes = new DlgRef_2Sel1Spin(centralWidget());
  GroupVertexes->GroupBox1->setTitle(myIs1D ? tr("GEOM_FILLET_1D") : tr("GEOM_FILLET_2D"));
  GroupVertexes->TextLabel1->setText(myIs1D ? tr("GEOM_PLANAR_EDGE_WIRE") : tr("GEOM_PLANAR_FACE"));
  GroupVertexes->TextLabel2->setText(tr("GEOM_VERTEXES"));
  GroupVertexes->TextLabel3->setText(tr("GEOM_RADIUS"));
  GroupVertexes->PushButton1->setIcon(iconSelect);
  GroupVertexes->PushButton2->setIcon(iconSelect);
  GroupVertexes->LineEdit1->setReadOnly(true);
  GroupVertexes->LineEdit2->setReadOnly(true);

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

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

  // Set range of spinboxes
  double SpecificStep = 10.0;
  initSpinBox(GroupVertexes->SpinBox_DX, 0.00001, COORD_MAX, SpecificStep, "length_precision" );

  setHelpFileName(myIs1D ? "fillet1d_operation_page.html" : "fillet2d_operation_page.html");

  // Initialisation
  Init();
  resize(100,100);
}

Here is the call graph for this function:

Definition at line 102 of file OperationGUI_Fillet1d2dDlg.cxx.

{
}

Member Function Documentation

Definition at line 348 of file OperationGUI_Fillet1d2dDlg.cxx.

{
  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
  globalSelection();
  if (myEditCurrentArgument == GroupVertexes->LineEdit1)
    //localSelection(myShape, myIs1D ? TopAbs_WIRE : TopAbs_FACE);
    if (myIs1D)
      globalSelection(GEOM_WIRE);
    else {
      TColStd_MapOfInteger aMap;
      aMap.Add(GEOM_FACE);
      aMap.Add(GEOM_SHELL);
      globalSelection(aMap);
    }
  else if (!myShape->_is_nil() && myEditCurrentArgument == GroupVertexes->LineEdit2)
    localSelection(myShape, TopAbs_VERTEX);

  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:

Definition at line 320 of file OperationGUI_Fillet1d2dDlg.cxx.

Here is the caller graph for this function:

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

Definition at line 161 of file OperationGUI_Fillet1d2dDlg.cxx.

{
  if (!onAccept())
    return false;

  initName();
  // Reset dialog state
  GroupVertexes->LineEdit1->setText("");
  GroupVertexes->LineEdit2->setText("");
  myShape = GEOM::GEOM_Object::_nil();
  myVertexes.Clear();
  GroupVertexes->PushButton1->click();

  return true;
}

Here is the caller graph for this function:

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

Definition at line 150 of file OperationGUI_Fillet1d2dDlg.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 OperationGUI_Fillet1d2dDlg::createOperation ( ) [protected, virtual]

Definition at line 373 of file OperationGUI_Fillet1d2dDlg.cxx.

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

Definition at line 329 of file OperationGUI_Fillet1d2dDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 394 of file OperationGUI_Fillet1d2dDlg.cxx.

{
  GEOM::ListOfLong_var aListOfIndexes = new GEOM::ListOfLong;
  aListOfIndexes->length(myVertexes.Extent());

  for (int i = 1, n = myVertexes.Extent(); i <= n; i++)
    aListOfIndexes[ i - 1 ] = myVertexes(i);

  GEOM::GEOM_ILocalOperations_var anOper = GEOM::GEOM_ILocalOperations::_narrow(getOperation());
  GEOM::GEOM_Object_var anObj = myIs1D ?
    anOper->MakeFillet1D(myShape, getRadius(), aListOfIndexes) : 
    anOper->MakeFillet2D(myShape, getRadius(), aListOfIndexes);

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

  return true;
}

Here is the call graph for this function:

double OperationGUI_Fillet1d2dDlg::getRadius ( ) const [private]

Definition at line 417 of file OperationGUI_Fillet1d2dDlg.cxx.

{
  return GroupVertexes ->SpinBox_DX->value();
}

Here is the caller graph for this function:

Definition at line 110 of file OperationGUI_Fillet1d2dDlg.cxx.

{
  // Set Initial values of spinboxes
  GroupVertexes->SpinBox_DX->setValue(5);

  // Clear line edits
  GroupVertexes->LineEdit1->setText("");
  GroupVertexes->LineEdit2->setText("");

  myShape = GEOM::GEOM_Object::_nil();

  myVertexes.Clear();

  showOnlyPreviewControl();

  // 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(GroupVertexes->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(GroupVertexes->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));

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

  connect(GroupVertexes->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));

  initName(myIs1D ? tr("GEOM_FILLET_1D") : tr("GEOM_FILLET_2D"));
  GroupVertexes->PushButton1->click();

  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 382 of file OperationGUI_Fillet1d2dDlg.cxx.

{
  bool ok = !myShape->_is_nil();
  ok = GroupVertexes->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
  ok = (myIs1D || myVertexes.Extent() > 0) && ok;
  return ok;
}

Definition at line 302 of file OperationGUI_Fillet1d2dDlg.cxx.

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

  if (send == GroupVertexes->LineEdit1)
    myEditCurrentArgument = GroupVertexes->LineEdit1;
  else if (send == GroupVertexes->LineEdit2)
    myEditCurrentArgument = GroupVertexes->LineEdit2;
  else
    return;

  GEOMBase_Skeleton::LineEditReturnPressed();
}

Here is the caller graph for this function:

Definition at line 181 of file OperationGUI_Fillet1d2dDlg.cxx.

{
  erasePreview();
  myEditCurrentArgument->setText("");

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

  // If selection of main object is activated
  if (myEditCurrentArgument == GroupVertexes->LineEdit1) {
    myShape = GEOM::GEOM_Object::_nil();
    if (aSelList.Extent() == 1) {
      GEOM::GEOM_Object_var anObj =
        GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
      
      if ( !anObj->_is_nil() ) {
        QString aName = GEOMBase::GetName( anObj );
        TopoDS_Shape aShape;
        if ( GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
          TColStd_IndexedMapOfInteger aMap;
          aSelMgr->GetIndexes(aSelList.First(), aMap);
          if ( aMap.Extent() == 1 ) { // Local Selection
            int anIndex = aMap( 1 );
            aName += QString( myIs1D ? ":wire_%1" : ":face_%1" ).arg( anIndex );
   
            //Find SubShape Object in Father
            GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( anObj, aName );
            
            if ( aFindedObject->_is_nil()) { // Object not found in study
              GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
              anObj = aShapesOp->GetSubShape( anObj, anIndex );
            }
            else
              anObj = aFindedObject; // get Object from study
          }
          else { // Global Selection
            if ((myIs1D && aShape.ShapeType() != TopAbs_WIRE) ||
                (!myIs1D && aShape.ShapeType() != TopAbs_FACE && aShape.ShapeType() != TopAbs_SHELL)) {
              anObj = GEOM::GEOM_Object::_nil();
              aName = "";
            }
          }
        }
        myShape = anObj;
        myEditCurrentArgument->setText(aName
);
        processPreview();
      }
    }
  } else if (myEditCurrentArgument == GroupVertexes->LineEdit2) {
    myVertexes.Clear();
    bool isPreview = myIs1D;
    if (aSelList.Extent() == 1) {
      GEOM::GEOM_Object_var anObj =
        GEOMBase::ConvertIOinGEOMObject( aSelList.First() );

      if ( !anObj->_is_nil() ) {
        TColStd_IndexedMapOfInteger anIndexes;
        aSelMgr->GetIndexes(aSelList.First(), anIndexes);

        if (anIndexes.Extent() > 0) {
          QString aName;
          if (anIndexes.Extent() == 1) {
            int anIndex = anIndexes(1);
            aName = QString(GEOMBase::GetName(anObj)) + QString(":vertex_%1").arg(anIndex);
          }
          else
            aName = tr("GEOM_MEN_POPUP_NAME").arg(anIndexes.Extent());

          isPreview = true;
          myEditCurrentArgument->setText(aName);
          myVertexes = anIndexes;
        }
      }
    }
    if ( isPreview )
      processPreview();
  }

  if (myEditCurrentArgument == GroupVertexes->LineEdit1) {
    if (!myShape->_is_nil() && myVertexes.Extent() == 0)
      GroupVertexes->PushButton2->click();
  }
}

Here is the caller graph for this function:

Definition at line 271 of file OperationGUI_Fillet1d2dDlg.cxx.

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

  if (send == GroupVertexes->PushButton1) {
    myEditCurrentArgument = GroupVertexes->LineEdit1;
    GroupVertexes->PushButton2->setDown(false);
    GroupVertexes->LineEdit2->setEnabled(false);
  }
  else if (send == GroupVertexes->PushButton2) {
    myEditCurrentArgument = GroupVertexes->LineEdit2;
    GroupVertexes->PushButton1->setDown(false);
    GroupVertexes->LineEdit1->setEnabled(false);
  }

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

  activateSelection();

  // seems we need it only to avoid preview disappearing, caused by selection mode change
  processPreview();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void OperationGUI_Fillet1d2dDlg::ValueChangedInSpinBox ( double  ) [private, slot]

Definition at line 339 of file OperationGUI_Fillet1d2dDlg.cxx.

{
  processPreview();
}

Here is the caller graph for this function:


Member Data Documentation

DlgRef_2Sel1Spin* OperationGUI_Fillet1d2dDlg::GroupVertexes [private]

Definition at line 71 of file OperationGUI_Fillet1d2dDlg.h.

Definition at line 67 of file OperationGUI_Fillet1d2dDlg.h.

GEOM::GEOM_Object_var OperationGUI_Fillet1d2dDlg::myShape [private]

Definition at line 68 of file OperationGUI_Fillet1d2dDlg.h.

TColStd_IndexedMapOfInteger OperationGUI_Fillet1d2dDlg::myVertexes [private]

Definition at line 69 of file OperationGUI_Fillet1d2dDlg.h.


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