Version: 6.3.1
Signals | Public Member Functions | Static Public Member Functions | Protected Types | Protected Slots | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Types

GLViewer_ViewPort2d Class Reference

#include <GLViewer_ViewPort2d.h>

Inheritance diagram for GLViewer_ViewPort2d:
Inheritance graph

Signals

void vpUpdateValues ()
 Emits after any transformation.
void objectMoved ()
void vpKeyEvent (QKeyEvent *)
void vpMouseEvent (QMouseEvent *)
void vpWheelEvent (QWheelEvent *)
void vpDrawExternal (QPainter *)
void contextMenuRequested (QContextMenuEvent *)

Public Member Functions

 GLViewer_ViewPort2d (QWidget *parent, GLViewer_ViewFrame *theViewFrame=NULL)
 ~GLViewer_ViewPort2d ()
void turnGrid (GLboolean on)
 On/off rectangular grid.
GLViewer_GridgetGrid () const
 Returns rectangular grid.
void setGridColor (const QColor gridColor, const QColor axisColor)
 Returns grid color.
GLViewer_ViewFramegetViewFrame () const
 Returns parent window.
GLViewer_WidgetgetGLWidget () const
 Returns painted widget.
virtual QPaintDevice * getPaintDevice ()
void setBackgroundColor (const QColor &color)
 Sets background color.
QColor backgroundColor () const
 Returns background color.
void setBorder (GLViewer_Rect *border)
 Sets borders of scene.
GLViewer_RectgetBorder () const
 Get current borders of scene.
void setMargin (GLfloat margin)
 Sets margin of borders.
GLfloat getMargin () const
 Returns margin of borders.
int getWidth () const
 Returns width of view.
int getHeight () const
 Returns height of view.
void getScale (GLfloat &xSc, GLfloat &ySc) const
 Returns scale factors.
void getPan (GLfloat &xPan, GLfloat &yPan) const
 returns offsets
void initResize (int width, int height)
 Resize view.
void startRotation (int, int)
 Begins rotation.
void rotate (int, int)
 Process rotation.
void endRotation ()
 Completes rotation.
bool isDragProcess ()
 Checks of dragging process state.
void turnCompass (GLboolean on)
 On/off compass.
void drawCompass ()
 Draws compass.
int getViewPortId ()
 Returns unique ID of ViewPort.
virtual BlockStatus currentBlock ()
 Redefined method.
void startSelectByRect (int x, int y)
 Initializes before selecting by rect.
void drawSelectByRect (int x, int y)
 Draw selecting rectandle.
void finishSelectByRect ()
 Pass rect into selector and update.
bool startPulling (GLViewer_Pnt)
 It is for ouv
void drawPulling (GLViewer_Pnt)
 It is for ouv
void finishPulling ()
 It is for ouv
bool isPulling () const
 It is for ouv
QRect selectionRect ()
 Returns selection by rect.
GLViewer_Rect win2GLV (const QRect &) const
 Transforms window rect to global rect.
QRect GLV2win (const GLViewer_Rect &) const
 Transforms global rect to window rect.
void setSketchingEnabled (bool)
 Activates/deactivates sketching.
bool isSketchingEnabled () const
 Checks active status of sketcher.
void setTransformEnabled (bool)
 Activates/deactivates transformer.
bool isTransformEnabled () const
 Checks active status of transformer.
void redrawPainters ()
 Redraw external pa inters.
virtual void onUpdate ()
 Updates view.

Static Public Member Functions

static QCursor * getDefaultCursor ()
static void setDefaultCursor (const QCursor &newCursor)
static QCursor * getRotCursor ()
static void setRotCursor (const QCursor &newCursor)
static QCursor * getSketchCursor ()
static void setSketchCursor (const QCursor &newCursor)

Protected Types

enum  ViewType { Type2D, Type3D }

Protected Slots

void onStartDragObject ()
 Initializes drag process.
void onPasteObject ()
 Pastes object from clipboard.
void onCutObject ()
 Cuts object to clipboard.
void onCopyObject ()
 Copies object to clipboard.
void onMaybeTip (QPoint thePoint, QString &text, QFont &font, QRect &theTextReg, QRect &theViewReg)
 Sets tool tip with.
virtual void onChangeBgColor ()

Protected Member Functions

void onDragObject (QMouseEvent *)
virtual void mouseMoveEvent (QMouseEvent *)
virtual void mousePressEvent (QMouseEvent *)
virtual void mouseReleaseEvent (QMouseEvent *)
virtual void mouseDoubleClickEvent (QMouseEvent *)
virtual void paintEvent (QPaintEvent *)
virtual void resizeEvent (QResizeEvent *)
virtual void reset ()
 Returns view to begin state.
virtual void pan (int dx, int dy)
 Sets offset to view.
virtual void setCenter (int x, int y)
 Sets view center in global coords.
virtual void zoom (int x0, int y0, int x1, int y1)
 Process zoming transformation with mouse tracking from ( x0, y0 ) to ( x1, y1 )
virtual void fitRect (const QRect &)
 Transforms view by rectangle.
virtual void fitSelect ()
 Transforms view by selection.
virtual void fitAll (bool keepScale=false, bool withZ=true)
 Transform view by view borders ( if.
void selectVisualId (ViewType)
virtual void contextMenuEvent (QContextMenuEvent *e)
virtual void keyPressEvent (QKeyEvent *)
virtual void keyReleaseEvent (QKeyEvent *)
virtual void wheelEvent (QWheelEvent *)

Static Protected Member Functions

static void createCursors ()
 STATICS.
static void destroyCursors ()
static QCursor * getHandCursor ()
static void setHandCursor (const QCursor &newCursor)
static QCursor * getPanCursor ()
static void setPanCursor (const QCursor &newCursor)
static QCursor * getPanglCursor ()
static void setPanglCursor (const QCursor &newCursor)
static QCursor * getZoomCursor ()
static void setZoomCursor (const QCursor &newCursor)

Protected Attributes

GLViewer_ViewFramemyViewFrame
GLViewer_WidgetmyGLWidget
GLViewer_RectmyBorder
QColor myBackgroundColor
GLfloat myMargin
int myHeight
int myWidth
GLfloat myXScale
GLfloat myYScale
GLfloat myXOldScale
GLfloat myYOldScale
GLfloat myXPan
GLfloat myYPan
GLViewer_GridmyGrid
GLViewer_CompassmyCompass
int myIsDragProcess
float * myCurDragPosX
float * myCurDragPosY
QPoint * mypFirstPoint
QPoint * mypLastPoint
bool myIsPulling
GLViewer_ObjectmyPullingObject
int myViewPortId
QtxToolTipmyObjectTip
bool myIsMouseReleaseBlock
 flag to block mouse release event just after mouse double-click
QRubberBand * myRectBand
 selection rectangle rubber band
bool myEnableSketching
bool myEnableTransform
bool myPaintersRedrawing

Private Types

enum  vpDragState { noDrag, initDrag, inDrag }
 

Dragging states.

More...

Detailed Description

Class GLViewer_ViewPort 2D visualisation canvas of GLViewer


Member Enumeration Documentation

Enumerator:
noDrag 
initDrag 
inDrag 
enum GLViewer_ViewPort::ViewType [protected, inherited]
Enumerator:
Type2D 
Type3D 

Constructor & Destructor Documentation

GLViewer_ViewPort2d::GLViewer_ViewPort2d ( QWidget parent,
GLViewer_ViewFrame theViewFrame = NULL 
)
GLViewer_ViewPort2d::~GLViewer_ViewPort2d ( )

Destructor

References myBorder, myCompass, myGLWidget, myGrid, and myRectBand.


Member Function Documentation

void GLViewer_ViewPort2d::turnGrid ( GLboolean  on)

Creates or deletes grid

Parameters:
on- if it is true, then to create

References GRID_XSIZE, GRID_YSIZE, HEIGHT, myGrid, myXPan, myXScale, myYPan, myYScale, and WIDTH.

GLViewer_Grid* GLViewer_ViewPort2d.getGrid ( ) const

References myGrid.

void GLViewer_ViewPort2d::setGridColor ( const QColor  gridColor,
const QColor  axisColor 
)

Changes grid color

Parameters:
gridColor- new grid color
axisColor- new axis color

References myGrid, GLViewer_Grid.setAxisColor(), and GLViewer_Grid.setGridColor().

GLViewer_ViewFrame* GLViewer_ViewPort2d.getViewFrame ( ) const

References myViewFrame.

GLViewer_Widget* GLViewer_ViewPort2d.getGLWidget ( ) const

References myGLWidget.

virtual QPaintDevice* GLViewer_ViewPort2d.getPaintDevice ( ) [virtual]

Reimplemented from GLViewer_ViewPort.

References myGLWidget.

void GLViewer_ViewPort2d::setBackgroundColor ( const QColor &  color) [virtual]

Changes background color

Parameters:
color- new background color

Reimplemented from GLViewer_ViewPort.

References myGLWidget.

QColor GLViewer_ViewPort2d::backgroundColor ( ) const [virtual]
Returns:
background color

Reimplemented from GLViewer_ViewPort.

void GLViewer_ViewPort2d.setBorder ( GLViewer_Rect border)

References myBorder.

GLViewer_Rect* GLViewer_ViewPort2d.getBorder ( ) const

References myBorder.

void GLViewer_ViewPort2d.setMargin ( GLfloat  margin)

References myMargin.

GLfloat GLViewer_ViewPort2d.getMargin ( ) const

References myMargin.

int GLViewer_ViewPort2d.getWidth ( ) const

References myWidth.

int GLViewer_ViewPort2d.getHeight ( ) const

References myHeight.

void GLViewer_ViewPort2d.getScale ( GLfloat &  xSc,
GLfloat &  ySc 
) const

References myXScale, and myYScale.

void GLViewer_ViewPort2d.getPan ( GLfloat &  xPan,
GLfloat &  yPan 
) const

References myXPan, and myYPan.

void GLViewer_ViewPort2d::initResize ( int  x,
int  y 
)
void GLViewer_ViewPort2d::startRotation ( int  x,
int  y 
)

Begins rotation

Parameters:
x,y- start point

References myGLWidget, and GLViewer_Widget.setRotationStart().

void GLViewer_ViewPort2d::rotate ( int  intX,
int  intY 
)
void GLViewer_ViewPort2d::endRotation ( )
bool GLViewer_ViewPort2d.isDragProcess ( )

References myIsDragProcess.

void GLViewer_ViewPort2d::turnCompass ( GLboolean  on)

Creates or deletes compass

Parameters:
on- if it is true, then to create

References myCompass, and GLViewer_Compass.TopRight.

void GLViewer_ViewPort2d::drawCompass ( )
int GLViewer_ViewPort2d.getViewPortId ( )

References myViewPortId.

BlockStatus GLViewer_ViewPort2d::currentBlock ( ) [virtual]
Returns:
blocking status for current started operations

Reimplemented from GLViewer_ViewPort.

References BS_Highlighting, BS_NoBlock, BS_Selection, inDrag, myCurDragPosX, myCurDragPosY, myIsDragProcess, mypFirstPoint, and mypLastPoint.

void GLViewer_ViewPort2d::startSelectByRect ( int  x,
int  y 
)

Initializes rectangle selection

Parameters:
x,y- start point

References mypFirstPoint, mypLastPoint, myRectBand, and Plot2d.Rectangle.

void GLViewer_ViewPort2d::drawSelectByRect ( int  x,
int  y 
)

Draws rectangle selection

Parameters:
x,y- current point

References mypFirstPoint, mypLastPoint, myRectBand, and selectionRect().

void GLViewer_ViewPort2d::finishSelectByRect ( )

Finishes rectangle selection

References mypFirstPoint, mypLastPoint, and myRectBand.

bool GLViewer_ViewPort2d::startPulling ( GLViewer_Pnt  point)
void GLViewer_ViewPort2d::drawPulling ( GLViewer_Pnt  point)
void GLViewer_ViewPort2d::finishPulling ( )
bool GLViewer_ViewPort2d.isPulling ( ) const

References myIsPulling.

QRect GLViewer_ViewPort2d::selectionRect ( )
Returns:
rectangle selection

References mypFirstPoint, and mypLastPoint.

GLViewer_Rect GLViewer_ViewPort2d::win2GLV ( const QRect &  theRect) const

Convert rectangle in window co-ordinates to GL co-ordinates

Returns:
converted rectangle

References modelMatrix, GLViewer_Rect.setBottom(), GLViewer_Rect.setLeft(), GLViewer_Rect.setRight(), and GLViewer_Rect.setTop().

QRect GLViewer_ViewPort2d::GLV2win ( const GLViewer_Rect theRect) const

Convert rectangle in GL co-ordinates to window co-ordinates

Returns:
converted rectangle

References GLViewer_Rect.bottom(), GLViewer_Rect.left(), modelMatrix, GLViewer_Rect.right(), and GLViewer_Rect.top().

void GLViewer_ViewPort2d.vpUpdateValues ( ) [signal]
void GLViewer_ViewPort2d.objectMoved ( ) [signal]
void GLViewer_ViewPort2d::onDragObject ( QMouseEvent *  e) [protected]
void GLViewer_ViewPort2d::mouseMoveEvent ( QMouseEvent *  e) [protected, virtual]

Emits 'mouseEvent' signal. [ virtual protected ]

Reimplemented from GLViewer_ViewPort.

References inDrag, myIsDragProcess, onDragObject(), and GLViewer_ViewPort.vpMouseEvent().

void GLViewer_ViewPort2d::mousePressEvent ( QMouseEvent *  e) [protected, virtual]
void GLViewer_ViewPort2d::mouseReleaseEvent ( QMouseEvent *  e) [protected, virtual]
void GLViewer_ViewPort2d::mouseDoubleClickEvent ( QMouseEvent *  e) [protected, virtual]

Custom mouse double click event handler

Reimplemented from GLViewer_ViewPort.

References myIsMouseReleaseBlock.

void GLViewer_ViewPort2d::paintEvent ( QPaintEvent *  e) [protected, virtual]

Custom paint event handler

Reimplemented from GLViewer_ViewPort.

References myGLWidget.

void GLViewer_ViewPort2d::resizeEvent ( QResizeEvent *  e) [protected, virtual]

Custom resize event handler

void GLViewer_ViewPort2d::reset ( ) [protected, virtual]
void GLViewer_ViewPort2d::pan ( int  dx,
int  dy 
) [protected, virtual]

Sets offset to view

Parameters:
dx- X offset
dy- Y offset

Implements GLViewer_ViewPort.

References GLViewer_Widget.getRotation(), myGLWidget, myGrid, myXPan, myXScale, myYPan, myYScale, PI, rx, ry, GLViewer_Widget.setPan(), GLViewer_Grid.setPan(), and GLViewer_Widget.setScale().

void GLViewer_ViewPort2d::setCenter ( int  x,
int  y 
) [protected, virtual]

Sets view center in global coords

Parameters:
x,y- global co-ordinates of center

Implements GLViewer_ViewPort.

References myGLWidget, myGrid, myXOldScale, myXPan, myXScale, myYOldScale, myYPan, myYScale, GLViewer_Widget.setPan(), GLViewer_Grid.setPan(), GLViewer_Widget.setScale(), and GLViewer_Grid.setZoom().

void GLViewer_ViewPort2d::zoom ( int  x0,
int  y0,
int  x,
int  y 
) [protected, virtual]
void GLViewer_ViewPort2d::fitRect ( const QRect &  rect) [protected, virtual]
void GLViewer_ViewPort2d::fitSelect ( ) [protected, virtual]
void GLViewer_ViewPort2d::fitAll ( bool  keepScale = false,
bool  withZ = true 
) [protected, virtual]
void GLViewer_ViewPort2d::onStartDragObject ( ) [protected, slot]

SLOT: initializes drag process

References initDrag, myCurDragPosX, myCurDragPosY, myIsDragProcess, and noDrag.

void GLViewer_ViewPort2d::onPasteObject ( ) [protected, slot]

SLOT: pastes object from clipboard

void GLViewer_ViewPort2d::onCutObject ( ) [protected, slot]
void GLViewer_ViewPort2d::onCopyObject ( ) [protected, slot]
void GLViewer_ViewPort2d::onMaybeTip ( QPoint  thePoint,
QString &  theText,
QFont &  theFont,
QRect &  theTextReg,
QRect &  theRegion 
) [protected, slot]
Parameters:
textto
theTextRegand on
theViewRegwhan mouse is on
thePoint

SLOT: called when tooltip should be shown

References GLViewer_Context.getCurrentObject(), GLViewer_Object.getName(), GLViewer_Object.getToolTipText(), GLViewer_ViewFrame.getViewer(), getViewFrame(), and GLViewer_Object.isTooTipHTML().

void GLViewer_ViewPort::setSketchingEnabled ( bool  enable) [inherited]

Enables / disables sketching [ public ]

References GLViewer_ViewPort.myEnableSketching.

bool GLViewer_ViewPort::isSketchingEnabled ( ) const [inherited]

Returns 'true' if sketching is enabled in this viewport. [ public ]

References GLViewer_ViewPort.myEnableSketching.

void GLViewer_ViewPort::setTransformEnabled ( bool  enable) [inherited]

Enables / disables transformations. [ public ]

References GLViewer_ViewPort.myEnableTransform.

bool GLViewer_ViewPort::isTransformEnabled ( ) const [inherited]

Returns 'true' if transformations ( rotation, zoom etc. ) are enabled in this viewport. [ public ]

References GLViewer_ViewPort.myEnableTransform.

void GLViewer_ViewPort::redrawPainters ( ) [inherited]

Forces to redraw the viewport by an external painter. [ public ]

References GLViewer_ViewPort.myPaintersRedrawing.

void GLViewer_ViewPort::onUpdate ( ) [virtual, inherited]

Updates this view. Does nothing by default. [ virtual public ]

void GLViewer_ViewPort::selectVisualId ( ViewType  type) [protected, inherited]

Selects visual ID for OpenGL window ( X11 specific ). [ protected ]

References test_table.a, GLViewer_ViewPort.backgroundColor(), choose_cmap(), Plot2d.None, GLViewer_ViewPort.Type2D, GLViewer_ViewPort.Type3D, and Window.

void GLViewer_ViewPort::contextMenuEvent ( QContextMenuEvent *  e) [protected, virtual, inherited]

Custom context menu event handler

References GLViewer_ViewPort.contextMenuRequested().

void GLViewer_ViewPort::createCursors ( ) [static, protected, inherited]
void GLViewer_ViewPort::destroyCursors ( ) [static, protected, inherited]
static QCursor* GLViewer_ViewPort.getHandCursor ( ) [static, protected, inherited]
void GLViewer_ViewPort::setHandCursor ( const QCursor &  newCursor) [static, protected, inherited]

Sets new cursor for drawing rectangle in the viewport. [ static ]

References GLViewer_ViewPort.handCursor.

static QCursor* GLViewer_ViewPort.getPanCursor ( ) [static, protected, inherited]
void GLViewer_ViewPort::setPanCursor ( const QCursor &  newCursor) [static, protected, inherited]

Sets new cursor for panning. [ static ]

References GLViewer_ViewPort.panCursor.

static QCursor* GLViewer_ViewPort.getPanglCursor ( ) [static, protected, inherited]
void GLViewer_ViewPort::setPanglCursor ( const QCursor &  newCursor) [static, protected, inherited]

Sets new cursor for global panning. [ static ]

References GLViewer_ViewPort.panglCursor.

static QCursor* GLViewer_ViewPort.getZoomCursor ( ) [static, protected, inherited]
void GLViewer_ViewPort::setZoomCursor ( const QCursor &  newCursor) [static, protected, inherited]

Sets new cursor for zooming. [ static ]

References GLViewer_ViewPort.zoomCursor.

static QCursor* GLViewer_ViewPort.getDefaultCursor ( ) [static, inherited]
void GLViewer_ViewPort::setDefaultCursor ( const QCursor &  newCursor) [static, inherited]

Sets new default cursor. [ static ]

References GLViewer_ViewPort.defCursor.

static QCursor* GLViewer_ViewPort.getRotCursor ( ) [static, inherited]
void GLViewer_ViewPort::setRotCursor ( const QCursor &  newCursor) [static, inherited]

Sets new cursor for rotating. [ static ]

References GLViewer_ViewPort.rotCursor.

static QCursor* GLViewer_ViewPort.getSketchCursor ( ) [static, inherited]
void GLViewer_ViewPort::setSketchCursor ( const QCursor &  newCursor) [static, inherited]

Sets new cursor for rotating. [ static ]

References GLViewer_ViewPort.rotCursor, and GLViewer_ViewPort.sketchCursor.

void GLViewer_ViewPort::keyPressEvent ( QKeyEvent *  e) [protected, virtual, inherited]

Emits 'keyEvent' signal. [ virtual protected ]

References GLViewer_ViewPort.vpKeyEvent().

void GLViewer_ViewPort::keyReleaseEvent ( QKeyEvent *  e) [protected, virtual, inherited]

Emits 'keyEvent' signal. [ virtual protected ]

References GLViewer_ViewPort.vpKeyEvent().

void GLViewer_ViewPort::wheelEvent ( QWheelEvent *  e) [protected, virtual, inherited]

Emits 'mouseEvent' signal. [ virtual protected ]

References GLViewer_ViewPort.vpWheelEvent().

void GLViewer_ViewPort::onChangeBgColor ( ) [protected, virtual, slot, inherited]

Sets the background color with color selection dialog. [ virtual protected slot ]

References GLViewer_ViewPort.backgroundColor(), and GLViewer_ViewPort.setBackgroundColor().

void GLViewer_ViewPort.vpKeyEvent ( QKeyEvent *  ) [signal, inherited]
void GLViewer_ViewPort.vpMouseEvent ( QMouseEvent *  ) [signal, inherited]
void GLViewer_ViewPort.vpWheelEvent ( QWheelEvent *  ) [signal, inherited]
void GLViewer_ViewPort.vpDrawExternal ( QPainter *  ) [signal, inherited]
void GLViewer_ViewPort.contextMenuRequested ( QContextMenuEvent *  ) [signal, inherited]

Field Documentation

GLfloat GLViewer_ViewPort2d.myMargin [protected]
int GLViewer_ViewPort2d.myWidth [protected]
GLfloat GLViewer_ViewPort2d.myXScale [protected]
GLfloat GLViewer_ViewPort2d.myYScale [protected]
GLfloat GLViewer_ViewPort2d.myXOldScale [protected]
GLfloat GLViewer_ViewPort2d.myYOldScale [protected]
GLfloat GLViewer_ViewPort2d.myXPan [protected]
GLfloat GLViewer_ViewPort2d.myYPan [protected]
QPoint* GLViewer_ViewPort2d.mypFirstPoint [protected]
QPoint* GLViewer_ViewPort2d.mypLastPoint [protected]
QRubberBand* GLViewer_ViewPort2d.myRectBand [protected]
bool GLViewer_ViewPort.myEnableSketching [protected, inherited]
bool GLViewer_ViewPort.myEnableTransform [protected, inherited]
bool GLViewer_ViewPort.myPaintersRedrawing [protected, inherited]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS