Back to index

salome-geom  6.5.0
Public Member Functions
BasicGUI Class Reference

#include <BasicGUI.h>

List of all members.

Public Member Functions

 BasicGUI (GeometryGUI *)
 ~BasicGUI ()
bool OnGUIEvent (int, SUIT_Desktop *)
bool OnMousePress (QMouseEvent *, SUIT_Desktop *, SUIT_ViewWindow *)
gp_Pnt ConvertClickToPoint (int, int, Handle(V3d_View))

Detailed Description

Definition at line 37 of file BasicGUI.h.


Constructor & Destructor Documentation

BasicGUI::BasicGUI ( GeometryGUI *  parent)

Definition at line 61 of file BasicGUI.cxx.

  : GEOMGUI( parent )
{
}

Definition at line 70 of file BasicGUI.cxx.

{
}

Member Function Documentation

gp_Pnt BasicGUI::ConvertClickToPoint ( int  x,
int  y,
Handle(V3d_View)  aView 
)

Definition at line 172 of file BasicGUI.cxx.

{
  V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt;
  aView->Eye( XEye, YEye, ZEye );

  aView->At( XAt, YAt, ZAt );
  gp_Pnt EyePoint( XEye, YEye, ZEye );
  gp_Pnt AtPoint( XAt, YAt, ZAt );

  gp_Vec EyeVector( EyePoint, AtPoint );
  gp_Dir EyeDir( EyeVector );

  gp_Pln PlaneOfTheView = gp_Pln( AtPoint, EyeDir );
  Standard_Real X, Y, Z;
  aView->Convert( x, y, X, Y, Z );
  gp_Pnt ConvertedPoint( X, Y, Z );

  gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project( PlaneOfTheView, ConvertedPoint );
  gp_Pnt ResultPoint = ElSLib::Value( ConvertedPointOnPlane.X(), ConvertedPointOnPlane.Y(), PlaneOfTheView );
  return ResultPoint;
}

Here is the caller graph for this function:

bool BasicGUI::OnGUIEvent ( int  theCommandID,
SUIT_Desktop *  parent 
)

Definition at line 79 of file BasicGUI.cxx.

{
  getGeometryGUI()->EmitSignalDeactivateDialog();
  QDialog* aDlg = NULL;

  switch ( theCommandID ) {
  case GEOMOp::OpPoint:    // POINT
    aDlg = new BasicGUI_PointDlg( getGeometryGUI(), parent ); 
    break;
  case GEOMOp::OpLine:     // LINE
    aDlg = new BasicGUI_LineDlg( getGeometryGUI(), parent );
    break;
  case GEOMOp::OpCircle:   // CIRCLE
    aDlg = new BasicGUI_CircleDlg( getGeometryGUI(), parent );
    break;
  case GEOMOp::OpEllipse:  // ELLIPSE
    aDlg = new BasicGUI_EllipseDlg( getGeometryGUI(), parent );
    break;
  case GEOMOp::OpArc:      // ARC
    aDlg = new BasicGUI_ArcDlg( getGeometryGUI(), parent );
    break ;
  case GEOMOp::OpVector:   // VECTOR
    aDlg = new BasicGUI_VectorDlg( getGeometryGUI(), parent );
    break;
  case GEOMOp::OpPlane:    // PLANE
    aDlg = new BasicGUI_PlaneDlg( getGeometryGUI(), parent );
    break;
  case GEOMOp::OpCurve:    // CURVE
    aDlg = new BasicGUI_CurveDlg( getGeometryGUI(), parent );
    break;
  case GEOMOp::OpLCS:      // LOCAL COORDINATE SYSTEM
    aDlg = new BasicGUI_MarkerDlg( getGeometryGUI(), parent );
    break;      
  default:
    SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
    break;
  }
  
  if ( aDlg != NULL )
    aDlg->show();
  
  return true;
}
bool BasicGUI::OnMousePress ( QMouseEvent *  pe,
SUIT_Desktop *  parent,
SUIT_ViewWindow *  theViewWindow 
)

Definition at line 128 of file BasicGUI.cxx.

{
  QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox();

  // Create Point dialog, OCC viewer 
  if ( aDlg && ( QString( aDlg->metaObject()->className() ).compare( "BasicGUI_PointDlg" ) == 0 ) &&
       theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() &&
       pe->modifiers() != Qt::ControlModifier ) {
    BasicGUI_PointDlg* aPntDlg = (BasicGUI_PointDlg*) aDlg;
    if ( aPntDlg->acceptMouseEvent() ) {
      OCCViewer_Viewer* anOCCViewer =
        ( (OCCViewer_ViewManager*)( theViewWindow->getViewManager() ) )->getOCCViewer();
      Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext();

      gp_Pnt aPnt;    

      ic->InitSelected();
      if ( pe->modifiers() == Qt::ShiftModifier )
        ic->ShiftSelect();  // Append selection
      else
        ic->Select();       // New selection

      ic->InitSelected();
      if ( ic->MoreSelected() ) {
        TopoDS_Shape aShape = ic->SelectedShape();
        if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
          aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) );
      }
      else {
        OCCViewer_ViewPort3d* vp =  ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
        aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
      }

      aPntDlg->OnPointSelected( aPnt );  // "feed" the point to point construction dialog
    } // acceptMouseEvent()
  }
  return false;
}

Here is the call graph for this function:


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