Back to index

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

#include <MeasureGUI_NormaleDlg.h>

List of all members.

Public Member Functions

 MeasureGUI_NormaleDlg (GeometryGUI *, QWidget *)
 ~MeasureGUI_NormaleDlg ()

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 *)

Private Attributes

GEOM::GEOM_Object_var myFace
GEOM::GEOM_Object_var myPoint
DlgRef_2Sel * GroupArgs

Detailed Description

Definition at line 35 of file MeasureGUI_NormaleDlg.h.


Constructor & Destructor Documentation

MeasureGUI_NormaleDlg::MeasureGUI_NormaleDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent 
)

Definition at line 52 of file MeasureGUI_NormaleDlg.cxx.

  : GEOMBase_Skeleton(theGeometryGUI, parent, false)
{
  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
  QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_NORMALE")));
  QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));

  setWindowTitle(tr("GEOM_NORMALE_TITLE"));

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

  GroupArgs = new DlgRef_2Sel (centralWidget());
  GroupArgs->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));

  GroupArgs->TextLabel1->setText(tr("GEOM_FACE"));
  GroupArgs->TextLabel2->setText(tr("GEOM_POINT"));

  GroupArgs->PushButton1->setIcon(image1);
  GroupArgs->PushButton2->setIcon(image1);

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

  setHelpFileName("using_measurement_tools_page.html#normale_anchor");

  Init();
}

Here is the call graph for this function:

Definition at line 92 of file MeasureGUI_NormaleDlg.cxx.

{
}

Member Function Documentation

Definition at line 311 of file MeasureGUI_NormaleDlg.cxx.

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

  DISPLAY_PREVIEW_MACRO
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 140 of file MeasureGUI_NormaleDlg.cxx.

{
  if (!onAccept())
    return false;

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

Here is the caller graph for this function:

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

Definition at line 130 of file MeasureGUI_NormaleDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 334 of file MeasureGUI_NormaleDlg.cxx.

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

Definition at line 324 of file MeasureGUI_NormaleDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 353 of file MeasureGUI_NormaleDlg.cxx.

{
  GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
  GEOM::GEOM_Object_var anObj = anOper->GetNormal(myFace, myPoint);

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

  return true;
}
void MeasureGUI_NormaleDlg::Init ( ) [private]

Definition at line 100 of file MeasureGUI_NormaleDlg.cxx.

{
  // init variables
  GroupArgs->LineEdit1->setReadOnly(true);
  GroupArgs->LineEdit2->setReadOnly(true);

  GroupArgs->LineEdit1->setText("");
  GroupArgs->LineEdit2->setText("");
  myFace = myPoint = GEOM::GEOM_Object::_nil();

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

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

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

  initName(tr("GEOM_VECTOR_NORMALE"));

  GroupArgs->PushButton1->click();
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 343 of file MeasureGUI_NormaleDlg.cxx.

{
  //return !CORBA::is_nil(myFace) && !CORBA::is_nil(myPoint);
  return !CORBA::is_nil(myFace);
}

Definition at line 297 of file MeasureGUI_NormaleDlg.cxx.

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

Here is the caller graph for this function:

Definition at line 155 of file MeasureGUI_NormaleDlg.cxx.

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

  if (myEditCurrentArgument == GroupArgs->LineEdit1) {
    myFace = GEOM::GEOM_Object::_nil();
  }
  else if (myEditCurrentArgument == GroupArgs->LineEdit2) {
    myPoint = GEOM::GEOM_Object::_nil();
  }

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

  if (aSelList.Extent() != 1)
    return;

  // nbSel == 1
  GEOM::GEOM_Object_var aSelectedObject =
    GEOMBase::ConvertIOinGEOMObject( aSelList.First() );

  if ( CORBA::is_nil(aSelectedObject) )
    return;

  QString aName = GEOMBase::GetName(aSelectedObject);

  if (myEditCurrentArgument == GroupArgs->LineEdit1) {
    TopoDS_Shape aShape;
    if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
    {
      TColStd_IndexedMapOfInteger aMap;
      aSelMgr->GetIndexes(aSelList.First(), aMap);
      if (aMap.Extent() == 1) // Local Selection
      {
        GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
        int anIndex = aMap(1);
        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
        aName += QString(":face_%1").arg(anIndex);
      }
      else // Global Selection
      {
        if (aShape.ShapeType() != TopAbs_FACE) {
          aSelectedObject = GEOM::GEOM_Object::_nil();
          aName = "";
        }
      }
    }
    myFace = aSelectedObject;
    myEditCurrentArgument->setText(aName);

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

    if (!myFace->_is_nil() && myPoint->_is_nil())
      GroupArgs->PushButton2->click();
  }
  else if (myEditCurrentArgument == GroupArgs->LineEdit2) {
    TopoDS_Shape aShape;
    if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
    {
      TColStd_IndexedMapOfInteger aMap;
      aSelMgr->GetIndexes(aSelList.First(), aMap);
      if (aMap.Extent() == 1) // Local Selection
      {
        GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
        int anIndex = aMap(1);
        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
        aName += QString(":vertex_%1").arg(anIndex);
      }
      else // Global Selection
      {
        if (aShape.ShapeType() != TopAbs_VERTEX) {
          aSelectedObject = GEOM::GEOM_Object::_nil();
          aName = "";
        }
      }
    }
    myPoint = aSelectedObject;
    myEditCurrentArgument->setText(aName);

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

    if (!myPoint->_is_nil() && myFace->_is_nil())
      GroupArgs->PushButton1->click();
  }

  DISPLAY_PREVIEW_MACRO
}

Here is the caller graph for this function:

Definition at line 257 of file MeasureGUI_NormaleDlg.cxx.

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

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

  if (send == GroupArgs->PushButton1) {
    myEditCurrentArgument = GroupArgs->LineEdit1;

    GroupArgs->PushButton2->setDown(false);
    GroupArgs->LineEdit2->setEnabled(false);

    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE);
  }
  else if (send == GroupArgs->PushButton2) {
    myEditCurrentArgument = GroupArgs->LineEdit2;

    GroupArgs->PushButton1->setDown(false);
    GroupArgs->LineEdit1->setEnabled(false);

    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
  }
  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
          this, SLOT(SelectionIntoArgument()));

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

  // seems we need it only to avoid preview disappearing, caused by selection mode change
  DISPLAY_PREVIEW_MACRO
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

DlgRef_2Sel* MeasureGUI_NormaleDlg::GroupArgs [private]

Definition at line 57 of file MeasureGUI_NormaleDlg.h.

GEOM::GEOM_Object_var MeasureGUI_NormaleDlg::myFace [private]

Definition at line 54 of file MeasureGUI_NormaleDlg.h.

GEOM::GEOM_Object_var MeasureGUI_NormaleDlg::myPoint [private]

Definition at line 55 of file MeasureGUI_NormaleDlg.h.


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