Back to index

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

#include <RepairGUI_DivideEdgeDlg.h>

List of all members.

Public Member Functions

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

Protected Slots

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

Protected Member Functions

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

Private Member Functions

void Init ()
void enterEvent (QEvent *)
void initSelection ()
bool getIsByParameter () const

Private Attributes

int myIndex
GEOM::GEOM_Object_var myObject
DlgRef_1SelExt * GroupPoints
QButtonGroup * myIsParameterGr
SalomeApp_DoubleSpinBox * myValEdt

Detailed Description

Definition at line 40 of file RepairGUI_DivideEdgeDlg.h.


Constructor & Destructor Documentation

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

Definition at line 59 of file RepairGUI_DivideEdgeDlg.cxx.

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

  setWindowTitle( tr( "GEOM_DIVIDE_EDGE_TITLE" ) );

  /***************************************************************/
  mainFrame()->GroupConstructors->setTitle(tr("GEOM_DIVIDE_EDGE_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_1SelExt( centralWidget() );
  GroupPoints->GroupBox1->setTitle( tr( "GEOM_ADD_POINT" ) );
  GroupPoints->TextLabel1->setText( tr( "GEOM_EDGE" ) );
  GroupPoints->PushButton1->setIcon( image1 );
  GroupPoints->LineEdit1->setReadOnly( true );

  QRadioButton* rb1 = new QRadioButton( tr( "GEOM_BY_PARAMETER" ), GroupPoints->Box );
  QRadioButton* rb2 = new QRadioButton( tr( "GEOM_BY_LENGTH" ),    GroupPoints->Box );

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

  myValEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box );
  initSpinBox( myValEdt, 0., 1., 0.1, "parametric_precision" );
  myValEdt->setValue( 0.5 );
  QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->Box );

  QGridLayout* l = new QGridLayout( GroupPoints->Box );
  l->setMargin( 0 ); l->setSpacing( 6 );
  l->addWidget( rb1, 0, 0, 1, 2 );
  l->addWidget( rb2, 1, 0, 1, 2 );
  l->addWidget( aLbl1, 2, 0 );
  l->addWidget( myValEdt, 2, 1 );

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

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

  setHelpFileName( "add_point_on_edge_operation_page.html" );

  Init();
}

Here is the call graph for this function:

Definition at line 117 of file RepairGUI_DivideEdgeDlg.cxx.

{
}

Member Function Documentation

void RepairGUI_DivideEdgeDlg::ActivateThisDialog ( ) [protected, slot]

Definition at line 320 of file RepairGUI_DivideEdgeDlg.cxx.

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

//  myObject = GEOM::GEOM_Object::_nil();
  myIndex = -1;

  //myGeomGUI->SetState( 0 );
  initSelection();
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool RepairGUI_DivideEdgeDlg::ClickOnApply ( ) [protected, slot]

Definition at line 212 of file RepairGUI_DivideEdgeDlg.cxx.

{
  if ( !onAccept() )
    return false;

  initName();

  myEditCurrentArgument->setText( "" );
  myObject = GEOM::GEOM_Object::_nil();
  myIndex = -1;

  initSelection();

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void RepairGUI_DivideEdgeDlg::ClickOnOk ( ) [protected, slot]

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

Definition at line 348 of file RepairGUI_DivideEdgeDlg.cxx.

{
  return getGeomEngine()->GetIHealingOperations( getStudyId() );
}
void RepairGUI_DivideEdgeDlg::displayPreview ( ) [protected, slot]

Definition at line 166 of file RepairGUI_DivideEdgeDlg.cxx.

{
  erasePreview();
  if ( myObject->_is_nil() )
    return;

  TopoDS_Shape aShape;
  gp_Pnt aPnt;
  GEOMBase::GetShape( myObject, aShape, TopAbs_SHAPE );

  if ( myIndex != -1) {
    TopTools_IndexedMapOfShape aShapes;
    TopExp::MapShapes(aShape, aShapes);
    aShape = aShapes.FindKey(myIndex);
  }

  if (aShape.ShapeType() == TopAbs_EDGE) {
    Standard_Real aFP, aLP, aP;
    Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aShape), aFP, aLP);
    aP = aFP + (aLP - aFP) * myValEdt->value();
    aPnt = aCurve->Value(aP);
    BRepBuilderAPI_MakeVertex mkVertex (aPnt);
    aShape = mkVertex.Shape();
    // Build prs
    SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aShape );
    if ( aPrs != 0 && !aPrs->IsNull() )
      GEOMBase_Helper::displayPreview( aPrs, false, true );
  } 
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 337 of file RepairGUI_DivideEdgeDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 367 of file RepairGUI_DivideEdgeDlg.cxx.

{
  GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
  GEOM::GEOM_Object_var anObj = anOper->DivideEdge( myObject, myIndex, myValEdt->value(), getIsByParameter() );
  bool aResult = !anObj->_is_nil();
  if ( aResult )
  {
    if ( !IsPreview() )
    {
      QStringList aParameters;
      aParameters << "";
      aParameters << myValEdt->text();
      aParameters << "";
      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
    }
    objects.push_back( anObj._retn() );
  }

  return aResult;
}

Here is the call graph for this function:

Definition at line 392 of file RepairGUI_DivideEdgeDlg.cxx.

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

Here is the caller graph for this function:

void RepairGUI_DivideEdgeDlg::Init ( ) [private]

Definition at line 125 of file RepairGUI_DivideEdgeDlg.cxx.

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

  myObject = GEOM::GEOM_Object::_nil();
  myIndex = -1;

  //myGeomGUI->SetState( 0 );
  initSelection();

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

  connect( myValEdt,   SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );

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

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

  initName( tr( "DEVIDE_EDGE_NEW_OBJECT_NAME" ) );
  resize(100,100);
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 401 of file RepairGUI_DivideEdgeDlg.cxx.

{
  GEOM::GEOM_Object_var aNullGeomObject;
  localSelection( aNullGeomObject, TopAbs_EDGE ); // load local selection on ALL objects
}

Here is the caller graph for this function:

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

Definition at line 357 of file RepairGUI_DivideEdgeDlg.cxx.

{
  bool ok = myValEdt->isValid( msg, !IsPreview() );
  return !myObject->_is_nil() && ok;
}

Definition at line 307 of file RepairGUI_DivideEdgeDlg.cxx.

{
  if ( sender() == GroupPoints->LineEdit1 ) {
    myEditCurrentArgument = GroupPoints->LineEdit1;
    GEOMBase_Skeleton::LineEditReturnPressed();
  }
}

Here is the caller graph for this function:

Definition at line 234 of file RepairGUI_DivideEdgeDlg.cxx.

{
  myEditCurrentArgument->setText( "" );

  myObject = GEOM::GEOM_Object::_nil();
  myIndex = -1;

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

  if ( aSelList.Extent() == 1 ) {
    Handle(SALOME_InteractiveObject) anIO = aSelList.First();
    GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO );
    if ( !CORBA::is_nil( aSelectedObj ) )
    {
      TopoDS_Shape aShape;
      QString aName = GEOMBase::GetName( aSelectedObj );
      if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) )
      {
        const int aType = aShape.ShapeType();
        if ( aType <= TopAbs_EDGE ) // edge, wire, face, shell, solid, compound
        {
          GEOM::short_array anIndexes;

          TColStd_IndexedMapOfInteger aMap;
          SalomeApp_Application* anApp =
            (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
          anApp->selectionMgr()->GetIndexes( anIO, aMap );

          if ( !aMap.IsEmpty() ) // sub-shape selection
          {
            myIndex = aMap( 1 );
            myObject = aSelectedObj;
            myEditCurrentArgument->setText( aName += QString( ":edge_%1" ).arg( myIndex ) );
          }
          else if ( aType == TopAbs_EDGE ) // single shape selection
          {
            myIndex = -1;
            myObject = aSelectedObj;
            myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
          }
          else // face, shell, solid or compound was selected, and NOT its sub-shape.
          {
            myIndex = -1;
            myObject = GEOM::GEOM_Object::_nil();
          }
        }
      }
    }
  }

  displayPreview();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 293 of file RepairGUI_DivideEdgeDlg.cxx.

{
  if ( sender() == GroupPoints->PushButton1 ) {
    GroupPoints->LineEdit1->setFocus();
    myEditCurrentArgument = GroupPoints->LineEdit1;
  }
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 157 of file RepairGUI_DivideEdgeDlg.cxx.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

DlgRef_1SelExt* RepairGUI_DivideEdgeDlg::GroupPoints [private]

Definition at line 65 of file RepairGUI_DivideEdgeDlg.h.

Definition at line 60 of file RepairGUI_DivideEdgeDlg.h.

Definition at line 66 of file RepairGUI_DivideEdgeDlg.h.

GEOM::GEOM_Object_var RepairGUI_DivideEdgeDlg::myObject [private]

Definition at line 63 of file RepairGUI_DivideEdgeDlg.h.

SalomeApp_DoubleSpinBox* RepairGUI_DivideEdgeDlg::myValEdt [private]

Definition at line 67 of file RepairGUI_DivideEdgeDlg.h.


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